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.
Related MCP Servers
- AlicenseBqualityFmaintenanceA minimal MCP server that allows executing SQL queries on PostgreSQL databases with configurable read-only or write permissions.11613MIT
- Flicense-qualityCmaintenanceA multi-database MCP server supporting PostgreSQL, ClickHouse, and MySQL that enables database exploration and SQL execution through MCP stdio or HTTP API.
- Alicense-qualityFmaintenanceRead-only MCP server for SQL databases (SQL Server, Postgres, SQLite) with multi-server support and three-layer safety using AST validation and linting.MIT
- AlicenseAqualityCmaintenanceA 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
Related MCP Connectors
MCP server for managing Prisma Postgres.
MCP server for interacting with the Supabase platform
MCP server for Blockscout
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- 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