oceanbase_mcp_server
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.
claude mcp add --transport stdio yuanooo-oceanbase_mcp_server uv --directory path/to/oceanbase_mcp_server run oceanbase_mcp_server \ --env OB_HOST="localhost" \ --env OB_PORT="2881" \ --env OB_USER="your_username" \ --env OB_DATABASE="your_database" \ --env OB_PASSWORD="your_password"
How to use
OceanBase MCP Server provides a controlled interface to interact with OceanBase databases. It exposes resources that represent OceanBase tables, allowing you to list available tables, read data from them, and execute SQL queries with structured error handling. The server is designed to be used in conjunction with an MCP-enabled assistant or toolchain, enabling safe exploration and analysis of your OceanBase data through the MCP protocol. Tools available include listing table resources, streaming or fetching table contents, and running ad-hoc SQL queries against the configured OceanBase instance, all while enforcing the configured database credentials and access controls. To integrate with your environment, configure the required environment variables (host, port, user, password, database) and run the MCP server to start exposing these capabilities to your MCP client.
How to install
Prerequisites:
- Python 3.8+.
- pip (Python package manager).
- Access to the OceanBase database with appropriate credentials.
Installation steps:
- Create and activate a Python virtual environment (optional but recommended):
python -m venv venv
source venv/bin/activate # On Windows use: venv\Scripts\activate
- Install the OceanBase MCP Server package:
pip install oceanbase-mcp-server
- Ensure the required dependencies are installed (if not handled by the package):
pip install -r requirements.txt
- Run the server (standalone mode):
python -m oceanbase_mcp_server
- If you prefer Claude Desktop integration, use the uv-based setup as described in the configuration example above.
Additional notes
Environment variables:
- OB_HOST: OceanBase host. Default is recommended to be localhost if running locally.
- OB_PORT: OceanBase port (default 2881 if not specified).
- OB_USER: Database username with minimal required permissions.
- OB_PASSWORD: Password for the database user.
- OB_DATABASE: Target OceanBase database.
Security tips:
- Do not commit credentials in configuration files or code.
- Use a dedicated OceanBase user with minimal privileges required for MCP operations.
- Consider enabling logging of all database operations and reviewing logs regularly.
- Implement IP allowlists or network restrictions to limit who can access the MCP server.
Common issues:
- Connection errors due to incorrect host/port or credentials: verify OB_HOST, OB_PORT, OB_USER, OB_PASSWORD, and OB_DATABASE.
- Insufficient permissions: ensure the OceanBase user has the necessary SELECT/EXECUTE rights for the intended queries.
- Environment variable propagation: when running through Ivy/UI (e.g., Claude Desktop), ensure the env vars are passed to the uv process.
Related MCP Servers
mcp-vegalite
MCP server from isaacwasserman/mcp-vegalite-server
github-chat
A Model Context Protocol (MCP) for analyzing and querying GitHub repositories using the GitHub Chat API.
nautex
MCP server for guiding Coding Agents via end-to-end requirements to implementation plan pipeline
pagerduty
PagerDuty's official local MCP (Model Context Protocol) server which provides tools to interact with your PagerDuty account directly from your MCP-enabled client.
futu-stock
mcp server for futuniuniu stock
mcp -boilerplate
Boilerplate using one of the 'better' ways to build MCP Servers. Written using FastMCP