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).
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp_dbquery the users table for active accounts"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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 downThis server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/seraved/mcp_db'
If you have feedback or need assistance with the MCP directory API, please join our Discord server