Multi-DB MCP Server
Provides tools to interact with ClickHouse databases, including listing databases, listing tables, describing tables, and executing SQL queries.
Provides tools to interact with MySQL databases, including listing databases, listing tables, describing tables, and executing SQL queries.
Provides tools to interact with PostgreSQL databases, including listing databases, listing tables, describing tables, and executing SQL queries.
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., "@Multi-DB MCP Serverlist tables in postgres"
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.
ai_mcp: Multi-DB MCP Server
一个可直接部署的多数据库 MCP 服务,支持 PostgreSQL / ClickHouse / MySQL。仓库结构和体验目标参考 mysql_mcp_server:
一次拉取即可使用
.env配置驱动既支持 MCP stdio,也支持 HTTP API 调用
目录
db_mcp_service/server.py: MCP stdio 工具(list_databases/list_tables/describe_table/execute_sql)db_mcp_service/api.py: FastAPI 对外 HTTP 接口db_mcp_service/run_api.py: HTTP 启动入口requirements.txt: 运行依赖pyproject.toml: 可选的包安装元信息(含命令入口)start-mcp.ps1/.cmd,start-api.ps1/.cmd: 一键启动脚本Dockerfile,docker-compose.yml: 一键容器启动examples/claude-desktop.json: Claude Desktop 配置示例
第一步:拉取并准备环境
git clone <your-repo-url>
cd ai_mcp
python -m venv .venv
. .venv\Scripts\Activate.ps1
python -m pip install -r requirements.txt第二步:配置
copy .env.example .env编辑 .env,只开启需要的后端,例如只开 PostgreSQL:
POSTGRES_ENABLED=true
POSTGRES_DSN=postgresql://user:password@127.0.0.1:5432/postgres
CLICKHOUSE_ENABLED=false
MYSQL_ENABLED=false启动方式(两条主线)
1) MCP stdio(推荐给 MCP 客户端)
# 推荐直接用项目内脚本
./start-mcp.ps1
# 或直接运行模块
python -m db_mcp_service2) HTTP API(给第三方系统调用)
./start-api.ps1
# 或
python -m db_mcp_service.run_apiHTTP 默认监听:0.0.0.0:8000,可在 .env 中改:
DB_MCP_API_HOSTDB_MCP_API_PORTDB_MCP_API_RELOAD
可选:安装成全局命令
如果你的环境可以安装 build 依赖,可执行:
python -m pip install -e .安装后可直接使用:
db-mcp(MCP stdio)db-mcp-api(FastAPI)
如果该方式不可用,直接用上面的 python -m 启动方式即可。两者行为一致。
HTTP API 路由
GET /healthGET /databasesGET /databases/{database}GET /databases/{database}/tables?schema=publicGET /databases/{database}/tables/{table}?schema=publicPOST /sql
POST /sql 示例:
{
"database": "postgres",
"sql": "SELECT 1",
"params": null,
"allow_write": false
}默认只读。allow_write=true 或设置全局 MCP_ALLOW_WRITE=true 后才能执行写语句。
API 鉴权(可选)
.env 配置:
DB_MCP_API_TOKEN=your-token设置后访问 /sql 需要携带 Header:X-API-Key: your-token。
Docker 启动(可直接给别人用)
docker compose up --build直接可复用的 Claude Desktop 配置
见文件:examples/claude-desktop.json
你可以把它复制到 Claude Desktop 的配置中,仅需改数据库连接字段即可直接共享。
This 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
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/1249zts/db-mcp-service'
If you have feedback or need assistance with the MCP directory API, please join our Discord server