Skip to main content
Glama
yuanoOo

OceanBase MCP Server

by yuanoOo

OceanBase MCP 服务器

一个模型上下文协议 (MCP) 服务器,用于实现与 OceanBase 数据库的安全交互。该服务器允许 AI 助手通过受控接口列出表格、读取数据并执行 SQL 查询,从而使数据库的探索和分析更加安全、结构化。

特征

  • 将可用的 OceanBase 表列为资源

  • 读取表内容

  • 执行 SQL 查询并进行适当的错误处理

  • 通过环境变量保护数据库访问

  • 综合日志记录

Related MCP server: Microsoft SQL Server MCP Server

安装

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

将其添加到您的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 服务器需要数据库访问权限才能运行。出于安全考虑:

  1. 创建具有最小权限的专用 OceanBase 用户

  2. 切勿使用根凭据或管理帐户

  3. 将数据库访问限制为仅进行必要的操作

  4. 启用日志记录以用于审计目的

  5. 定期对数据库访问进行安全审查

请参阅OceanBase 安全配置指南,详细了解:

  • 创建受限的OceanBase用户

  • 设置适当的权限

  • 监控数据库访问

  • 安全最佳实践

⚠️重要提示:配置数据库访问时始终遵循最小特权原则。

执照

Apache 许可证 - 有关详细信息,请参阅 LICENSE 文件。

贡献

  1. 分叉存储库

  2. 创建你的功能分支( git checkout -b feature/amazing-feature )

  3. 提交您的更改( git commit -m 'Add some amazing feature' )

  4. 推送到分支( git push origin feature/amazing-feature )

  5. 打开拉取请求

Available Tools

1 tool
execute_sqlC

Execute an SQL query on the OceanBase server

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYesThe SQL query to execute

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions execution but fails to address critical aspects like required permissions, transaction handling, error behavior, or result format. This leaves significant gaps for a tool that performs database operations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's function without unnecessary elaboration. It's appropriately sized and front-loaded, with zero wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a database execution tool with no annotations and no output schema, the description is insufficient. It lacks information about return values, error handling, security requirements, and operational constraints, which are critical for proper tool invocation in this context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with the single parameter 'query' documented in the schema. The description adds no additional parameter semantics beyond what the schema already provides, so it meets the baseline for adequate but unenhanced documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('execute') and resource ('SQL query on the OceanBase server'), providing a specific verb+resource combination. However, with no sibling tools mentioned, there's no opportunity to distinguish from alternatives, which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives, prerequisites, or limitations. It merely states what the tool does without context for application, leaving the agent to infer usage scenarios independently.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 1 tool updatev1.0.0
    • First observedexecute_sql

TDQS

B3/5.0

Scored across 1 tool

Disambiguation5/5

With only one tool, there is no possibility of ambiguity or overlap between tools. The single tool 'execute_sql' has a clear and distinct purpose that cannot be confused with any other tool in this set.

Naming Consistency5/5

The single tool name 'execute_sql' follows a clear verb_noun pattern, and with only one tool, consistency is inherently perfect. There are no other tools to compare against, so no inconsistencies can exist.

Tool Count2/5

A single tool is too few for a database server's apparent scope, which typically requires operations like querying, updating, schema management, and transaction handling. This minimal set severely limits functionality and will likely cause agent failures in complex tasks.

Completeness1/5

The tool surface is severely incomplete for a database server domain. It only provides SQL execution, missing essential operations such as listing tables, describing schemas, creating/dropping tables, managing transactions, or handling connections, leaving significant gaps that will hinder agent workflows.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

  • Draxlr's remote MCP server connects AI assistants to your SQL databases and dashboards. Explore schemas, run read-only queries, manage saved queries and dashboards, and export results, all with row-level security so each user sees only their own data.

  • The BigQuery remote MCP server is a fully managed service that uses the Model Context Protocol to connect AI applications and LLMs to BigQuery data sources. It provides secure, standardized tools for AI agents to list datasets and tables, retrieve schemas, generate and execute SQL queries through natural language, and analyze data—enabling direct access to enterprise analytics data without requiring manual SQL coding.

  • A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…

  • The Grafbase MCP server sits in front of a GraphQL API and exposes an MCP protocol-compliant interface that allows AI agents and LLMs to explore and query GraphQL APIs using natural language. It provides tools to search schemas, introspect types and fields, and execute GraphQL queries while minimizing context bloat by returning only relevant schema subsets, with built-in support for authentication, authorization, and configurable access control.

Related MCP Servers

  • A
    license
    Not graded
    quality
    B
    maintenance
    A Model Context Protocol server that enables secure and structured interaction with Microsoft SQL Server databases, allowing AI assistants to list tables, read data, and execute SQL queries with controlled access.
    58
    MIT
  • A
    license
    B
    quality
    D
    maintenance
    A Model Context Protocol server that enables secure interaction with Microsoft SQL Server databases, allowing AI assistants to list tables, read data, and execute SQL queries through a controlled interface.
    10
    1
    393
    MIT
  • A
    license
    A
    quality
    A
    maintenance
    A Model Context Protocol server implementation that enables AI assistants to securely interact with GreptimeDB, allowing them to explore database schema, read data, and execute SQL queries through a controlled interface.
    15
    29
    MIT