nexusdb
Click on "Deploy 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., "@nexusdbCan you list all tables in the 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.
NexusDB
MCP数据库分析服务,为AI Agent提供数据库分析能力。
项目结构
nexusdb/
├── nexusdb/ # Python包
│ ├── __init__.py
│ ├── __main__.py
│ ├── config.py # 数据库配置
│ ├── server.py # MCP服务器
│ ├── db/
│ │ ├── __init__.py
│ │ └── connection.py # 数据库连接
│ └── tools/
│ ├── __init__.py
│ └── tables.py # 表操作工具
├── tests/
│ ├── __init__.py
│ └── test_tables.py # pytest测试
├── opencode.json # OpenCode MCP配置
├── .gitignore
├── pyproject.toml
└── README.mdRelated MCP server: mysql-mcp
安装
pip install -e .使用
启动模式
本项目仅支持 stdio 模式,用于本地 OpenCode 集成。
python -m nexusdb.serverOpenCode集成
配置完成后,OpenCode 会自动启动 MCP 服务,无需手动运行。
MCP客户端配置
OpenCode
支持两种配置方式:全局配置和项目配置。
全局配置(推荐)
全局配置对所有项目生效。编辑 ~/.config/opencode/opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"db-analyzer": {
"type": "local",
"command": ["python", "-m", "nexusdb.server"],
"enabled": true
}
}
}Windows 路径:
C:\Users\<用户名>\.config\opencode\opencode.json
项目配置
仅对当前项目生效。在项目根目录创建 opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"db-analyzer": {
"type": "local",
"command": ["python", "-m", "nexusdb.server"],
"enabled": true
}
}
}项目配置会覆盖全局配置中的同名 MCP 服务器。
验证配置
# 列出所有已配置的 MCP 服务器及连接状态
opencode mcp list输出示例:
Name Type Status Command
db-analyzer local ready python -m nexusdb.server其他管理命令:
# 认证 OAuth 类型的 MCP 服务器
opencode mcp auth <server-name>
# 移除 OAuth 凭据
opencode mcp logout <server-name>
# 调试连接问题
opencode mcp debug <server-name>Claude Code
在项目根目录创建 .mcp.json:
{
"mcpServers": {
"db-analyzer": {
"command": "python",
"args": ["-m", "nexusdb.server"]
}
}
}Cursor
在项目根目录创建 .cursor/mcp.json:
{
"mcpServers": {
"db-analyzer": {
"command": "python",
"args": ["-m", "nexusdb.server"]
}
}
}自然语言调用
配置完成后,在对话中直接使用自然语言:
示例 | 说明 |
"列出数据库A的所有表" | 调用 list_tables_tool |
"查看hr_bd_land表的结构" | 调用 describe_table_tool |
测试
安装测试依赖
pip install pytest运行pytest测试
# 运行所有测试
pytest
# 运行指定测试文件
pytest tests/test_tables.py
# 详细输出
pytest -v
# 只运行某个类
pytest tests/test_tables.py::TestListTables
# 只运行某个方法
pytest tests/test_tables.py::TestListTables::test_list_tables_returns_listMCP Inspector测试
使用MCP Inspector交互式测试工具:
npx @modelcontextprotocol/inspector python -m nexusdb.server打开浏览器访问Inspector界面,可以:
查看所有可用工具
交互式测试每个工具
查看请求/响应详情
MCP工具
工具 | 说明 |
| 获取数据库所有表 |
| 查看表结构 |
配置
编辑 nexusdb/config.py 修改数据库连接:
DB_A = {
"host": "127.0.0.1",
"port": 3306,
"user": "your_user",
"password": "your_password",
"database": "your_database"
}This server cannot be deployed
Maintenance
Related MCP Connectors
- dataOAuthco.thinair
PostgreSQL, MySQL, and SQL Server in one session. 26 read-only MCP tools for AI agents.
- SchemaOAuthai.schemalabs
The AI that understands raw data: Schema over your tables and databases, as MCP tools.
Let AI agents query data and act across all your business apps via MCP.
Analytical memory for AI agents: a real Postgres queried in plain English over MCP. One command.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables AI agents to interact with Microsoft SQL Server databases via MCP, supporting table listing, schema retrieval, and CRUD operations.31MIT
- AlicenseAqualityDmaintenanceEnables AI agents to query and manage MySQL databases through a structured MCP interface, supporting SQL execution, table inspection, and database operations.94 npmMIT
- FlicenseAqualityDmaintenanceEnables AI agents to explore MySQL database schemas and execute read-only queries through a safe, MCP interface.6-
- AlicenseBqualityCmaintenanceEnables AI agents to interact with over 50 SQL and NoSQL databases through MCP tools for querying, schema inspection, and table management.51MIT