RBDC MCP服务器
基于的数据库服务器 模型上下文协议(MCP),支持SQLite、MySQL、PostgreSQL和MSSQL数据库。
🇨🇳 中文文档 / Chinese Documentation: README_cn.md
优势
- 多数据库支持:使用统一界面无缝使用SQLite、MySQL、PostgreSQL和MSSQL
- AI集成:通过模型上下文协议与Claude AI进行本地集成
- 零配置:数据库连接和资源的自动管理
- 安全:通过人工智能驱动的自然语言查询控制对数据库的访问
- 简洁:使用自然语言查询和修改数据库,而无需编写SQL
安装
🚀 方法1:通过货物安装(推荐)
先决条件: 安装 锈 第一。
cargo install --git https://github.com/rbatis/rbdc-mcp.git📦 方法2:下载预构建的二进制文件
从以下网址下载适用于您平台的最新版本 :
| 平台 | 下载 |
|---|---|
| Windows(x64) | rbdc-mcp-windows-x86_64.exe |
| macOS(英特尔) | rbdc-mcp-macos-x86_64 |
| macOS(苹果硅) | rbdc-mcp-macos-aarch64 |
| Linux(x64) | rbdc-mcp-linux-x86_64 |
下载后,将文件重命名为 rbdc-mcp (或 rbdc-mcp.exe 在Windows上)并将其添加到系统PATH中。
🔧 快速设置
步骤1:配置Claude桌面
配置文件位置:
- 视窗:
%APPDATA%\Claude\claude_desktop_config.json - macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
基本配置:
{
"mcpServers": {
"rbdc-mcp": {
"command": "rbdc-mcp",
"args": ["--database-url", "sqlite://./database.db"]
}
}
}平台特定示例:
Different Database Examples
{
"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"]
}
}
}Windows Full Path (if not in PATH)
{
"mcpServers": {
"rbdc-mcp": {
"command": "C:\\tools\\rbdc-mcp.exe",
"args": ["--database-url", "sqlite://C:\\path\\to\\database.db"]
}
}
}步骤2:重新启动克劳德桌面
保存配置后,重新启动Claude Desktop以加载MCP服务器。
步骤3:测试连接
在Claude Desktop中,尝试询问:
- “显示数据库连接状态”
- “我的数据库中有哪些表?”
📊 使用示例
自然语言数据库操作
- 查询数据:“显示数据库中的所有用户”
- 修改数据:“通过电子邮件添加一个名为John的新用户john@example.com"
- 获取状态:“数据库连接状态如何?”
- 架构信息:“我的数据库中存在哪些表?”
🗄️ 数据库支持
| 数据库 | 连接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 | 日志级别(错误/警告/信息/调试) | info |
🛠️ 可用工具
sql_query:安全执行SELECT查询sql_exec:执行INSERT/UPDATE/DELETE操作db_status:检查连接池状态
📸 截图
步骤1:配置 Configuration
第二步:在Claude中使用 Usage
许可证
阿帕奇-2.0
