mcp_db
Allows running SQL queries (DQL, DDL, DML, DCL, TCL) against ClickHouse databases (HTTP interface) with per-connection policy modes (readonly, restricted, unrestricted).
Allows running SQL queries (DQL, DDL, DML, DCL, TCL) against PostgreSQL databases with per-connection policy modes (readonly, restricted, unrestricted).
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
mcp_db
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 installRelated MCP server: Multi-DB MCP Server
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-dbTools
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 downTool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Text-to-SQL MCP server: read-only queries on PostgreSQL, MySQL and SQL Server with your real schema
Hosted PostgreSQL MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
MCP server for querying and analyzing data from ad platforms, analytics tools, and spreadsheets
Hosted MCP server for PostgreSQL diagnostics: slow queries, missing indexes, connection pressure.
Related MCP Servers
- AlicenseBqualityDmaintenanceA minimal MCP server that allows executing SQL queries on PostgreSQL databases with configurable read-only or write permissions.127 npm13MIT
- FlicenseNot gradedqualityDmaintenanceA multi-database MCP server supporting PostgreSQL, ClickHouse, and MySQL that enables database exploration and SQL execution through MCP stdio or HTTP API.-
- AlicenseNot gradedqualityFmaintenanceRead-only MCP server for SQL databases (SQL Server, Postgres, SQLite) with multi-server support and three-layer safety using AST validation and linting.MIT
- AlicenseAqualityDmaintenanceA self-hostable PostgreSQL MCP server for exploring database schemas and running guarded read/write queries with selectable access modes (readonly, readwrite, admin), plus a dry-run confirm workflow for safety.141MIT