MCP servers
mcp-database
A read-only-by-default MCP server for PostgreSQL, MySQL and SQLite.
A safe-by-default Model Context Protocol server for PostgreSQL, MySQL/MariaDB and SQLite. Let Claude (or any MCP client) explore your schema and answer questions from your data — without handing it a loaded gun.
- Read-only by default. Writes need an explicit
--read-writeflag, and theexecutetool does not even exist until you pass it. - Defence in depth. Every query is checked by a SQL guard and runs inside a read-only transaction / read-only connection, so a guard bypass still cannot write.
- Built for LLMs. Schema discovery tools, parameterised queries, row caps, statement timeouts, compact JSON output, errors that explain what to do next.
- Zero native dependencies. SQLite uses Node's built-in
node:sqlite; Postgres and MySQL use pure-JS drivers.npxjust works. - One server, three engines. The connection string decides the dialect.
Only PostgreSQL, with personal data in it? pg-guard-mcp is the stricter sibling: Postgres only, never writes, masks the columns you mark as personal data and keeps an append-only audit log.
Quick start
Use a database account that can only SELECT (see Create a read-only role).
Claude Desktop — claude_desktop_config.json:
{
"mcpServers": {
"database": {
"command": "npx",
"args": ["-y", "@aranshayan/mcp-database"],
"env": { "DATABASE_URL": "postgres://readonly:secret@localhost:5432/mydb" }
}
}
}
Claude Code:
claude mcp add database --env DATABASE_URL=postgres://readonly:secret@localhost:5432/mydb -- npx -y @aranshayan/mcp-database
Cursor / VS Code / any MCP client: run npx -y @aranshayan/mcp-database as a stdio server with DATABASE_URL in its environment.
| Engine | DATABASE_URL |
|---|---|
| PostgreSQL | postgres://user:pass@host:5432/db |
| MySQL / MariaDB | mysql://user:pass@host:3306/db |
| SQLite | sqlite:///absolute/path/app.db or just ./app.db |
Requires Node.js 22.13+.