VMOO数据库MCP服务器 - 支持开发和生产环境的安全数据库访问
# 开发环境
npx vmoo-mcp-database-server@latest --env=dev
# 生产环境
npx vmoo-mcp-database-server@latest --env=prod
# 配送测试站
npx vmoo-mcp-database-server@latest --env=deliver
# 商户Cookie管理
npx vmoo-mcp-database-server@latest --env=merchant
{
"mcpServers": {
"vmoo-database-dev": {
"command": "npx",
"args": ["vmoo-mcp-database-server@latest", "--env=dev"],
"env": {
"V_MOO_PASSWORD": "xxxxxxxxxxxxx"
}
},
"vmoo-database-prod": {
"command": "npx",
"args": ["vmoo-mcp-database-server@latest", "--env=prod"],
"env": {
"V_MOO_PASSWORD": "xxxxxxxxxxxxx"
}
},
"vmoo-database-deliver": {
"command": "npx",
"args": ["vmoo-mcp-database-server@latest", "--env=deliver"],
"env": {
"DELIVER_PASSWORD": "xxxxxxxxxxxxx"
}
},
"vmoo-database-merchant": {
"command": "npx",
"args": ["vmoo-mcp-database-server@latest", "--env=merchant"],
"env": {
"MERCHANT_PASSWORD": "xxxxxxxxxxxxx"
}
}
}
}
npm install
npm test
如果看到 ✅ 连接成功,说明配置正确。
npm start
-
Windows:
%APPDATA%\Augment\config.json
-
macOS:
~/Library/Application Support/Augment/config.json
-
Linux:
~/.config/Augment/config.json
在配置文件中添加:
{
"mcpServers": {
"vmoo-database-dev": {
"command": "node",
"args": ["D:\\代码库\\vmoo-mcp-server\\bin\\vmoo-mcp-dev.js"],
"env": {
"V_MOO_PASSWORD": "xxxxxxxxxxxxx"
}
},
"vmoo-database-prod": {
"command": "node",
"args": ["D:\\代码库\\vmoo-mcp-server\\bin\\vmoo-mcp-prod.js"],
"env": {
"V_MOO_PASSWORD": "xxxxxxxxxxxxx"
}
},
"vmoo-database-deliver": {
"command": "node",
"args": ["D:\\代码库\\vmoo-mcp-server\\bin\\vmoo-mcp-deliver.js"],
"env": {
"DELIVER_PASSWORD": "xxxxxxxxxxxxx"
}
},
"vmoo-database-merchant": {
"command": "node",
"args": ["D:\\代码库\\vmoo-mcp-server\\bin\\vmoo-mcp-merchant.js"],
"env": {
"MERCHANT_PASSWORD": "xxxxxxxxxxxxx"
}
}
}
}
注意: 请将路径替换为你的实际路径。
保存配置文件后,重启Augment应用。
配置成功后,你可以在Augment中直接询问:
- "列出所有fanwe_开头的表"
- "查询最近注册的10个用户"
- "显示fanwe_menu表中价格最高的商品"
- "fanwe_user表的结构是什么?"
- "描述fanwe_order表的字段"
- "显示fanwe_menu表的前5条记录"
- "fanwe_user表的示例数据"
- "fanwe_user表有多少条记录?"
- "数据库中有多少个表?"
- 主机: 118.25.190.11:3306
- 数据库: ceshi_v_moo_com
- 用户: ceshi_v_moo_com
- 字符集: utf8mb4
- 主机: 118.25.190.11:3306
- 数据库: ceshi_deliver
- 用户: ceshi_deliver
- 字符集: utf8mb4
- 主机: 43.142.37.34:3306
- 数据库: merchant_cookie_manager
- 用户: merchant_cookie_manager
- 字符集: utf8mb4
- 查询操作: SELECT、SHOW、DESCRIBE、EXPLAIN
- 数据修改: INSERT、UPDATE(仅限新增和修改)
- 表结构: CREATE TABLE、ALTER TABLE
- 禁止所有删除操作: 完全阻止DELETE、DROP TABLE、DROP DATABASE等删除操作
- 测试环境专用: 专为测试环境设计,确保数据安全
- 查询限制: 自动添加LIMIT防止大量数据返回
- SQL注入防护: 使用参数化查询
- 连接池管理: 自动管理数据库连接
- 错误处理: 完善的错误捕获和提示
用户: "VMOO数据库中有哪些用户相关的表?"
AI: 调用list_tables工具,返回包含user的表列表
用户: "fanwe_user表的字段都有什么含义?"
AI: 调用describe_table工具,返回表结构详情
用户: "最近一周注册的用户有多少?"
AI: 调用query_database工具,执行相应SQL查询
npm run dev
这将启用Node.js调试器,可以在Chrome DevTools中调试。
MCP服务器的日志会输出到stderr,可以通过以下方式查看:
node mcp-vmoo-database-server.js 2> debug.log
- 检查网络连接
- 确认数据库服务器可访问
- 验证防火墙设置
- 确保数据库用户有查询权限
- 检查表访问权限
- 验证Augment配置文件路径正确
- 确保Node.js版本 >= 18.0.0
MIT License