Command Palette

Search for a command to run...

UnylyUnyly
Browse all

Db

FreeNot checked

MCP server for executing SQL queries on PostgreSQL and ClickHouse with per-connection allow/deny policies by statement group.

GitHubEmbed

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 at max_rows.
  • db_execute(connection, sql) — DDL/DML/DCL/TCL, returns rowcount.
  • 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 in allow_groups allowed; empty allow_groups denies everything.
  • unrestricted — everything allowed except groups listed in deny_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

from github.com/seraved/mcp_db

Install Db in Claude Desktop, Claude Code & Cursor

Recommended · one command, every IDE
unyly install mcp-db

Installs 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-db

FAQ

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

Compare Db with

Not sure what to pick?

Find your stack in 60 seconds

Author?

Embed badge for your README

Browse similar

All data MCPs