
Store and retrieve entities, relations and observations in a persistent local knowledge graph.

An MCP server that manages Gemini session context and large prompt caches, exposing tools for context and caching operations to MCP-compatible clients.
Gemini Context MCP Server is cataloged as an MCP server attributed to ogoldberg. An MCP server that manages Gemini session context and large prompt caches, exposing tools for context and caching operations to MCP-compatible clients. It is categorized under ai agents-models. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.
Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.
Catalog license label: MIT. Check the source repository's current license and terms before using, modifying or distributing this software.
能力定义尚未审核。未核验的采集内容不会作为可信接口展示。
暂无可展示的已审核记录。这不表示上游不支持此能力。
暂无可展示的已审核记录。这不表示上游不支持此能力。
暂无可展示的已审核记录。这不表示上游不支持此能力。
Email delivery is not connected. This page does not collect email addresses or create subscriptions.
Browse the registry for current listings instead.
Reviews for Gemini Context MCP Server are not available yet
Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.
Cache expiration is controlled through TTL management, and expired caches are removed automatically.
Yes, sessions and context expire automatically, and the session timeout can be configured.
README.md · da4a950cf6bf · 采集于 2026-11-13 09:47:09 UTC
保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。
当前显示最后一次成功采集的文档快照,请以来源页面为准。
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.
# 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
# Build the server
npm run build
# Start the server
node dist/mcp-server.js
This MCP server can be integrated with various MCP-compatible clients:
For detailed integration instructions with each client, see the MCP Client Configuration Guide in the MCP documentation.
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.
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
import { GeminiContextServer } from './src/gemini-context-server.js';
async function main() {
// Create server instance
const server = new GeminiContextServer();
// Generate a response in a session
const sessionId = "user-123";
const response = await server.processMessage(sessionId, "What is machine learning?");
console.log("Response:", response);
// Ask a follow-up in the same session (maintains context)
const followUp = await server.processMessage(sessionId, "What are popular algorithms?");
console.log("Follow-up:", followUp);
}
main();
// Custom configuration
const config = {
gemini: {
apiKey: process.env.GEMINI_API_KEY,
model: 'gemini-2.0-pro',
temperature: 0.2,
maxOutputTokens: 1024,
},
server: {
sessionTimeoutMinutes: 30,
maxTokensPerSession: 1000000
}
};
const server = new GeminiContextServer(config);
// Create a cache for large system instructions
const cacheName = await server.createCache(
'Technical Support System',
'You are a technical support assistant for a software company...',
7200 // 2 hour TTL
);
// Generate content using the cache
const response = await server.generateWithCache(
cacheName,
'How do I reset my password?'
);
// Clean up when done
await server.deleteCache(cacheName);
This server implements the Model Context Protocol (MCP), making it compatible with tools like Cursor or other AI-enhanced development environments.
Context Management Tools:
generate_text - Generate text with contextget_context - Get current context for a sessionclear_context - Clear session contextadd_context - Add specific context entriessearch_context - Find relevant context semanticallyCaching Tools:
mcp_gemini_context_create_cache - Create a cache for large contextsmcp_gemini_context_generate_with_cache - Generate with cached contextmcp_gemini_context_list_caches - List all available cachesmcp_gemini_context_update_cache_ttl - Update cache TTLmcp_gemini_context_delete_cache - Delete a cacheWhen used with Cursor, you can connect via the MCP configuration:
{
"name": "gemini-context",
"version": "1.0.0",
"description": "Gemini context management and caching MCP server",
"entrypoint": "dist/mcp-server.js",
"capabilities": {
"tools": true
},
"manifestPath": "mcp-manifest.json",
"documentation": "README-MCP.md"
}
For detailed usage instructions for MCP tools, see README-MCP.md.
Create a .env file with these options:
# Required
GEMINI_API_KEY=your_api_key_here
GEMINI_MODEL=gemini-2.0-flash
# Optional - Model Settings
GEMINI_TEMPERATURE=0.7
GEMINI_TOP_K=40
GEMINI_TOP_P=0.9
GEMINI_MAX_OUTPUT_TOKENS=2097152
# Optional - Server Settings
MAX_SESSIONS=50
SESSION_TIMEOUT_MINUTES=120
MAX_MESSAGE_LENGTH=1000000
MAX_TOKENS_PER_SESSION=2097152
DEBUG=false
# Build TypeScript files
npm run build
# Run in development mode with auto-reload
npm run dev
# Run tests
npm test
MIT
Claim this server with your GitHub account to request manual ownership verification.
Link to the catalog listing for Gemini Context MCP Server from your README. This badge does not certify ownership, compatibility or security.
[](https://awesome-mcp.com/servers/gemini-context-mcp-server)Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.
来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。
尚无已审核的包 / 镜像标识,暂不展示下载统计。
Alternative and complementary servers in the same category

Store and retrieve entities, relations and observations in a persistent local knowledge graph.

Organize problem solving into revisable, branching thought steps through an MCP tool.

Query-aware context compression with an MCP plugin for coding agents, plus Python and HTTP interfaces for reducing the context sent to a language model.