这是一个基于模型上下文协议(MCP)的服务器,用于与 OceanBase 数据库进行安全交互。该服务器允许AI助手通过受控接口列出表、读取数据并执行SQL查询,从而使数据库探索和分析更加安全和结构化。
<a href="https://glama.ai/mcp/servers/@yuanoOo/oceanbase_mcp_server"> <img width="380" height="200" src="https://gips3.baidu.com/it/u=1226733428,1474609031&fm=3081&app=3081&f=PNG?w=760&h=400" alt="OceanBase Server MCP 服务器" /> </a>pip install oceanbase-mcp-server
设置以下环境变量:
OB_HOST=localhost # 数据库主机
OB_PORT=2881 # 可选:数据库端口(未指定时默认为2881)
OB_USER=your_username
OB_PASSWORD=your_password
OB_DATABASE=your_database
在你的claude_desktop_config.json中添加以下内容:
{
"mcpServers": {
"oceanbase": {
"command": "uv",
"args": [
"--directory",
"path/to/oceanbase_mcp_server",
"run",
"oceanbase_mcp_server"
],
"env": {
"OB_HOST": "localhost",
"OB_PORT": "2881",
"OB_USER": "your_username",
"OB_PASSWORD": "your_password",
"OB_DATABASE": "your_database"
}
}
}
}
# 安装依赖项
pip install -r requirements.txt
# 运行服务器
python -m oceanbase_mcp_server
# 克隆仓库
git clone https://github.com/yourusername/oceanbase_mcp_server.git
cd oceanbase_mcp_server
# 创建虚拟环境
python -m venv venv
source venv/bin/activate # 或者在Windows上使用 `venv\Scripts\activate`
# 安装开发依赖项
pip install -r requirements-dev.txt
# 运行测试
pytest
此MCP服务器需要数据库访问才能工作。为了安全:
参见OceanBase安全配置指南,了解详细说明:
⚠️ 重要提示:配置数据库访问时始终遵循最小特权原则。
Apache许可证 - 详情请参阅LICENSE文件。
git checkout -b feature/amazing-feature)git commit -m '添加一些惊人的功能')git push origin feature/amazing-feature)