Config is the same across clients — only the file and path differ.
{
"mcpServers": {
"a2db": {
"env": {
"DB_PASSWORD": "your-password-here"
},
"args": [
"a2db-mcp",
"--register",
"myapp/prod/main",
"postgresql://user:${DB_PASSWORD}@host/mydb"
],
"command": "uvx"
}
}
}Are you the author?
Add this badge to your README to show your security score and help users find safe servers.
5 databases · batch queries · pre-configured connections · SQLGlot read-only
Run this in your terminal to verify the server starts. Then let us know if it worked — your result helps other developers.
uvx 'a2db' 2>&1 | head -1 && echo "✓ Server started successfully"
After testing, let us know if it worked:
Five weighted categories — click any category to see the underlying evidence.
No known CVEs.
Checked a2db against OSV.dev.
Click any tool to inspect its schema.
Be the first to review
Have you used this server?
Share your experience — it helps other developers decide.
Sign in to write a review.
Others in data / ai-ml
Persistent memory using a knowledge graph
Query and manage PostgreSQL databases directly from AI assistants
Dynamic problem-solving through sequential thought chains
Workspace template + MCP server for Claude Code, Codex CLI, Cursor & Windsurf. Multi-agent knowledge engine (ag-refresh / ag-ask) that turns any codebase into a queryable AI assistant.
MCP Security Weekly
Get CVE alerts and security updates for io.github.agentic-eng/a2db and similar servers.
Start a conversation
Ask a question, share a tip, or report an issue.
Sign in to join the discussion.
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
Agent: "Show me active users and their recent orders"
↓
a2db execute → 2 queries, 1 call, structured results
↓
Agent: "Got it — 847 active users, avg order $42.50"
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 |
pip install a2db
Claude Code (with pre-configured connection):
claude mcp add -s user a2db -- a2db-mcp \
--register myapp/prod/main 'postgresql://user:${DB_PASSWORD}@host/mydb'
Claude Code (minimal — agent calls login on demand):
claude mcp add -s user a2db -- a2db-mcp
Claude Desktop / Cursor / any MCP client (.mcp.json):
{
"mcpServers": {
"a2db": {
"command": "uvx",
"args": [
"a2db-mcp",
"--register", "myapp/prod/main", "postgresql://user:${DB_PASSWORD}@host/mydb"
],
"env": {
"DB_PASSWORD": "your-password-here"
}
}
}
}
Multiple databases:
{
"args": [
"a2db-mcp",
"--register", "myapp/prod/main", "postgresql://user:${DB_PASSWORD}@host/maindb",
"--register", "myapp/prod/analytics", "postgresql://user:${DB_PASSWORD}@host/analytics"
]
}
--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.
# Save a connection (validates immediately)
a2db login -p myapp -e prod -d main 'postgresql://user:${DB_PASSWORD}@localhost/mydb'
# Query
a2db query -p
... [View full README on GitHub](https://github.com/agentic-eng/a2db#readme)