
Amnesic
io.github.SurajKGoyalPublished by GitHub account SurajKGoyalv0.2.2Updated Oct 24, 2026
Persistent semantic memory for SQL databases. Postgres, MySQL, MSSQL, SQLite.
Overview
A local MCP server that gives an assistant persistent, searchable notes about a SQL database's schema and column meanings, plus read-only query access.
- What you can do
- List configured connections and tables, and search saved table and column descriptions by keyword with ranked matching and snippets, without exposing credentials in the results. Read a table's columns merged with saved annotations, and run read-only SELECT queries against the database. Save, deprecate or delete annotations such as enum value meanings, and audit them against the live schema for drift. Discover foreign-key relationships and navigate the join graph for query planning. Copy annotations between connections, for example from staging to production.
- When to use it
- Useful when an assistant repeatedly re-learns the same schema each session, or when a legacy database has cryptic status codes, undocumented columns or missing foreign-key constraints. It complements rather than replaces a query-execution or performance-tuning server.
- Requirements
- A local Python install (pipx, uv or pip) with the driver extra for the target database (PostgreSQL, MySQL/MariaDB, MSSQL; SQLite needs none). A connections.toml config file and a .env file holding passwords referenced as environment variables, created by the setup wizard. A demo SQLite database is available for a credential-free trial.
Installation
In SourceWeft
- Open Amnesic in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
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.
Source: README.md at commit 20b8326
Tools
0Version history
1- v0.2.2LatestSep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts