Skip to main content

MCP server for Recollect

Project description

recollect-mcp

MCP server for persistent memory. 6 tools, 3 resources, server-managed sessions. See the project README for architecture details.

Install

pip install recollect-mcp    # or: uv add recollect-mcp

Usage

# stdio (default)
recollect-mcp

# streamable-http
recollect-mcp --transport streamable-http

# with logging
recollect-mcp --log-file logs/mcp.jsonl --verbose

Tools

Tool Parameters Description
remember content: str Store an experience. LLM extracts entities, concepts, significance, and persona facts.
recall query: str Retrieve relevant memories. Returns persona facts as context followed by matching traces.
reflect -- Load persona context for the current session. Call before responding to any user message.
pin content: str Promote a statement to a permanent persona fact.
unpin fact_id: str Remove a persona fact.
forget trace_id: str Delete a memory trace.

Resources

URI Description
memory://primer Relational graph of persona facts. Read at conversation start for user context.
memory://facts All active persona facts with confidence scores and timestamps.
memory://health Server and database health status.

Clients that support MCP resources get session priming automatically via primer. For clients that don't, reflect loads the same context as a tool call. If neither is invoked, the server injects the primer on the first tool call of the session.

Client configuration

Add to .mcp.json (Claude Code) or claude_desktop_config.json (Claude Desktop):

{
  "mcpServers": {
    "memory": {
      "command": "uvx",
      "args": ["recollect-mcp"],
      "env": {
        "MEMORY_USER_ID": "your-user-id",
        "DATABASE_URL": "postgresql://user@localhost:5432/dbname",
        "PYDANTIC_AI_MODEL": "anthropic:claude-haiku-4-5-20251001",
        "ANTHROPIC_API_KEY": "sk-ant-..."
      }
    }
  }
}

Environment Variables

Variable Required Default Description
MEMORY_USER_ID Yes -- Scopes all operations to this user. Server refuses to start without it.
DATABASE_URL Yes postgresql://localhost:5432/memory_sdk PostgreSQL connection string.
PYDANTIC_AI_MODEL No -- pydantic-ai model string in provider:model format (e.g., ollama:ministral-3, anthropic:claude-haiku-4-5-20251001).
ANTHROPIC_API_KEY For Anthropic models -- Anthropic API key. Read by pydantic-ai's Anthropic backend.
OPENAI_API_KEY For OpenAI models -- OpenAI API key. Read by pydantic-ai's OpenAI backend.
OLLAMA_BASE_URL No http://localhost:11434/v1 Ollama API endpoint.
MEMORY_EXTRACTION_MAX_TOKENS No 8192 Max tokens for LLM extraction. Reasoning models consume thinking tokens before output; 8192 covers most cases.
MEMORY_CONFIG No -- Path to custom TOML config file.
HF_HUB_OFFLINE No -- Set to 1 to skip HuggingFace HTTP checks on startup. Use after the embedding model has been cached locally.
SERVER_HOST No localhost Server bind host (streamable-http transport).
SERVER_PORT No 8000 Server bind port (streamable-http transport).
MEMORY_RECALL_TOKENS_ENABLED No true Enable recall token disambiguation.
MEMORY_RECALL_TOKENS_TOP_K No 5 Max related traces for token assessment.
MEMORY_RECALL_TOKENS_THRESHOLD No 0.42 Min cosine similarity for related trace lookup at write time.
MEMORY_RECALL_TOKENS_STRENGTH_THRESHOLD No 0.1 Min token strength to activate.
MEMORY_RECALL_TOKENS_SCORE_BONUS No 0.1 Gated additive bonus per token.
MEMORY_RECALL_TOKENS_REINFORCE_BOOST No 0.1 Strength increment on activation.
MEMORY_RECALL_TOKENS_DECAY_FACTOR No 0.9 Inactive token decay per consolidation.

Provider

PYDANTIC_AI_MODEL prefix Required credential
anthropic:... ANTHROPIC_API_KEY
openai:... OPENAI_API_KEY
ollama:... OLLAMA_BASE_URL (defaults to http://localhost:11434/v1)

Reasoning models (Qwen3, DeepSeek-R1) consume thinking tokens from the extraction budget. If remember returns extraction errors, increase MEMORY_EXTRACTION_MAX_TOKENS or set MEMORY_CONFIG to a custom TOML file with [extraction] max_tokens = 8192.

Requirements

  • Python 3.12+
  • PostgreSQL 17 with pgvector

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

recollect_mcp-0.6.0.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

recollect_mcp-0.6.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file recollect_mcp-0.6.0.tar.gz.

File metadata

  • Download URL: recollect_mcp-0.6.0.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for recollect_mcp-0.6.0.tar.gz
Algorithm Hash digest
SHA256 66eabe59aff5135ea2ccf8e3f62e75d80863a070fea1e7797b7908c817c7d067
MD5 5c7c39a21fe6e5101642f86daac2b10b
BLAKE2b-256 5d7fc5cfc9e56b445e5440ab97a354bd00fb67507db3299a27e9aed4287e7d76

See more details on using hashes here.

File details

Details for the file recollect_mcp-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: recollect_mcp-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for recollect_mcp-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d870d7e5c5da78121af3dd79bc1661c43887e058497df24cca0195776272392e
MD5 293e449a7416c61faf56b986fadc4c9a
BLAKE2b-256 2b85656871bf68cbf67ac99feea9ca096a0ebf913bdc9b2b2db68810e9fa8f36

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page