OceanBase MCP服务添加福利群:解决AI开发者的「MCP实战痛点」一个模型上下文协议(MCP)服务器,用于与OceanBase数据库进行安全交互。 该服务器允许AI助手通过受控接口列出表、读取数据和执行SQL查询,从而使数据库探索和分析更加安全和有条理。
pip install oceanbase-mcp-server
设置以下环境变量:
OB_HOST=localhost # Database host
OB_PORT=2881 # Optional: Database port (defaults to 2881 if not specified)
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"
}
}
}
}

# Install dependencies
pip install -r requirements.txt
# Run the server
python -m oceanbase_mcp_server

# Clone the repository
git clone https://github.com/yourusername/oceanbase_mcp_server.git
cd oceanbase_mcp_server
# Create virtual environment
python -m venv venv
source venv/bin/activate # or `venv\Scripts\activate` on Windows
# Install development dependencies
pip install -r requirements-dev.txt
# Run tests
pytest

此MCP服务器需要数据库访问才能运行。为了安全起见:
请参阅OceanBase 安全配置指南以获取有关以下方面的详细说明:
⚠️ 重要提示:在配置数据库访问时,始终遵循最小特权原则。
Apache许可证 - 详情请参阅LICENSE文件。
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)