Safe, read-only database access for AI agents. 5 databases, batch queries, SQLGlot.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
We haven't yet run this listing's install command through our automated sandbox check. This isn't a red flag β we're steadily working through the catalog.
π‘ Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
Inspect callable tools, capabilities, and parameters exposed to AI agents by A2db.
loginSave a connection β validates by connecting first
logoutRemove a saved connection
list_connectionsList connections (no secrets exposed)
executeRun named batch queries with pagination
search_objectsExplore schema β tables, columns, with detail levels
Agent-to-Database
Give AI agents safe, read-only access to your databases. One call, multiple queries, clean results.
5 databases Β· batch queries Β· pre-configured connections Β· SQLGlot read-only
Quick Start Β· MCP Tools Β· Security Β· Comparison Β· Setup
Most database MCP servers make you run one query at a time, repeat connection details on every call, and return results double-encoded inside JSON strings. a2db fixes all of that:
.mcp.json with --register, agent queries immediatelypip install a2db and you're done${DB_PASSWORD} in DSNs, expanded only at connection time| Database | Driver | Async |
|---|---|---|
| PostgreSQL | asyncpg | native |
| SQLite | aiosqlite | native |
| MySQL / MariaDB | mysql-connector-python | wrapped |
| Oracle | oracledb | wrapped |
| SQL Server | pymssql | wrapped |
Claude Code (with pre-configured connection):
Claude Code (minimal β agent calls login on demand):
Claude Desktop / Cursor / any MCP client (.mcp.json):
Multiple databases:
--register pre-registers connections at server startup β the agent can query immediately. Passwords use ${ENV_VAR} syntax and are expanded at connection time, never stored in plaintext.
| Tool | Description |
|---|---|
login | Save a connection β validates by connecting first |
logout | Remove a saved connection |
list_connections | List connections (no secrets exposed) |
execute | Run named batch queries with pagination |
search_objects | Explore schema β tables, columns, with detail levels |
execute β the core toolNamed dict with default connection (preferred):
List format (auto-named q1, q2, ...):
Response (TSV format β default):
No ::text casts needed β integers, floats, timestamps, arrays, NULLs all work natively.
When a query fails with a column error, a2db enriches the message:
LLM context windows are expensive. JSON row data is verbose β every row repeats every column name, adds braces, commas, and quotes. TSV is a flat grid: one header row, then just values separated by tabs.
For a 100-row, 5-column result set, TSV typically uses 40-60% fewer tokens than JSON row format. The structured JSON envelope still gives you metadata (row count, truncation status) β only the row payload is TSV.
Set format="json" if you need full structured output with column names on every row.
Every query is parsed by SQLGlot before execution:
This is defense-in-depth β you should also use a read-only database user, but a2db won't let writes through even if the user has write permissions.
Write support is implemented in the core but not yet exposed via MCP. Planned: per-connection write permissions, explicitly enabled by the human operator β not the agent. See TODO.md.
Connections are saved in ~/.config/a2db/connections/ as TOML files.
${DB_PASSWORD} syntax β environment variable references are stored literally and expanded only at connection time. Secrets stay in your environment, not on disk.list_connections shows project/env/db and database type, never DSNs or passwordsa2db currently runs as a local stdio MCP server. It inherits environment variables from the process that launches it (your shell, Claude Code, Docker). This is the standard model for local MCP servers β the same approach used by DBHub, Google Toolbox, and others.
Planned: remote HTTP transport with OAuth 2.1 per the MCP spec. For now, if running in Docker, inject secrets via environment variables at container runtime.
| Feature | a2db | DBHub | Google Toolbox | PGMCP | Supabase MCP |
|---|---|---|---|---|---|
| Databases | 5 (PG, SQLite, MySQL, Oracle, MSSQL) | 5 (PG, MySQL, MSSQL, MariaDB, SQLite) | 40+ (cloud + OSS) | PG only | PG (Supabase) |
| Batch queries | Named dict + list | Semicolon-separated | No | No | No |
| Default connection | Set once, use for all | Per-query | N/A | Single DB | Single project |
| Read-only | SQLGlot AST (enforced) | Keyword check (config) | Hint/annotation | Read-only tx + regex | Config flag |
| Write support | Planned (per-connection) | Config flag | Via tool definition | No | Config flag |
| Output | JSON + TSV data | Structured text | MCP protocol | Table / JSON / CSV | JSON |
| Schema discovery | 3 detail levels | Dedicated tool | Prebuilt tools | Via NL-to-SQL | Dedicated tools |
| Pre-configured | --register in MCP config | Config file | YAML config | Env var | Cloud-managed |
| Credentials | ${ENV_VAR} in DSN | DSN strings | Env vars + GCP IAM | Env var | OAuth 2.1 |
| Drivers bundled | All included | All included | Varies | Built-in | Managed |
| CLI | Yes | No | Yes | Yes | No |
| Error context | Column suggestions + types | No | No | No | No |
| License | Apache 2.0 | MIT | Apache 2.0 | Apache 2.0 | Apache 2.0 |
When to use what:
Factual signals from GitHub, npm, and our automated checks β not a rating.
No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/a2db)<a href="https://allmcps.com/mcp/a2db"><img src="https://allmcps.com/api/badge/a2db?style=directory" alt="A2db on AllMCPs" /></a>