Back to MCP Servers

Amnesic

The MCP server that remembers your database — persists table/column annotations, an FK relationship graph, and searchable notes across sessions, so the model stops re-discovering your schema every time. PostgreSQL, MySQL, MSSQL, SQLite; read-only-enforced.

databasespostgresmysqlsqlite
By SurajKGoyal
21Updated 1 day agoPythonMIT

Installation

npx -y amnesic

Configuration

{
  "mcpServers": {
    "amnesic": {
      "command": "npx",
      "args": ["-y", "amnesic"]
    }
  }
}

How to use

  1. Run the installation command above (if needed)
  2. Open your Claude Code settings file (~/.claude/settings.json)
  3. Add the configuration to the mcpServers section
  4. Restart Claude Code to apply changes

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 ↓

<p align="center"> <img src="assets/demo.svg" alt="Teach your AI a status code once, then query it in plain language forever. Your AI agent calls amnesic's tools; amnesic remembers across sessions." width="720"> </p>

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 a WITH CTE. 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 executorsDBHub, 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 catalogsDataHub, 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

amnesicQuery executorsEnterprise catalogs
Semantic context (what a value means)✅ persistent, yours❌ none✅ platform-managed
Survives across sessions
Portable / outlives DB accessexport/import⚠️ platform-bound
Setup costone commandone commandingestion pipeline
Live schema freshness⚠️ cached, manual refresh✅ always live⚠️ ingestion lag
Execution plans / index tuning✅ (Postgres MCP Pro)
Lineage / ownership / governance
Works on legacy schemas with no FK constraints✅ annotate them yourself❌ nothing to introspect⚠️ needs ingestion

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)

pipx install amnesic            # install the core
amnesic init                    # interactive wizard

Try it without credentials. Run amnesic init --demo instead — 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.

<details> <summary><b>Don't have <code>pipx</code>? Or prefer <code>uv</code> / plain <code>pip</code>?</b></summary> <br/>

Install pipx (one-time):

brew install pipx                                  # macOS
sudo apt install pipx                              # Linux (Debian/Ubuntu)
python -m pip install --user pipx                  # Windows / generic

Or use uv (single-binary alternative — fast, no Python required):

brew install uv                                            # macOS
curl -LsSf https://astral.sh/uv/install.sh | sh            # Linux / macOS
powershell -c "irm https://astral.sh/uv/install.ps1 | iex" # Windows

uv tool install amnesic

Or plain pip (installs into your active Python env):

pip install amnesic

Whichever you pick, amnesic init asks which database you'll connect to and prints the one extra command to install that driver — no need to commit to extras up front.

</details>

After install, amnesic --help works from any terminal.

Where amnesic stores things

FilemacOS / LinuxWindows
Config~/.config/amnesic/connections.toml%APPDATA%\amnesic\connections.toml
Secrets~/.config/amnesic/.env (chmod 600)%APPDATA%\amnesic\.env (user profile ACL)
Knowledge~/.config/amnesic/knowledge_<name>.db%APPDATA%\amnesic\knowledge_<name>.db

Set $AMNESIC_HOME (or $XDG_CONFIG_HOME on Linux) to override the location.

Adding more connections later

amnesic add          # add another connection to existing config
amnesic test         # verify all connections
amnesic test orders.prod  # verify one connection

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.

$ amnesic set-secret ORDERS_PROD_PASSWORD
Value: ****            ← hidden input (your typing is invisible)
Confirm: ****
✓ Set ORDERS_PROD_PASSWORD in ~/.config/amnesic/.env

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:

Connection nameGenerated env var
orders.prodORDERS_PROD_PASSWORD
analyticsANALYTICS_PASSWORD
drive.stagingDRIVE_STAGING_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:

# Hand off everything you've taught amnesic about a database (annotations +
# relationships, not the re-derivable schema cache) as portable JSON:
amnesic export orders.prod -o orders-knowledge.json
amnesic export orders.prod            # or print to stdout to pipe/redirect

# Load that knowledge into another connection (e.g. promote staging → prod,
# or onboard a teammate). Unconditional upsert — existing entries are overwritten:
amnesic import orders.prod orders-knowledge.json

# Wipe stored knowledge for a connection but keep the config entry:
amnesic clear orders.staging

# Drop a connection from connections.toml entirely (knowledge file kept
# unless you pass --delete-knowledge):
amnesic remove old.connection
amnesic remove old.connection --delete-knowledge

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:

/plugin marketplace add https://github.com/SurajKGoyal/amnesic-marketplace
/plugin install amnesic@amnesic

That wires amnesic as an MCP server automatically. Source: SurajKGoyal/amnesic-marketplace.

<details> <summary><b>Or wire it by hand — edit <code>~/.claude/mcp.json</code></b></summary> <br/>
{
  "mcpServers": {
    "amnesic": {
      "command": "amnesic"
    }
  }
}
</details>

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_de

View source on GitHub