基于模型上下文协议(MCP)的数据库服务器,支持SQLite、MySQL、PostgreSQL和MSSQL数据库。
🇨🇳 中文文档 / Chinese Documentation: README_cn.md
从GitHub Releases下载适用于您平台的最新版本:
| 平台 | 下载 |
|---|---|
| Windows (x64) | rbdc-mcp-windows-x86_64.exe |
| macOS (Intel) | rbdc-mcp-macos-x86_64 |
| macOS (Apple Silicon) | rbdc-mcp-macos-aarch64 |
| Linux (x64) | rbdc-mcp-linux-x86_64 |
安装步骤:
Windows:
rbdc-mcp-windows-x86_64.exe)[https://github.com/rbatis/rbdc-mcp/releases]rbdc-mcp.exeC:\tools\rbdc-mcp.exeC:\tools 添加到路径列表中rbdc-mcp --helpmacOS:
rbdc-mcp-macos-x86_64)[https://github.com/rbatis/rbdc-mcp/releases]rbdc-mcp-macos-aarch64)[https://github.com/rbatis/rbdc-mcp/releases]mv rbdc-mcp-macos-* rbdc-mcp
chmod +x rbdc-mcp
sudo mv rbdc-mcp /usr/local/bin/
rbdc-mcp --helpLinux:
rbdc-mcp-linux-x86_64mv rbdc-mcp-linux-x86_64 rbdc-mcp
chmod +x rbdc-mcp
sudo mv rbdc-mcp /usr/local/bin/
rbdc-mcp --help前提条件:首先安装Rust。
cargo install --git https://github.com/rbatis/rbdc-mcp.git
git clone https://github.com/rbatis/rbdc-mcp.git
cd rbdc-mcp
cargo build --release
# 可执行文件:target/release/rbdc-mcp
配置文件位置:
%APPDATA%\Claude\claude_desktop_config.json~/Library/Application Support/Claude/claude_desktop_config.json基本配置:
{
"mcpServers": {
"rbdc-mcp": {
"command": "rbdc-mcp",
"args": ["--database-url", "sqlite://./database.db"]
}
}
}
特定平台示例:
<details> <summary><strong>不同数据库示例</strong></summary>{
"mcpServers": {
"rbdc-mcp-sqlite": {
"command": "rbdc-mcp",
"args": ["--database-url", "sqlite://./database.db"]
},
"rbdc-mcp-mysql": {
"command": "rbdc-mcp",
"args": ["--database-url", "mysql://user:password@localhost:3306/database"]
},
"rbdc-mcp-postgres": {
"command": "rbdc-mcp",
"args": ["--database-url", "postgres://user:password@localhost:5432/database"]
}
}
}
</details>
<details>
<summary><strong>Windows完整路径(如果不在PATH中)</strong></summary>
{
"mcpServers": {
"rbdc-mcp": {
"command": "C:\\tools\\rbdc-mcp.exe",
"args": ["--database-url", "sqlite://C:\\path\\to\\database.db"]
}
}
}
</details>
保存配置后,重启Claude桌面以加载MCP服务器。
在Claude桌面中尝试询问:
| 数据库 | 连接URL格式 |
|---|---|
| SQLite | sqlite://path/to/database.db |
| MySQL | mysql://user:password@host:port/database |
| PostgreSQL | postgres://user:password@host:port/database |
| MSSQL | mssql://user:password@host:port/database |
| 参数 | 描述 | 默认值 |
|---|---|---|
--database-url, -d | 数据库连接URL | 必需 |
--max-connections | 最大连接池大小 | 1 |
--timeout | 连接超时(秒) | 30 |
--log-level | 日志级别(error/warn/info/debug) | info |
sql_query:安全地执行SELECT查询sql_exec:执行INSERT/UPDATE/DELETE操作db_status:检查连接池状态第一步:配置

第二步:在Claude中的使用

Apache-2.0