# mcp-context-server

Saves text and image context across agent runs in SQLite or PostgreSQL. Lets multiple assistants share state across threads with fine-grained access rules.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 9
- Author: alex-feel
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/alex-feel/mcp-context-server
- Updated: 2026-10-24
- HTML: https://affpapa.org/en/nevibecode/mcp/mcp-context-server

## What it 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.

## Requirements
- Needs: Python and uv (commands run via uvx)
- Environment variables: `LOG_LEVEL`, `STORAGE_BACKEND`, `MAX_IMAGE_SIZE_MB`, `MAX_TOTAL_SIZE_MB`, `DB_PATH`, `POOL_MAX_READERS`, `POOL_MAX_WRITERS`, `POOL_CONNECTION_TIMEOUT_S`, `POOL_IDLE_TIMEOUT_S`, `POOL_HEALTH_CHECK_INTERVAL_S` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
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 <…> 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>

### Codex

**Platform CLI**
```bash
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-server
```
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>

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "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>

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "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>

### Gemini CLI

**Platform CLI**
```bash
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-server
```
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>

## When to use it
- 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
- Store this error screenshot and stack trace under thread `deploy-bug`
- Use `grep_context` to locate references to database pool limits in stored records
- Inspect the entry outline with `navigate_context` and pull lines 1 to 40 using `read_context_range`

## Similar
- [REA](https://affpapa.org/en/nevibecode/mcp/rea.md) — MCP server · ★ 392262
- [GitHub](https://affpapa.org/en/nevibecode/mcp/github.md) — MCP server · ★ 33989
- [Netdata](https://affpapa.org/en/nevibecode/mcp/netdata.md) — MCP server · ★ 81163
- [browser-use](https://affpapa.org/en/nevibecode/mcp/browser-use.md) — MCP server · ★ 119231
- [Codebase Memory](https://affpapa.org/en/nevibecode/mcp/codebase-memory.md) — MCP server · ★ 47577
- [mcp-server](https://affpapa.org/en/nevibecode/mcp/mcp-server.md) — MCP server · ★ 43902

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
