
ogoldberg/gemini-context-mcp-server
Developer toolsこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
Gemini のより大きいコンテキスト・ウィンドウを活用して、AI ツールの機能を強化する Cursor 用の MCP サーバー
概要
コンテキスト管理とキャッシュのためのGeminiの能力を活用する強力なMCP(Model Context Protocol)サーバーの実装。 このサーバーは、Geminiの2Mトークンコンテクストウィンドウの値を最大化し、大きなコンテクストの効率的なキャッシュを実現するツールを提供します。 - - Geminiの広範なコンテキスト機能を活用 - 複数のインタラクションで会話状態を維持 - - メタデータでコンテキストを追加、取得、検索 - 意味の類似性を使用して関連するコンテキストを見つける - セッションとコンテキストが自動的に期限切れ - - 大規模なシステムプロンプトと指示を効率的に再利用 - - 頻繁に使用されるコンテキストのトークン使用コストを削減 - - キャッシュの有効期限の制御 - - 有効期限切れのキャッシュは自動的に削除されます - ノード.
概要(AI 翻訳)
コンテキスト管理とキャッシュのためのGeminiの能力を活用する強力なMCP(Model Context Protocol)サーバーの実装。 このサーバーは、Geminiの2Mトークンコンテクストウィンドウの値を最大化し、大きなコンテクストの効率的なキャッシュを実現するツールを提供します。
OST の特徴
コンテキスト管理
- 最大2Mトークンコンテクストウィンドウサポート - Geminiの広範なコンテキスト機能を活用
- セッションベースの会話 - 複数のインタラクション間で会話状態を維持 -スマートコンテキストトラッキング - メタデータでコンテキストを追加、取得、検索 -Semantic search - 意味のある類似性を使用して関連するコンテキストを見つける
- 自動コンテキストクリーンアップ - セッションとコンテキストは自動的に期限切れ
##APIキャッシュ -大プロンプトキャッシュ - 大規模なシステムプロンプトと指示を効率的に再利用 -Costの最適化 - 頻繁に使用されるコンテキストのトークン使用コストを削減
- TTL管理 - キャッシュの有効期限の制御
- 自動クリーンアップ - 有効期限のキャッシュは自動的に削除されます
クイックスタート
前提条件
- Node.js 18+ をインストール
- Gemini API キー (ここに 1 つを得る)
インストール
##基本利用
MCP クライアントの統合
このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。
README
以下は原文 README の抜粋です。原文を見る。
Gemini Context MCP Server
A powerful MCP (Model Context Protocol) server implementation that leverages Gemini’s capabilities for context management and caching. This server maximizes the value of Gemini’s 2M token context window while providing tools for efficient caching of large contexts.
🚀 Features
Context Management
- Up to 2M token context window support - Leverage Gemini’s extensive context capabilities
- Session-based conversations - Maintain conversational state across multiple interactions
- Smart context tracking - Add, retrieve, and search context with metadata
- Semantic search - Find relevant context using semantic similarity
- Automatic context cleanup - Sessions and context expire automatically
API Caching
- Large prompt caching - Efficiently reuse large system prompts and instructions
- Cost optimization - Reduce token usage costs for frequently used contexts
- TTL management - Control cache expiration times
- Automatic cleanup - Expired caches are removed automatically
🏁 Quick Start
Prerequisites
- Node.js 18+ installed
- Gemini API key (Get one here)
Installation
# Clone the repository
git clone https://github.com/ogoldberg/gemini-context-mcp-server
cd gemini-context-mcp-server
# Install dependencies
npm install
# Copy environment variables example
cp .env.example .env
# Add your Gemini API key to .env file
# GEMINI_API_KEY=your_api_key_here
Basic Usage
# Build the server
npm run build
# Start the server
node dist/mcp-server.js
MCP Client Integration
This MCP server can be integrated with various MCP-compatible clients:
- Claude Desktop - Add as an MCP server in Claude settings
- Cursor - Configure in Cursor’s AI/MCP settings
- VS Code - Use with MCP-compatible extensions
For detailed integration instructions with each client, see the MCP Client Configuration Guide in the MCP documentation.
Quick Client Setup
Use our simplified client installation commands:
# Install and configure for Claude Desktop
npm run install:claude
# Install and configure for Cursor
npm run install:cursor
# Install and configure for VS Code
npm run install:vscode
Each command sets up the appropriate configuration files and provides instructions for completing the integration.
💻 Usage Examples
For Beginners
Directly using the server:
-
Start the server:
node dist/mcp-server.js -
Interact using the provided test scripts:
# Test basic context management node test-gemini-context.js # Test caching features node test-gemini-api-cache.js
Using in your Node.js application:
import { GeminiContextServer } from './src/gemini-context-server.js';
async function main() {
// Create server instance
const server = new GeminiContextServer();
インストール
This server does not publish a one-line install command.
Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →