Get the FREE Ultimate OpenClaw Setup Guide →

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.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
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:

  1. Create and activate a Python virtual environment (optional but recommended):
python -m venv venv
source venv/bin/activate  # On Windows use: venv\Scripts\activate
  1. Install the OceanBase MCP Server package:
pip install oceanbase-mcp-server
  1. Ensure the required dependencies are installed (if not handled by the package):
pip install -r requirements.txt
  1. Run the server (standalone mode):
python -m oceanbase_mcp_server
  1. 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

Sponsor this space

Reach thousands of developers