by yuanoOo
A Model Context Protocol (MCP) server that enables secure interaction with OceanBase databases, allowing AI assistants to list tables, read data, and execute SQL queries through a controlled interface.
OceanBase MCP Server is a Model Context Protocol (MCP) server designed to facilitate secure interaction between AI assistants and OceanBase databases. It provides a controlled interface for AI assistants to perform database operations like listing tables, reading data, and executing SQL queries, ensuring safer and more structured database exploration and analysis.
Installation:
pip install oceanbase-mcp-server
Configuration: Set the following environment variables:
OB_HOST=localhost
OB_PORT=2881
OB_USER=your_username
OB_PASSWORD=your_password
OB_DATABASE=your_database
Usage with Claude Desktop:
Add the following to your 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"
}
}
}
}
Usage as a standalone server:
# Install dependencies
pip install -r requirements.txt
# Run the server
python -m oceanbase_mcp_server
Q: How does OceanBase MCP Server ensure security? A: It emphasizes secure database access through environment variables, recommends using a database user with minimal required permissions, and suggests implementing query whitelisting for production use. It also advises against committing environment variables or credentials and encourages monitoring and logging all database operations.
Q: What are the security best practices for using OceanBase MCP Server? A: Create a dedicated OceanBase user with minimal permissions, never use root credentials, restrict database access to only necessary operations, enable logging for audit purposes, and conduct regular security reviews of database access. Always follow the principle of least privilege.
Q: Can I contribute to OceanBase MCP Server? A: Yes, you can contribute by forking the repository, creating a feature branch, committing your changes, pushing to the branch, and opening a Pull Request.
A Model Context Protocol (MCP) server that enables secure interaction with OceanBase databases. This server allows AI assistants to list tables, read data, and execute SQL queries through a controlled interface, making database exploration and analysis safer and more structured.
pip install oceanbase-mcp-server
Set the following environment variables:
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
Add this to your 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
This MCP server requires database access to function. For security:
See OceanBase Security Configuration Guide for detailed instructions on:
⚠️ IMPORTANT: Always follow the principle of least privilege when configuring database access.
Apache License - see LICENSE file for details.
git checkout -b feature/amazing-feature
)git commit -m 'Add some amazing feature'
)git push origin feature/amazing-feature
)Reviews feature coming soon
Stay tuned for community discussions and feedback