
Amnesic
io.github.SurajKGoyal由 GitHub 帳號 SurajKGoyal 發布v0.2.2更新於 Oct 24, 2026
Persistent semantic memory for SQL databases. Postgres, MySQL, MSSQL, SQLite.
概覽
一個本機 MCP 伺服器,為助理提供關於 SQL 資料庫結構與欄位意義的可持續保存、可搜尋筆記,並支援唯讀查詢。
- 可以做什麼
- 列出已設定的連線與資料表,並依關鍵字搜尋已儲存的資料表與欄位描述,回傳排序結果與片段,且結果不會揭露憑證。讀取合併已儲存註解的資料表結構,並對資料庫執行唯讀 SELECT 查詢。儲存、停用或刪除註解(例如列舉值意義),並與實際結構比對以找出落差。探索外鍵關聯並瀏覽關聯圖,用於規劃 JOIN。在連線之間複製註解,例如從預備環境複製到正式環境。
- 適用情境
- 適用於助理每次工作階段都得重新認識同一個資料庫結構的情況,或舊資料庫中狀態碼意義不明、欄位缺少說明、外鍵限制缺失的情況。它是查詢執行或效能調校伺服器的補充,而非替代。
- 執行需求
- 本機 Python 環境(pipx、uv 或 pip),並安裝目標資料庫對應的驅動附加套件(PostgreSQL、MySQL/MariaDB、MSSQL;SQLite 不需額外驅動)。需要由安裝精靈產生的 connections.toml 設定檔,以及存放以環境變數引用之密碼的 .env 檔案。也可使用示範 SQLite 資料庫免憑證試用。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Amnesic,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
amnesic — the MCP server with the most ironic name in the registry
[PyPI version] [Python] [License: MIT] [MCP Registry] [Glama score]
Your database's institutional memory, as an MCP server. The name is ironic — it remembers everything.
"The MCP server with the most ironic name in the registry. It's anything but amnesic — it remembers your database so your AI doesn't have to."
Most database MCP servers are query executors: they connect, introspect, run SQL, and forget. amnesic is a semantic memory — it accumulates what your schema means (what status = 3 is, which columns are really foreign keys, what that legacy table is for) and hands it to every future session automatically. Think data catalog, minus the platform, the ingestion pipeline, and the invoice. Where amnesic fits ↓
Works with Claude Code · Claude Desktop · Cursor · VS Code · Cline · Windsurf — any MCP-compatible client.
Available on Official MCP Registry · Claude Code plugin marketplace
👋 Using amnesic? Say hi in the adopters thread — download counts can't tell me what's actually being used, and it directly shapes what gets built next.
🔒 Read-only by design. amnesic refuses to execute
INSERT,UPDATE,DELETE,DROP,TRUNCATE,ALTER,CREATE,EXEC,MERGE,GRANT,REVOKE— and any write statement smuggled inside aWITHCTE. Two layers of defense: static SQL analysis rejects the statement before connecting, and every query runs inside a transaction that is immediately rolled back. Safe to point at prod. Details ↓
The problem
Every session with an AI starts cold. You spend the first few minutes re-explaining what tables exist, what a status column value of 3 means, which FK connects orders to users. Then the session ends, and you do it all over again tomorrow.
amnesic fixes this. It gives your AI a persistent SQLite knowledge store — one per database — that survives across sessions. Annotate a status enum once; every future session sees those labels automatically. Discover FK relationships once; every future JOIN query uses that graph.
The knowledge is also portable and outlives your access to the database. When you rotate off a project, amnesic export hands the next developer everything you taught it — years of "oh, that column actually means…" that would otherwise leave with you.
Where amnesic fits
The database MCP ecosystem splits into two camps, and amnesic is deliberately in neither.
Query executors — DBHub, Postgres MCP Pro, Google's MCP Toolbox, and the vendor servers (Supabase, Neon). They introspect live, run SQL, and some go deep on performance — Postgres MCP Pro does genuine index tuning and PgHero-style health checks. They are excellent at this. They are also stateless: every session re-learns your schema from scratch, and nothing they return can tell you what a column means, because the database doesn't know either.
Enterprise catalogs — DataHub, Atlan, Cube, AtScale. These do hold semantic context: glossaries, column descriptions, ownership, lineage. They're also a platform commitment — metadata ingestion, a service to run, usually a paid tier. Worth it at company scale; wildly disproportionate for one developer who needs to remember what six status codes mean in a legacy MSSQL database nobody will ever onboard to a catalog.
amnesic is the third thing: catalog-grade semantic memory at query-executor setup cost. pipx install, one TOML file, a local SQLite file per database. No platform, no ingestion, no server to run.
Honest comparison
Use a query executor instead of amnesic if you want execution plans, index recommendations, or database health diagnostics — that's not amnesic's job and adding it would make it a worse version of a tool that already exists.
Use amnesic alongside one. They compose: nothing stops you running both. amnesic holds the meaning; they hold the machinery.
The rows marked ⚠️ above are known gaps with open issues — see Roadmap ↓.
Quickstart (90 seconds)
⚡ Try it without credentials. Run
amnesic init --demoinstead — it adds a self-contained SQLite sample DB (e-commerce schema: customers / products / orders with FKs and an enum column) so you can exercise every tool in under a minute. Great for a first look before pointing amnesic at a real database.
The wizard asks which database type you're connecting to and tells you the one command to run if its driver isn't installed yet — you never need to guess extras up front.
The wizard:
- Asks for your database type, host, and credentials
- Tests the connection before saving anything
- Stores the password securely in
~/.config/amnesic/.env(chmod 600) - Writes the connection block to
~/.config/amnesic/connections.toml
Then add amnesic to your AI client and restart.
Don't have pipx? Or prefer uv / plain pip?
Install pipx (one-time):
Or use uv (single-binary alternative — fast, no Python required):
Or plain pip (installs into your active Python env):
Whichever you pick,
amnesic initasks which database you'll connect to and prints the one extra command to install that driver — no need to commit to extras up front.
After install, amnesic --help works from any terminal.
Where amnesic stores things
Set $AMNESIC_HOME (or $XDG_CONFIG_HOME on Linux) to override the location.
Adding more connections later
Setting and rotating passwords
amnesic init and amnesic add save your password automatically — for the typical setup flow, you never need to think about this section.
Use set-secret when you need to change a stored password later — IT rotated it, you mistyped it during setup, or you're hand-editing the config.
What's the variable name? It's the env var your connections.toml references for that connection's password. The wizard auto-generates these as <CONNECTION_NAME_UPPERCASE_WITH_UNDERSCORES>_PASSWORD:
To see the exact name your config uses, check ~/.config/amnesic/connections.toml — anything inside ${...} is the variable to pass to set-secret.
Under the hood: writes (or replaces) the line in ~/.config/amnesic/.env, sets file permission to chmod 600 (only your user can read it), preserves all other entries.
Managing connections and knowledge
Knowledge accumulates per connection in a local SQLite file. These commands let you move it between machines and clean up:
export/import/clear/remove operate purely on local files — they never connect to the database, so they work even if a connection's credentials aren't set. remove edits connections.toml with surgical string edits, leaving every other block's formatting and comments byte-for-byte intact.
Add to your AI client
Once amnesic is installed with the right driver extras (see Quickstart), the amnesic command is on your PATH. Use the same snippet across every MCP client:
Claude Code
One-line install (recommended — no JSON editing). Inside Claude Code:
That wires amnesic as an MCP server automatically. Source: SurajKGoyal/amnesic-marketplace.
Or wire it by hand — edit ~/.claude/mcp.json
Claude Desktop
Add to your platform's Claude Desktop config:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
Cursor
One-click install — click the button below and Cursor wires it up for you:
Or wire it by hand — edit .cursor/mcp.json
Add to .cursor/mcp.json in your project (or ~/.cursor/mcp.json globally):
Without a global install (ephemeral)
If you'd rather not install amnesic on your system, use uvx or pipx to fetch it each time the MCP client starts. Note the driver extras must be passed explicitly:
For multiple drivers, comma-separate inside the brackets — e.g. amnesic[postgres,mssql] or use amnesic[all] for everything.
VS Code (with MCP extension)
Add to .vscode/mcp.json:
Updating
amnesic ships often. Upgrade with the same tool you installed it with:
Then restart your MCP client (Claude Code, Cursor, …) so it relaunches the amnesic server and picks up any new tools.
Upgrading is safe — you won't lose annotations. Your knowledge files auto-migrate to the new schema on first load; amnesic only ever adds columns, never drops your data.
To check the installed version: amnesic --version. Latest release: PyPI · Releases.
Tools
Searching the knowledge base
For large schemas, db_list_tables is impractical — you'd dump 500+ rows into Claude's context. Use db_search to find the relevant tables/columns by keyword instead:
db_search uses SQLite FTS5 with BM25 ranking — fast, local, no embeddings or external services. Search syntax supports:
Results return ranked table/column rows with descriptions and highlighted snippets.
The knowledge layer
The core differentiator. Every annotation survives restarts, model updates, and new sessions.
Session 1 — you discover something
Session 2 — the knowledge is already there
No re-discovery. No wasted turns. The annotation persisted.
Relationship graph
Understand your schema's JOIN structure once, reuse it forever.
Now the AI knows exactly how to JOIN across your schema without guessing.
Sync between environments
Build up annotations in staging, then promote to prod:
Returns {synced: [...], skipped: [{table, reason}], warnings: [{table, column, reason}]}.
Tables missing from the target schema cache are skipped with a clear reason. Columns missing from target schema are warned but don't block the rest of the sync.
Advanced: hand-edit the TOML
If you prefer to manage the config file yourself, generate a blank template:
This writes ~/.config/amnesic/connections.toml with commented examples and exits — no wizard. Edit the file directly:
Use ${ENV_VAR} for credentials — never hardcode passwords.
Secrets are loaded from ~/.config/amnesic/.env automatically (format: KEY=VALUE, one per line, # for comments). For each ${VAR_NAME} referenced in your TOML, populate the matching .env entry with amnesic set-secret VAR_NAME (hidden input, chmod 600), or write .env yourself.
Canonical connection names use dot notation: orders.prod, orders.staging, analytics, local.
Supported databases
Safety & read-only enforcement
amnesic is built to be safe to point at production databases.
Why your AI can't damage your data
Every query passes through two independent layers before reaching the database:
- Static analysis (in
amnesic/readonly.py) — the SQL is tokenized and rejected if it contains any of:INSERT,UPDATE,DELETE,DROP,TRUNCATE,ALTER,CREATE,EXEC,EXECUTE,MERGE,BULK,GRANT,REVOKE,DENY. This includes write statements smuggled inside CTEs (WITH x AS (SELECT ...) UPDATE ...is caught and refused). - Transaction rollback — even if a write statement somehow gets past the static check, the query runs inside
BEGIN TRANSACTION ... ROLLBACKso nothing is ever committed. Belt and suspenders.
Only SELECT and WITH ... SELECT reach the database. Comments are stripped before analysis so /* DELETE FROM users */ can't be used to hide an attack.
Other safety measures
- No credentials in responses:
db_list_connectionsstrips passwords and usernames from its output. The AI can see which connections exist, never how to authenticate to them. - Credentials via env vars only:
${ENV_VAR}expansion at config-load time — passwords never touchconnections.tomlon disk. - Secure
.envstorage: on macOS/Linuxchmod 0o600(owner read/write only); on Windows the.envlives in%APPDATA%which is restricted to your user profile by Windows ACL. - Identifier validation: table/schema/database names are checked against
[A-Za-z0-9_]+before any string interpolation into SQL. - Tested: 40+ unit tests in
tests/test_readonly.pycover every write keyword, comment-stripping edge case, CTE-with-write attempts, semicolon-separated multi-statements, and identifier injection attempts.pytest tests/test_readonly.pyto verify on your machine.
Is this safe with my data?
amnesic is local-only and protocol-only. It doesn't introduce a new external trust boundary — the trust boundary is wherever your MCP client sends data, not amnesic itself. Choosing the AI client decides the policy that applies to your rows.
The honest question to ask, whether you're indie or enterprise:
Do I trust my AI client with the data in this database?
If yes — and for most setups, the answer is yes — you're good. That covers:
- Solo devs on Claude Pro / Cursor / Copilot using their own projects, dev DBs, or test data
- Side projects querying personal SQLite or self-hosted Postgres
- Open-source maintainers working with public schemas
- Teams on enterprise AI with explicit isolation: AWS Bedrock (tenant + IAM), Azure OpenAI (region-pinned, your subscription), Anthropic Enterprise (zero data retention, training opt-out), Vertex AI (your GCP project), self-hosted (Ollama, vLLM, on-prem Claude/GPT — data never leaves the network)
- Anyone on a paid AI plan with zero-retention guarantees and a DPA covering your use
Worth a closer look if
- Your DB holds data belonging to other people (users, customers, patients) and you haven't verified your AI provider's terms cover that processing
- You're on consumer-tier AI (free / personal Pro) AND working with regulated data — PHI (HIPAA covered entity), cardholder data (PCI-DSS), restricted PII under GDPR / India's DPDP Act
- Your employer has an explicit policy restricting external AI tool use on prod DBs
- You're under data-residency rules where rows can't leave a specific region
Data minimization is built in
A property of the design, not an afterthought: the annotation layer means the AI answers most schema questions from a local SQLite knowledge file — no db_query runs, no row data is sent anywhere.
- "What does status=3 mean?" → resolves from your saved annotation
- "How do orders join users?" → resolves from the FK graph
- "Which tables have a
created_atcolumn?" → resolves from schema cache
For purely structural exploration, six tools never touch your data: db_list_tables, db_get_schema, db_search, db_annotate, db_discover_relationships, db_get_relationships. They return metadata only.
That's measurably less data movement than a "naked" SQL MCP — which has to run SELECT DISTINCT status FROM orders every time the AI is confused about an enum. amnesic answers it once from local annotations.
Disclaimer: amnesic is provided as-is under the MIT License (no warranty, no liability — see LICENSE). This section is not legal or compliance advice. Your use of amnesic, and the AI client you connect it to, is your responsibility. If you handle regulated data, consult your security / compliance team before pointing it at production.
Roadmap
Shipped so far: the knowledge layer (v0.1), BM25 search (v0.1.5), lifecycle management — deprecate / drift detection / forget (v0.2), and portable knowledge export/import (v0.2.2).
Next up (v0.3 — "Earn the memory"): knowledge that accumulates without anyone typing it — enum auto-discovery, soft-FK inference for legacy schemas with no constraints, and JOIN-pattern learning. Plus the table-stakes work: a token budget on every response, indexes and primary keys in the schema fetch, cache staleness flags, and a smaller tool surface.
See ROADMAP.md for the full picture and the reasoning behind the ordering.
🙌 Contributions wanted
Every v0.3 item is filed as a GitHub issue with the design already thought through — the problem, the proposed shape, the files to touch, and how to test it. Several are tagged good first issue.
Pick one and open a PR — no need to ask first. Just comment on the issue so two people don't build the same thing.
- 👉 Browse open issues · help wanted · good first issue
- New driver? Follow the structure in
amnesic/drivers.pyandamnesic/tools/schema.py. - Tests live in
tests/. New tools need unit tests; runpytest tests/before opening the PR.
Have an idea that isn't listed? Open an issue. A use case beats a patch — it saves you rework.
Track usage
pypistats.org/packages/amnesic
License
MIT — see LICENSE.
MCP Registry
This server is registered on the official MCP Registry.
來源:README.md,提交 20b8326
工具
0版本歷史
1- v0.2.2最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
