gemini context.com
gemini context.com logo

Gemini Context

Provides persistent conversation history, semantic search, and API-level caching for Gemini models to optimize token usa...

Created byApr 22, 2025

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

Installation

Basic Usage

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:
Each command sets up the appropriate configuration files and provides instructions for completing the integration.

Usage Examples

For Beginners

Directly using the server:

  1. Start the server:
  1. Interact using the provided test scripts:

Using in your Node.js application:

For Power Users

Using custom configurations:

Using the caching system for cost optimization:

Using with MCP Tools (like Cursor)

This server implements the Model Context Protocol (MCP), making it compatible with tools like Cursor or other AI-enhanced development environments.

Available MCP Tools

  1. Context Management Tools:
  1. Caching Tools:

Connecting with Cursor

When used with Cursor, you can connect via the MCP configuration:
For detailed usage instructions for MCP tools, see README-MCP.md.

Configuration Options

Environment Variables

Create a .env file with these options:

Development

Further Reading

  • For MCP-specific usage, see README-MCP.md
  • Explore the manifest in mcp-manifest.json to understand available tools
  • Check example scripts in the repository for usage patterns

Future Improvements

  • Database persistence for context and caches
  • Cache size management and eviction policies
  • Vector-based semantic search
  • Analytics and metrics tracking
  • Integration with vector stores
  • Batch operations for context management
  • Hybrid caching strategies
  • Automatic prompt optimization

License

MIT

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

Installation

Basic Usage

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:
Each command sets up the appropriate configuration files and provides instructions for completing the integration.

Usage Examples

For Beginners

Directly using the server:

  1. Start the server:
  1. Interact using the provided test scripts:

Using in your Node.js application:

For Power Users

Using custom configurations:

Using the caching system for cost optimization:

Using with MCP Tools (like Cursor)

This server implements the Model Context Protocol (MCP), making it compatible with tools like Cursor or other AI-enhanced development environments.

Available MCP Tools

  1. Context Management Tools:
  1. Caching Tools:

Connecting with Cursor

When used with Cursor, you can connect via the MCP configuration:
For detailed usage instructions for MCP tools, see README-MCP.md.

Configuration Options

Environment Variables

Create a .env file with these options:

Development

Further Reading

  • For MCP-specific usage, see README-MCP.md
  • Explore the manifest in mcp-manifest.json to understand available tools
  • Check example scripts in the repository for usage patterns

Future Improvements

  • Database persistence for context and caches
  • Cache size management and eviction policies
  • Vector-based semantic search
  • Analytics and metrics tracking
  • Integration with vector stores
  • Batch operations for context management
  • Hybrid caching strategies
  • Automatic prompt optimization

License

MIT