Gemini Context MCP Server
About
MCP server for Cursor that leverages Gemini's much larger context window to enhance the capabilities of the AI tools
Explore
- Up to 2M token context window support
- Session-based conversations with state tracking
- Semantic search for relevant context
- Automatic context and cache expiration
- Large prompt caching for cost optimization
- TTL management for cached contexts
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
Gemini Context MCP ServerCommand (node, npx, python, etc.)Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
- Node.js 18+ installed
- Gemini API key (Get one here)
npm install
cp .env.example .env
Use our simplified client installation commands:
bash
npm run install:claude
npm run install:cursor
npm run install:vscode
Each command sets up the appropriate configuration files and provides instructions for completing the integration.
javascript// 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 .env file with these options:
bashgenerate_text
Generate text with context
get_context
Get current context for a session
clear_context
Clear session context
add_context
Add specific context entries
search_context
Find relevant context semantically
mcp_gemini_context_create_cache
Create a cache for large contexts
mcp_gemini_context_generate_with_cache
Generate with cached context
mcp_gemini_context_list_caches
List all available caches
mcp_gemini_context_update_cache_ttl
Update cache TTL
mcp_gemini_context_delete_cache
Delete a cache
This server implements the Model Context Protocol (MCP), making it compatible with tools like Cursor or other AI-enhanced development environments.
1. Context Management Tools:
- generate_text - Generate text with context
- get_context - Get current context for a session
- clear_context - Clear session context
- add_context - Add specific context entries
- search_context - Find relevant context semantically
2. Caching Tools:
- mcp_gemini_context_create_cache - Create a cache for large contexts
- mcp_gemini_context_generate_with_cache - Generate with cached context
- mcp_gemini_context_list_caches - List all available caches
- mcp_gemini_context_update_cache_ttl - Update cache TTL
- mcp_gemini_context_delete_cache - Delete a cache
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"gemini context mcp server": {
"gemini-context-mcp-server": {
"command": "node",
"args": [
"dist/mcp-server.js"
]
}
}
}
}
McpServers
{
"gemini-context-mcp-server": {
"command": "node",
"args": [
"dist/mcp-server.js"
]
}
}
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 automaticallyAPI 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
```bash
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.



