mcp-context-server — Claude Code MCP server: how to install
Saves text and image context across agent runs in SQLite or PostgreSQL. Lets multiple assistants share state across threads with fine-grained access rules.
claude mcp add --env LOG_LEVEL=<LOG_LEVEL> --env STORAGE_BACKEND=<STORAGE_BACKEND> --env MAX_IMAGE_SIZE_MB=<MAX_IMAGE_SIZE_MB> --env MAX_TOTAL_SIZE_MB=<MAX_TOTAL_SIZE_MB> --env DB_PATH=<DB_PATH> --transport stdio mcp-context-server -- uvx mcp-context-serverWhat mcp-context-server does
The server keeps multimodal entries keyed by UUIDv7 timestamps, operating on local SQLite by default or PostgreSQL for shared setups. Retrieval combines full-text indexing, vector similarity, and line-by-line matching with grep_context. Agents can map document outlines via navigate_context and retrieve targeted sections using read_context_range without pulling complete documents into memory.
Access controls govern entries down to specific owners, public views, and JWT grants, with optional PostgreSQL row-level security. Existing v2 databases require running mcp-context-server-migrate before running v3, as the storage schema does not load legacy tables automatically.
What it helps with
- persist multimodal notes across agent sessions
- search shared memory via hybrid vector and lexical ranking
- inspect sections of large documents without flooding the agent prompt
- isolate context entries between collaborators using token grants
Example prompts for the agent
- Store this error screenshot and stack trace under thread
deploy-bug - Use
grep_contextto locate references to database pool limits in stored records - Inspect the entry outline with
navigate_contextand pull lines 1 to 40 usingread_context_range
How to install mcp-context-server
Platform CLI
claude mcp add --env LOG_LEVEL=<LOG_LEVEL> --env STORAGE_BACKEND=<STORAGE_BACKEND> --env MAX_IMAGE_SIZE_MB=<MAX_IMAGE_SIZE_MB> --env MAX_TOTAL_SIZE_MB=<MAX_TOTAL_SIZE_MB> --env DB_PATH=<DB_PATH> --transport stdio mcp-context-server -- uvx mcp-context-serverReplace <…> with your own values. 128 more environment variables are in the server README. uvx runs the command named after the package; if the README names another one, use uvx --from mcp-context-server <command>
Platform CLI
codex mcp add mcp-context-server --env LOG_LEVEL=<LOG_LEVEL> --env STORAGE_BACKEND=<STORAGE_BACKEND> --env MAX_IMAGE_SIZE_MB=<MAX_IMAGE_SIZE_MB> --env MAX_TOTAL_SIZE_MB=<MAX_TOTAL_SIZE_MB> --env DB_PATH=<DB_PATH> -- uvx mcp-context-serverReplace <…> with your own values. 128 more environment variables are in the server README. uvx runs the command named after the package; if the README names another one, use uvx --from mcp-context-server <command>
Config file
{
"mcpServers": {
"mcp-context-server": {
"command": "uvx",
"args": [
"mcp-context-server"
],
"env": {
"LOG_LEVEL": "<LOG_LEVEL>",
"STORAGE_BACKEND": "<STORAGE_BACKEND>",
"MAX_IMAGE_SIZE_MB": "<MAX_IMAGE_SIZE_MB>",
"MAX_TOTAL_SIZE_MB": "<MAX_TOTAL_SIZE_MB>",
"DB_PATH": "<DB_PATH>"
}
}
}
}Replace <…> with your own values. 128 more environment variables are in the server README. uvx runs the command named after the package; if the README names another one, use uvx --from mcp-context-server <command>
Config file
{
"servers": {
"mcp-context-server": {
"type": "stdio",
"command": "uvx",
"args": [
"mcp-context-server"
],
"env": {
"LOG_LEVEL": "<LOG_LEVEL>",
"STORAGE_BACKEND": "<STORAGE_BACKEND>",
"MAX_IMAGE_SIZE_MB": "<MAX_IMAGE_SIZE_MB>",
"MAX_TOTAL_SIZE_MB": "<MAX_TOTAL_SIZE_MB>",
"DB_PATH": "<DB_PATH>"
}
}
}
}Replace <…> with your own values. 128 more environment variables are in the server README. uvx runs the command named after the package; if the README names another one, use uvx --from mcp-context-server <command>
Platform CLI
gemini mcp add -e LOG_LEVEL=<LOG_LEVEL> -e STORAGE_BACKEND=<STORAGE_BACKEND> -e MAX_IMAGE_SIZE_MB=<MAX_IMAGE_SIZE_MB> -e MAX_TOTAL_SIZE_MB=<MAX_TOTAL_SIZE_MB> -e DB_PATH=<DB_PATH> mcp-context-server uvx mcp-context-serverReplace <…> with your own values. 128 more environment variables are in the server README. uvx runs the command named after the package; if the README names another one, use uvx --from mcp-context-server <command>
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about mcp-context-server
How to install mcp-context-server in Claude Code?
Run `claude mcp add --env LOG_LEVEL=<LOG_LEVEL> --env STORAGE_BACKEND=<STORAGE_BACKEND> --env MAX_IMAGE_SIZE_MB=<MAX_IMAGE_SIZE_MB> --env MAX_TOTAL_SIZE_MB=<MAX_TOTAL_SIZE_MB> --env DB_PATH=<DB_PATH> --transport stdio mcp-context-server -- uvx mcp-context-server`. Replace each placeholder with your environment values.
What does mcp-context-server do?
It acts as an external memory backend for LLM clients, storing text and images while supporting hybrid search, outline navigation, and thread scoping.
How do you migrate data from version 2 to version 3?
Version 3 introduces UUIDv7 primary keys, requiring existing installations to run the bundled mcp-context-server-migrate CLI before launching the updated server.