Gemini ContextSAFE
MCP server for Cursor that leverages Gemini's much larger context window to enhance the capabilities of the AI tools
Overview
From the repository's own README, as read at the audited commit. Badges and raw HTML are left out.
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](README-MCP.md#-configuring-with-popu
16c6b5c8a911OBSERVED · 2026-10-08Connect
Built from this server's own package name, version and transport as found in its source — not copied from anyone's documentation, so it cannot drift against a page we do not control. Replace the environment placeholders with a token scoped to the least it needs.
claude mcp add gemini-context-mcp --env GEMINI_API_KEY=${GEMINI_API_KEY} --env GEMINI_INPUT_TOKEN_LIMIT=${GEMINI_INPUT_TOKEN_LIMIT} --env GEMINI_MAX_OUTPUT_TOKENS=${GEMINI_MAX_OUTPUT_TOKENS} --env MAX_TOKENS_PER_SESSION=${MAX_TOKENS_PER_SESSION} -- npx -y @utilities/[email protected]{
"mcpServers": {
"gemini-context-mcp": {
"command": "npx",
"args": [
"-y",
"@utilities/[email protected]"
],
"env": {
"GEMINI_API_KEY": "${GEMINI_API_KEY}",
"GEMINI_INPUT_TOKEN_LIMIT": "${GEMINI_INPUT_TOKEN_LIMIT}",
"GEMINI_MAX_OUTPUT_TOKENS": "${GEMINI_MAX_OUTPUT_TOKENS}",
"MAX_TOKENS_PER_SESSION": "${MAX_TOKENS_PER_SESSION}"
}
}
}
}Exposed tools (12)
7 read · 3 write · 2 destructive. Blast radius: 2 tools can delete or overwrite — an agent that can be talked into calling a tool can be talked into calling this one.
| Tool | Risk | Description |
|---|---|---|
add_context | write | Add a new entry to the context |
clear_context | destructive | Clear the context for a session |
discover_capabilities | read | Returns a manifest describing all capabilities of this MCP server |
generate_text | read | Generate text using Gemini with context management |
get_context | read | Retrieve the current context for a session |
get_tool_help | read | Get detailed help and examples for a specific tool |
mcp_gemini_context_create_cache | write | Create a cache for frequently used large contexts |
mcp_gemini_context_delete_cache | destructive | Deletes a cache |
mcp_gemini_context_generate_with_cache | read | Generate content using a cached context |
mcp_gemini_context_list_caches | read | List all available caches |
mcp_gemini_context_update_cache_ttl | write | Updates a cache\ |
search_context | read | Search for relevant context using semantic similarity |
Trust audit
SAFEgrade B · trust 89/100 Nothing in the source contradicts what it says it does. Grade A is reserved for packages that have also passed the behavioural sandbox.
| Layer | What it checks | Result |
|---|---|---|
| L0 | Provenance & inventory | PASS |
| L1 | Static analysis of the code | PASS |
| L2 | Instruction surface (what it tells the agent) | PASS |
| L3 | Class-specific surface | WARN |
| L4 | Behavioural (sandbox) | SKIPPED |
What the source does
- Filesystem
- declared (1 observation(s))
- Network
- declared (2 observation(s))
- Shell
- declared (2 observation(s))
- Dependencies
- not all pinned
- Secrets in source
- none-found
Findings (5)
clear_context, mcp_gemini_context_delete_cache
@google/generative-ai, @modelcontextprotocol/sdk, commander, dotenv, lodash-es, zod, @jest/globals, @types/commander
load_dotenv() # load environment variables from .env
curl -LsSf https://astral.sh/uv/install.sh | sh
Gates applied: no_behavioural_pass, no_license.
16c6b5c8a911full audit observations/trust-audit/mcp-server/ogoldberg__gemini-context.json · Report an issue / request a re-scanAudit history
Every audit this server has had. A grade with a past is a grade somebody is still checking.
| Date | Source | Verdict | Grade | Score | Change |
|---|---|---|---|---|---|
| 2026-10-08 | 16c6b5c8a911 | SAFE | B | 89 | first audit |
Questions
What is the Gemini Context MCP server?
MCP server for Cursor that leverages Gemini's much larger context window to enhance the capabilities of the AI tools
What tools does Gemini Context expose?
12 in total: 7 read-only, 3 that write, and 2 that can delete or overwrite (clear_context, mcp_gemini_context_delete_cache). Every one is listed on this page with its risk.
Is Gemini Context safe to connect to an agent?
The audit found nothing in the source that contradicts what it says it does, and graded it B (89/100). Grade A is held back for packages that have also passed a sandboxed behavioural run, which is why a clean server reads B. Separately from the audit: 2 of its tools can destroy data, so scope the token you give it to what you actually need.
What credentials does Gemini Context need?
It reads GEMINI_API_KEY, GEMINI_INPUT_TOKEN_LIMIT, GEMINI_MAX_OUTPUT_TOKENS and MAX_TOKENS_PER_SESSION from the environment. Give it a token scoped to the least it needs — an agent that can be talked into calling a tool can be talked into calling it with your credentials.
How does Gemini Context run?
It speaks stdio, so it runs as a local process your client starts. It is published on npm as @utilities/gemini-context-mcp at 1.0.0.
How current is this page?
The grade is for one exact copy of the source (16c6b5c8a911), read on 2026-10-08. The repository is watched and re-audited when it changes.