Context MCP
Provides persistent context management for AI agents by storing and querying semantic information using Upstash Vector DB and Google AI embeddings. It enables semantic search, batch operations, and metadata filtering to help agents retrieve relevant stored knowledge.
README
Context MCP
A Model Context Protocol (MCP) server that provides persistent context management for AI agents like Cursor, Claude Code, and Claude Desktop. Uses Upstash Vector DB for storage and Google AI for embeddings.
Features
- Add Context: Store text with metadata, automatically embedded and indexed
- Query Context: Semantic search to find relevant stored information
- Batch Operations: Efficiently add or delete multiple contexts
- Metadata Filtering: Filter queries by metadata attributes
- Statistics: Monitor your vector database usage
Prerequisites
-
Upstash Vector DB account - Sign up at Upstash
- Create a new Vector Index with dimension
768(for Google's text-embedding-004) - Get your REST URL and Token
- Create a new Vector Index with dimension
-
Google AI API Key - Get from Google AI Studio
Installation
# Clone the repository
git clone <your-repo-url>
cd context-mcp
# Install dependencies
npm install
# Build the project
npm run build
Configuration
Create a .env file based on .env.example:
cp .env.example .env
Fill in your credentials:
UPSTASH_VECTOR_REST_URL=your_upstash_vector_url
UPSTASH_VECTOR_REST_TOKEN=your_upstash_vector_token
GOOGLE_AI_API_KEY=your_google_ai_api_key
Usage with AI Agents
Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"context": {
"command": "node",
"args": ["path/to/context-mcp/dist/index.js"],
"env": {
"UPSTASH_VECTOR_REST_URL": "your_url",
"UPSTASH_VECTOR_REST_TOKEN": "your_token",
"GOOGLE_AI_API_KEY": "your_key"
}
}
}
}
Cursor
Add to your Cursor MCP settings:
{
"mcpServers": {
"context": {
"command": "node",
"args": ["path/to/context-mcp/dist/index.js"],
"env": {
"UPSTASH_VECTOR_REST_URL": "your_url",
"UPSTASH_VECTOR_REST_TOKEN": "your_token",
"GOOGLE_AI_API_KEY": "your_key"
}
}
}
}
Claude Code (Windsurf)
Add to your MCP configuration file.
Available Tools
add_context
Store a single piece of context.
Parameters:
id(required): Unique identifiercontent(required): Text content to storemetadata(optional): Key-value pairs for filtering
add_contexts_batch
Store multiple contexts efficiently.
Parameters:
contexts(required): Array of{id, content, metadata}objects
query_context
Search for relevant contexts.
Parameters:
query(required): Natural language search querytopK(optional): Number of results (1-20, default: 5)filter(optional): Upstash filter expression
delete_context
Delete a single context by ID.
Parameters:
id(required): ID of context to delete
delete_contexts_batch
Delete multiple contexts.
Parameters:
ids(required): Array of IDs to delete
get_stats
Get database statistics (vector count, dimensions).
Example Usage
Once connected, you can ask your AI agent to:
"Add this project documentation to my context with id 'project-readme'"
"Search my context for information about authentication"
"Store these meeting notes with category 'meetings' and date '2024-01-15'"
"What relevant context do I have about the payment system?"
Upstash Filter Syntax
When querying, you can filter by metadata:
# Exact match
category = 'meetings'
# Numeric comparison
priority > 5
# Multiple conditions
category = 'docs' AND priority >= 3
Development
# Run in development mode
npm run dev
# Build for production
npm run build
# Start production server
npm start
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
E2B
Using MCP to run code via e2b.