Db
FreeNot checkedMCP server for executing SQL queries on PostgreSQL and ClickHouse with per-connection allow/deny policies by statement group.
About
MCP server for executing SQL queries on PostgreSQL and ClickHouse with per-connection allow/deny policies by statement group.
README
MCP server for running SQL against PostgreSQL and ClickHouse (HTTP interface) connections, with per-connection allow/deny policy by statement group (DDL/DML/DQL/DCL/TCL).
Built on mcp_core.
Install
poetry install
Configure
Copy db_connections.example.yaml to db_connections.yaml, edit connections. Secrets are env-var references only (user_env/password_env) — export the actual values before starting the server.
Run
export MCP_DB_CONFIG=/path/to/db_connections.yaml
export PG_USER=... PG_PASSWORD=...
export CH_USER=... CH_PASSWORD=...
poetry run mcp-db
Tools
db_query(connection, sql)— DQL only, rows truncated atmax_rows.db_execute(connection, sql)— DDL/DML/DCL/TCL, returnsrowcount.db_list_connections()— lists configured connection names, drivers, and policy modes.
Policy modes (per connection, mode field)
readonly(default) — only DQL allowed.restricted— only groups listed inallow_groupsallowed; emptyallow_groupsdenies everything.unrestricted— everything allowed except groups listed indeny_groups.
Tests
poetry run pytest -m "not integration" # fast unit tests
docker compose -f docker-compose-test.yml up -d # postgres + clickhouse test containers
poetry run pytest # full suite
docker compose -f docker-compose-test.yml down
Install Db in Claude Desktop, Claude Code & Cursor
unyly install mcp-dbInstalls into Claude Desktop, Claude Code, Cursor & VS Code — handles npx, uvx and build-from-source repos for you.
First time? Get the CLI: curl -fsSL https://unyly.org/install | sh
Or configure manually
Run in your terminal:
claude mcp add mcp-db -- uvx --from git+https://github.com/seraved/mcp_db mcp-dbFAQ
Is Db MCP free?
Yes, Db MCP is free — one-click install via Unyly at no cost.
Does Db need an API key?
No, Db runs without API keys or environment variables.
Is Db hosted or self-hosted?
A hosted option is available: Unyly runs the server in the cloud, no local setup required.
How do I install Db in Claude Desktop, Claude Code or Cursor?
Open Db on unyly.org, pick your client tab (Claude Desktop, Claude Code, Cursor) and press Install — the config is generated automatically, no JSON editing.
Related MCPs
wenb1n-dev/SmartDB_MCP
A universal database MCP server supporting simultaneous connections to multiple databases. It provides tools for database operations, health analysis, SQL optim
by wenb1n-devPostgres Server
This server enables interaction with PostgreSQL databases through the Model Context Protocol, optimized for the AWS Bedrock AgentCore Runtime. It provides tools
by madhurprashPostgres
Query your database in natural language
by AnthropicPostgreSQL
Read-only database access with schema inspection.
by modelcontextprotocolCompare Db with
Not sure what to pick?
Find your stack in 60 seconds
Author?
Embed badge for your README
Browse similar
All data MCPs
