Polymnemo

Shared cross-LLM long-term memory over MCP: semantic recall, sessions, and media (pgvector).

LLM Mart 0 views 3 listing impressions
Transport
Not stated
Package
—
Registry id
io.github.PCBZ/polymnemo

No install snippet on purpose. A working MCP config is a command, its arguments and an environment block — the last two are where API keys live, so this catalogue never stores them and cannot publish them. Follow the link above for the authors' own instructions.

A shared long-term memory across any LLM, over MCP.

Point Claude Desktop, an MCP-capable IDE, or any MCP client at one polymnemo endpoint and they share the same memories — stored in your own Postgres. Store a fact with one assistant, recall it from another; save whole sessions and reload them; even attach files, images, or video. Embeddings run locally (no embedding API key), and the server makes no generative-LLM calls.

Status: active development. Semantic memory + pgvector store, session save/reload, and multimedia memories all work; deployable to Azure Container Apps (or Cloud Run) via Terraform. Wiki · Issues

Features

  • 🔗 Cross-LLM shared — point any MCP client at one endpoint; they share the same memory.
  • 🧠 Semantic recall — vector search over Postgres + pgvector, not keyword matching.
  • 💬 Sessions — save a full transcript and reload it verbatim, or recall across it.
  • 🖼️ Multimedia — attach files, images, or video; bytes go to object storage, only a searchable description is embedded.
  • 🔒 Local & private — embeddings run locally (ONNX): no embedding API key, and no generative-LLM calls, ever.
  • 👥 Namespaces — "born-shared" collections readable by everyone, vs. private-to-owner; writes are always owner-scoped.
  • 🧩 Pluggable layers — store, embedder, auth, retriever, blob store, and rate limiter are all swappable Protocols.
  • ☁️ Multi-cloud deploy — one Terraform stack to Azure Container Apps or Cloud Run, scale-to-zero.
  • 🚦 Rate limiting — optional global token bucket.

How it works

flowchart LR
    Clients["MCP clients<br/>(Claude Desktop, IDEs, …)"] -->|"/mcp · Bearer key"| P["polymnemo<br/>(MCP server)"]
    P --> DB[("Postgres + pgvector<br/>text + pointers")]
    P -. "large files<br/>(presigned URLs)" .-> OS[("Object storage<br/>S3 / R2")]

A request carries a bearer key (which resolves to a user_id); the tool passes the rate-limit gate, then delegates to a MemoryService that chunks + embeds text and stores the vectors in pgvector — large files go to object storage via presigned URLs, with only a searchable description embedded.

Every layer is a typing.Protocol, wired together by a composition root (context.py), so you can swap an implementation without touching the tools:

Layer Default Swap for
Store PostgresStore (pgvector) InMemoryStore (dev/tests)
Embedder fastembed (local ONNX) StubEmbedder (offline)
Auth GitHub OAuth + API tokens static bearer keys (dev)
Retriever VectorRetriever your own ranker
BlobStore S3 / R2 off
RateLimiter global token bucket off

The ping tool returns the active layers, so you can see how a running server is wired.

Quickstart

Requires Python 3.11+.

1. Install

python -m venv .venv
source .venv/bin/activate            # Windows: .venv\Scripts\activate
pip install -e .                     # add ".[dev]" for the test + lint tooling

2. Provision Postgres (pgvector)

The durable store is Postgres + pgvector; the easiest hosted option is Neon (use the pooled connection string). Apply the schema once:

psql "<your-connection-string>" -f scripts/schema.sql

3. Configure

Copy .env.example to .env and set the database URL and at least one API key:

POLYMNEMO_DATABASE_URL=postgresql://user:pass@host/db?sslmode=require
POLYMNEMO_API_KEYS=sk-alice-secret:alice,sk-bob-secret:bob   # "key:user_id" pairs

Each key maps a bearer token to a user_id; writes are scoped to that user.

4. Run

polymnemo                            # Streamable HTTP at http://127.0.0.1:8000/mcp

Or with Docker:

From the project's README.