MCP Context Server
About
Server providing persistent multimodal context storage for LLM agents.
Details
- Author
- alex-feel
- Categories
- Developer Tools, AI, Knowledge Base
Jump to
Setup
Install MCP Context Server in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/alex-feel/mcp-context-server
Follow the installation instructions in the repository README, then restart your MCP client.
Server providing persistent multimodal context storage for LLM agents.
A high-performance Model Context Protocol (MCP) server providing persistent multimodal context storage for LLM agents. Built with FastMCP, this server enables seamless context sharing across multiple agents working on the same task through thread-based scoping.
[!WARNING]Upgrading from v2.x?Version 3.x.x uses a new database schema with UUIDv7 primary keys. Existing v2.x databases require a one-time data migration before they can be used with v3.x.x. The opt-in CLImcp-context-server-migrateships with the server.
See theMigration Guidebefore upgrading.Fresh installations are unaffected.
- Multimodal Context Storage: Store and retrieve both text and images
- UUIDv7 Context Identifiers: Every context entry is identified by a 32-character lowercase hex UUIDv7 value, providing time-ordered, globally unique IDs with a stable lex-string ordering
- Thread-Based Scoping: Agents working on the same task share context through thread IDs
- Flexible Metadata Filtering: Store custom structured data with any JSON-serializable fields and filter using 16 powerful operators
- Date Range Filtering: Filter context entries by creation timestamp using ISO 8601 format
- Tag-Based Organization: Efficient context retrieval with normalized, indexed tags
- Summary Generation: Optional automatic LLM-based summarization returned alongside truncatedtext_contentin all search tool results for better agent context efficiency (enabled by default with Ollama)
- Full-Text Search: Linguistic search with stemming, ranking, boolean queries (FTS5/tsvector), and cross-encoder reranking. Auto-enabled by default (ENABLE_FTS=auto); needs no extra dependencies
- Semantic Search: Vector similarity search for meaning-based retrieval with cross-encoder reranking. Auto-enabled by default (ENABLE_SEMANTIC_SEARCH=auto) whenever an embedding provider is available (embedding generation is on by default)
- Hybrid Search: Combined FTS + semantic search using Reciprocal Rank Fusion (RRF) with cross-encoder reranking. Auto-enabled by default (ENABLE_HYBRID_SEARCH=auto) whenever at least one of full-text or semantic search is available
- Server-Side Grep: Literal/regex, line-oriented, unranked pattern matching over stored records (grep_context) — the precise-locate complement to full-text/semantic search, with ripgrep-style output modes and bounded results. Auto-enabled by default (ENABLE_GREP_CONTEXT=auto), pure-Python so it behaves identically on SQLite and PostgreSQL
- Record Navigation (index_tree):navigate_contextbuilds an on-demand Markdown-heading table of contents per record, with the entry summary as the root node; optional per-node LLM summaries (on by default) enrich each section. Pair withread_context_rangeto extract any section
- Partial Reads:read_context_rangereturns a slice of one record by character range, line range, or outlinenode_id— so an agent can read only the relevant span of a long record instead of the whole thing
- Cross-Encoder Reranking: Automatic result refinement using FlashRank cross-encoder models for improved search precision (enabled by default)
- Embedding Compression (default ON): Reduces embedding storage by approximately 8x out of the box in v3.0.0. Bit-packed compressed vectors keep semantic and hybrid search working without changes to the tool surface, and the read path bypasses the pgvector >2000-dimension HNSW limit. SetENABLE_EMBEDDING_COMPRESSION=falseto opt out and keep fp32 storage. See theEmbedding Compression Guide
- Multiple Database Backends: Choose between SQLite (default, zero-config) or PostgreSQL (high-concurrency, production-grade)
- High Performance: WAL mode (SQLite) / MVCC (PostgreSQL), strategic indexing, and async operations
- MCP Standard Compliance: Works with Claude Code, LangGraph, and any MCP-compatible client
- Production Ready: Comprehensive test coverage, type safety, and robust error handling
The fastest way to connect the MCP Context Server to Claude Code is the one-command Docker bootstrap.
For step-by-step instructions, prerequisites, troubleshooting, and update/uninstall commands, see theConnecting to Your AI Assistant Guide.
The server is fully configured via environment variables, supporting core settings, transport, authentication, embedding providers, summary generation, search features, database tuning, and more. Variables can be set in your MCP client configuration, in a.envfile, or directly in the shell.
For the complete reference of all environment variables with types, defaults, constraints, and descriptions, see theEnvironment Variables Reference.
Summary generation automatically creates concise LLM-based summaries for each stored context entry. Summaries are returned in thesummaryfield of all search tool results alongside truncatedtext_content, providing dense, informative summaries that help agents determine relevance without fetching full entries.
For detailed instructions including all providers (Ollama, OpenAI, Anthropic), model selection, and custom prompt configuration, see theSummary Generation Guide.
Semantic search is auto-enabled by default (ENABLE_SEMANTIC_SEARCH=auto): thesemantic_search_contexttool registers automatically whenever an embedding provider is available (embedding generation is on by default), and skips quietly otherwise. For detailed instructions on the multiple embedding providers (Ollama, OpenAI, Azure, HuggingFace, Voyage) and how to control the toggle explicitly, see theSemantic Search Guide.
Full-text search is auto-enabled by default (ENABLE_FTS=auto) and needs no extra dependencies, using the built-in database FTS engine (FTS5 on SQLite, tsvector on PostgreSQL). For linguistic processing, stemming, ranking, and boolean queries, see theFull-Text Search Guide.
Hybrid search is auto-enabled by default (ENABLE_HYBRID_SEARCH=auto): thehybrid_search_contexttool registers automatically whenever at least one of full-text or semantic search is available. For combined FTS + semantic search using Reciprocal Rank Fusion (RRF), see theHybrid Search Guide.
For comprehensive metadata filtering including 16 operators, nested JSON paths, and performance optimization, see theMetadata Guide.
The server supports multiple database backends, selectable via theSTORAGE_BACKENDenvironment variable. SQLite (default) provides zero-configuration local storage perfect for single-user deployments. PostgreSQL offers high-performance capabilities with 10x+ write throughput for multi-user and high-traffic deployments.
For detailed configuration instructions including PostgreSQL setup with Docker, Supabase integration, connection methods, and troubleshooting, see the[Database Backends Guide.
The MCP Context Server exposes 16 MCP tools for context management:
Core Operations:store_context,search_context,get_context_by_ids,delete_context,update_context,list_threads,get_statistics
Search Tools:semantic_search_context,fts_search_context,hybrid_search_context
…
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





