polymnemo

io.github.PCBZ由 GitHub 帳號 PCBZ 發布v1.5.0更新於 Oct 30, 2026

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

已驗證Streamable HTTP可網頁執行檔案與儲存知識與記憶

概覽

AI 產生的概覽

以 MCP 提供的共享長期記憶:助理可儲存事實、工作階段與媒體,並在任何 LLM 用戶端之間依語意回想。

可以做什麼
  • 儲存、回想、列出、讀取、更新與刪除記憶,支援語意、精確關鍵字或融合排序模式
  • 儲存完整工作階段逐字稿並原樣重新載入,或跨工作階段回想
  • 透過上傳與下載連結附加檔案、圖片或影片,僅嵌入可搜尋的描述
  • 檢查服務健康狀態與元件組態,並將某個命名空間以資源形式暴露以供自動注入
適用情境
適合想讓多個助理或 IDE 共用同一份持久記憶(事實、過往工作階段、附件),並能依語意而非精確字詞找回內容的情境。
執行需求
遠端 streamable HTTP 端點;需要 OAuth 登入或向維護者申請依使用者分配的 API 金鑰,並以 Authorization bearer 標頭傳送。若自行部署,則需 Python 3.11+、含 pgvector 的 Postgres 資料庫,並在伺服器端設定 API 金鑰。
安裝前請注意
bearer 金鑰是依使用者的憑證,可存取該使用者的記憶,請勿放入共用設定。共用命名空間中的記憶對所有使用者可讀,寫入僅限本人。上傳檔案的內容不會被掃描,會直接存入物件儲存,請勿存放機密。除非維運方開啟,否則金鑰掃描預設關閉。專案仍在積極開發中。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 polymnemo,將其新增到工作區。
  2. 連接 所需的 憑證。它們會被私密儲存,絕不會在公開頁面上展示。
  3. 為需要使用其工具的對話啟用該服務。

Web executable,透過 Streamable HTTP。 遠端服務在工作區中設定後即可從網頁執行環境執行。

交給代理程式安裝

把這段提示詞貼上到 Claude Code、Codex、Cursor 等代理程式,或 SourceWeft 對話中。代理程式會讀取該伺服器的安裝指南,先向你展示發布者、端點和登入方式,經你同意後再把它新增到你的客戶端。金鑰不會寫進任何命令。

閱讀 https://sourceweft.com/mcp/io.github.PCBZ%2Fpolymnemo/install.md,並按其中說明把這個 MCP 伺服器接入我的客戶端。修改任何設定之前,先告訴我它的發布者、端點和登入方式,等我確認。不要把 API 金鑰寫進命令或我會提交的檔案;問我金鑰應從哪裡取得。

檢視代理程式所依據的安裝指南

其他 MCP 客戶端

把它新增到你客戶端的 mcpServers 設定中。 客戶端會在首次連接時完成 OAuth 登入。

{
  "mcpServers": {
    "polymnemo": {
      "type": "http",
      "url": "https://polymnemo.purpleground-26f6d744.westus2.azurecontainerapps.io/mcp"
    }
  }
}

README

polymnemo

[CI] [codecov] [License: MIT]

[Python] [MCP] [Postgres] [Neon] [SQLAlchemy] [Pydantic] [Cloudflare R2] [Azure] [Cloud Run] [Terraform] [Docker] [pytest] [Ruff]

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 by default, with exact-text and fused (RRF) modes when you need to find an ID or a name.
  • 💬 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

mermaid
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:

LayerDefaultSwap for
StorePostgresStore (pgvector)InMemoryStore (dev/tests)
Embedderfastembed (local ONNX)StubEmbedder (offline)
AuthGitHub OAuth + API tokensstatic bearer keys (dev)
RetrieverVectorRetrieveryour own ranker
BlobStoreS3 / R2off
RateLimiterglobal token bucketoff

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

Quickstart

Requires Python 3.11+.

1. Install

bash
python -m venv .venvsource .venv/bin/activate            # Windows: .venv\Scripts\activatepip 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:

bash
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:

bash
POLYMNEMO_DATABASE_URL=postgresql://user:pass@host/db?sslmode=requirePOLYMNEMO_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

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

Or with Docker:

bash
docker build -t polymnemo .docker run -e POLYMNEMO_DATABASE_URL="..." -e POLYMNEMO_API_KEYS="sk-alice-secret:alice" \           -e PORT=8080 -p 8080:8080 polymnemo

5. Connect an MCP client

Any client that supports remote (HTTP) MCP servers with custom headers needs two things:

  • Endpoint: http://<host>:<port>/mcp
  • Header: Authorization: Bearer <your-key>

For clients that read an mcpServers config:

jsonc
{  "mcpServers": {    "polymnemo": {      "url": "http://127.0.0.1:8000/mcp",      "headers": { "Authorization": "Bearer sk-alice-secret" }    }  }}

Or verify with the inspector:

bash
npx @modelcontextprotocol/inspector# Transport: Streamable HTTP · URL: http://127.0.0.1:8000/mcp# Header:    Authorization: Bearer sk-alice-secret  → call ping / remember / recall

Concepts

  • Users & keys — sign in with GitHub, or present a bearer token. Either way the request resolves to a user_id, and writes are owner-scoped (you can only edit or delete your own memories).
  • Headless clients — CI, cron jobs and server-side agents can't complete a browser sign-in, so they use an API token instead. Sign in with GitHub at <server>/tokens to create, list and revoke them; a new token is shown once and stored only as a SHA-256 hash. Deliberately not MCP tools — a secret must never travel an LLM channel.
  • Namespaces — memories live in namespaces. A shared namespace (default shared) is readable by everyone ("born shared"); everything else is private to its owner. Sessions and media default to private namespaces.
  • Chunking — long content is split into chunks on write (one vector each), so remember may return several ids and recall returns the closest chunks.
  • Secret scanning — optional, and off unless you turn it on: set POLYMNEMO_RSP_CONFIG to a scanner config (the image ships one at /app/plugins/rsp.toml). Unset, every write goes through a no-op guard and nothing is scanned. When on, the text of a memory is scanned before it is embedded or stored, so a refused write was never written rather than deleted afterwards. It covers remember, save_session, update and a media memory's description. The contents of uploaded files are not scanned and are stored as you sent them: the bytes go straight to object storage under a presigned URL and never pass through this server. A file's description is scanned; the file is not.

Tools

polymnemo exposes MCP tools for storing, searching, and managing memories:

  • Memory — remember, recall, list_memories, get_memory, update, forget

recall takes a mode:

modefindsgood fornot for
similarity (default)by meaning, across languages"what do I know about coffee?"exact IDs, names, error strings
keywordrows containing every word, case-insensitivelyorder 88312, a project codename, an error messagesynonyms; may return fewer than limit or nothing
rrfboth, fused by rankwhen you are unsure which kind of query it is—

keyword is an exact substring match. rrf fuses the top 50 candidates from each leg, so paging through it reaches at most about 100 results. score is only comparable within one mode, and total is the size of the namespace searched, not the number of matches.

  • Sessions — save_session, load_session
  • Media — create_upload, confirm_upload, get_download_url

Plus a ping health check and a memory://{namespace} resource for auto-injecting a collection. Media bytes go to object storage via presigned URLs — never through the MCP channel — with only a searchable description embedded (needs the blob extra).

Full arguments and return shapes live in the dedicated MCP tools reference (coming soon). See Concepts for how keys, namespaces, and chunking work.

Configuration

POLYMNEMO_* environment variables (or .env) — full list in .env.example. The essentials:

VariableDefaultPurpose
POLYMNEMO_DATABASE_URL(unset)Postgres+pgvector DSN. Required in production; unset → in-memory (dev/tests).
POLYMNEMO_API_KEYS(empty)"key1:alice,key2:bob" — required for bearer auth.
POLYMNEMO_SHARED_NAMESPACESsharedNamespaces readable by every user.
POLYMNEMO_HOST / POLYMNEMO_PORT / POLYMNEMO_MCP_PATH127.0.0.1 / 8000 / /mcpTransport.
POLYMNEMO_RATELIMIT_ENABLED / _PER_MINfalse / 600Optional global rate limit (ops per minute).
POLYMNEMO_BLOB_BACKEND (+ _BUCKET / _ENDPOINT_URL / _ACCESS_KEY_ID / _SECRET_ACCESS_KEY)noneObject storage for media memories; s3 = Cloudflare R2 / S3-compatible.
POLYMNEMO_RSP_CONFIG(unset)Path to a scanner config; unset means no scanning. The image ships one at /app/plugins/rsp.toml.

Development

bash
pip install -e ".[dev]"pytest                               # fast, offline (stub embedder, in-memory store)ruff check . && ruff format --check .   # lint + format (enforced in CI)

Postgres tests run when TEST_DATABASE_URL points at a pgvector Postgres. CI (.github/workflows/ci.yml) runs lint + the suite with coverage and posts a pass/fail/coverage table to each run's summary.

Deploy

polymnemo is stateless (all state in Neon + object storage), so it runs on Azure Container Apps (primary) or Google Cloud Run with scale-to-zero. Everything is Terraform in deploy/terraform/: shared neon/ (Postgres) and r2/ (media bucket) roots own the durable state, and a compute root deploys a service that reads both — so memories and media are shared across clouds.

The Azure path deploys from CI in one click: set the GitHub secrets (scripts/setup-github-secrets.sh), bootstrap the state backend (scripts/bootstrap-tfstate-azure.sh), then run the deploy (azure) workflow (neon → schema → r2 → build → app). GCP is a manual failover. Full walkthrough in docs/deploy.md.

License

MIT — see LICENSE.

來源:README.md,提交 ed6634f

工具

0
該伺服器需要登入,因此 SourceWeft 無法在沒有帳號的情況下讀取其工具,也未收錄。已連接帳號所能看到的內容可能因帳號及其權限而異。

版本歷史

7
  1. v1.5.0最新Oct 29, 2026
  2. v1.4.1Oct 24, 2026
  3. v1.4.0Oct 21, 2026
  4. v1.3.0Sep 21, 2026
  5. v1.2.7Sep 19, 2026
  6. v1.2.5Sep 17, 2026
  7. v1.0.0Sep 16, 2026

評分

已滿足適用檢查項的 85%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通必需25 分
  • 已宣告認證方式必需10 分
  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分