open-db-mcp
Provides database access and management capabilities for MySQL databases, including connection management, query execution, transaction support, and data import/export.
Provides database access and management capabilities for PostgreSQL databases, including connection management, query execution, transaction support, and data import/export.
Provides database access and management capabilities for SQLite databases, including connection management, query execution, transaction support, and data import/export.
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., "@open-db-mcplist all tables in my MySQL database"
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.
⚡ open-db-mcp
让 LLM Agent 安全地访问你的数据库
简体中文 | English
基于 MCP 协议 的多数据源数据库工具,通过 stdio 本地进程与 Claude Desktop / Cursor / Trae 等 AI 客户端即插即用。
支持数据库:MySQL · Oracle · 达梦 · PostgreSQL · Vastbase · openGauss · SQLite
核心能力:多数据源一键切换 · 三层白名单安全护栏 · 影响行数预检 · 事务支持 · 慢 SQL 分析 · CSV/JSON 导入导出 · 跨库 Schema Diff · 插件化驱动扩展
🚀 快速开始
git clone https://github.com/cjp1016/open-db-mcp.git
cd open-db-mcp
uv sync # 安装依赖
uv run open-db-mcp init # 生成 ~/.open-db-mcp/ 配置
uv run open-db-mcp doctor # 健康检查配置数据源
编辑 ~/.open-db-mcp/datasources.json:
{
"MY_MYSQL": {
"driver": "mysql",
"url": "jdbc:mysql://127.0.0.1:3306/test_db",
"user": "root",
"password": "env:DB_PASSWORD"
}
}driver:简写(mysql/oracle/dm/postgres/sqlite)或完整 JDBC 类名password:支持明文或安全引用(env:变量名/keyring:/cmd:)可选参数:
pool_min、pool_max、max_affected_rows
注册到 MCP 客户端
最简配置(使用默认路径 config/datasources.json):
{
"mcpServers": {
"open-db-mcp": {
"command": "open-db-mcp",
"args": ["run"]
}
}
}完整配置(通过 env 注入运行时参数):
{
"mcpServers": {
"open-db-mcp": {
"command": "open-db-mcp",
"args": ["run"],
"env": {
"MCP_DATASOURCES_CFG_PATH": "/path/to/datasources.json",
"MCP_WHITELIST_PATH": "/path/to/whitelist.json",
"MCP_POOL_MAX": "8",
"MCP_MAX_AFFECTED_ROWS": "1000",
"MCP_QUERY_TIMEOUT_SEC": "30",
"MCP_AUDIT_LOG_PATH": "/path/to/audit.jsonl",
"DB_PASSWORD": "your_password"
}
}
}
}环境变量说明:
变量 | 默认值 | 说明 |
|
| 数据源配置文件路径 |
|
| 白名单配置文件路径 |
|
| 每个数据源的连接池上限 |
|
| 单次 DML 允许影响的最大行数 |
|
| 查询默认最大返回行数 |
|
| 查询超时(秒) |
|
| 审计日志路径 |
|
| 是否启用审计日志 |
|
| 达梦 JDBC 驱动 jar 路径 |
所有
MCP_*变量也可写入~/.open-db-mcp/.env文件,效果相同。
各客户端配置文件位置:
客户端 | 配置文件 |
Claude Desktop (macOS) |
|
Claude Desktop (Windows) |
|
Cursor |
|
Trae / 其他 | 参考对应客户端的 MCP 配置文档,格式相同 |
💬 联系 & 赞助
📄 License
MIT © cjp1016
This server cannot be installed
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/cjp1016/open-db-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server