Security-first MCP server for PostgreSQL, SQLite, MySQL, DuckDB with SQL injection prevention.
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 into ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
Inspect callable tools, capabilities, and parameters exposed to AI agents by Universal Db Mcp.
queryExecute SQL β read-only by default, all 8 security layers apply
schemaInspect tables and columns β no config needed
explainGet query execution plan without running the query
healthCheck connection status, DB version, and pool metrics
list_databasesShow all configured databases and connection state
query_historyInspect the last 100 executed queries
The security-first, Python-native MCP server for database access from AI agents.

Most database MCP servers give AI agents raw SQL access and hope for the best. This server assumes the LLM is untrusted input and applies 8 layers of injection prevention before any query reaches your database β including blocking UNION attacks, stacked statements, time-based injection, and comment bypasses.
Supports: PostgreSQL Β· SQLite Β· MySQL Β· DuckDB (columnar analytics)
No Docker. No cloud account. No database server to install. DuckDB and SQLite run in-process:
Add to Claude Code in ~/.claude/mcp_servers.json, or to Claude Desktop in
~/Library/Application Support/Claude/claude_desktop_config.json (macOS) /
%APPDATA%\Claude\claude_desktop_config.json (Windows):
Restart Claude Desktop / Claude Code after saving β that's it.
That's it. Claude Code discovers the tools automatically.
More client configs (Claude Desktop, Cursor, Windsurf, Docker) in
examples/.
Read-only by default. Defense-in-depth. Every query validated before it touches the driver.
| Layer | What it does |
|---|---|
| 1 | Driver-level read-only β PostgreSQL session flag, SQLite mode=ro URI, DuckDB read_only=True. Write rejected before SQL parsing. |
| 2 | Keyword blocking β DROP, DELETE, TRUNCATE, ALTER, INSERT, UPDATE, GRANT, EXEC blocked in read-only mode |
| 3 | Injection pattern detection β UNION SELECT, stacked statements, SQL comments (--, /*), xp_, SLEEP(), WAITFOR, BENCHMARK() |
| 4 | Multiple statement rejection β ; separating statements always blocked |
| 5 | Parameter type enforcement β only str, int, float, bool, null accepted as parameters |
| 6 | Result size limits β truncated at MAX_RESULT_ROWS (default 1000) to prevent memory exhaustion |
| 7 | Identifier sanitization β table/column names stripped of metacharacters in internally-generated SQL |
| 8 | DuckDB filesystem blocklist β read_csv(), read_parquet(), glob(), LOAD, INSTALL, httpfs, COPY blocked at adapter level; read_only=True only blocks writes, not file reads |
Full threat model: docs/SECURITY.md
DuckDB runs in-process (no server) and reads Parquet, CSV, JSON natively. Connect AI agents to your analytics data without spinning up a warehouse:
Then in Claude Code:
No separate NL-to-SQL tool needed β Claude already does this. Give it the
schema tool and ask in plain English:
Pair with dry_run: true (DRYRUN=true) while prototyping β Claude gets the
query plan back without anything executing.
See examples/docker_mcp_config.json for
wiring this into an MCP client.
| Tool | Description |
|---|---|
query | Execute SQL β read-only by default, all 8 security layers apply |
schema | Inspect tables and columns β no config needed |
explain | Get query execution plan without running the query |
health | Check connection status, DB version, and pool metrics |
list_databases | Show all configured databases and connection state |
query_history | Inspect the last 100 executed queries |
snapshot_schema | Capture current schema for drift detection |
schema_diff | Compare current schema against the last snapshot |
v1.1.0: dry-run mode (DRYRUN=true), table allowlists (WHITELISTED_TABLES), query
complexity warnings, structured audit logs, and a --check CLI flag for connectivity
validation. See CHANGELOG.md.
Always use a dedicated read-only account. Never give the MCP server credentials that can modify data.
PostgreSQL:
MySQL:
| This project | Google MCP Toolbox | |
|---|---|---|
| Runtime | Python β pip install / uvx | Go binary / Docker |
| Local DBs | SQLite + DuckDB zero-infra | No SQLite |
| Analytics | DuckDB in-process | No columnar adapter |
| Auth model | Read-only by default + env vars | IAM / GCP-native |
| SQL injection | 8-layer sanitizer + parameterized | Auth-focused |
| Extend | Python ecosystem, any pip package | Go plugins |
| Vendor | Neutral | Google Cloud funnel |
Different tools for different jobs. Use this when you want Python-native, local-first, security-hardened access without cloud dependencies.
MIT β LICENSE
Security Notice: This server provides AI agents with database access. Always
use read-only credentials, review docs/SECURITY.md before
production deployment, and never commit .env files.
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/universal-db-mcp)<a href="https://allmcps.com/mcp/universal-db-mcp"><img src="https://allmcps.com/api/badge/universal-db-mcp?style=directory" alt="Universal Db Mcp on AllMCPs" /></a>