OceanBase MCP
Read-only MCP gateway for OceanBase that enables secure inspection of OceanBase databases via MCP clients like OpenCode.
README
OceanBase MCP
OceanBase 只读 MCP 网关,用于 OpenCode 和其他 MCP 客户端安全查看 OceanBase。支持本地 stdio、远程 HTTP、MySQL/Oracle 模式、访问策略、来源 IP 限制、诊断、指标以及 Docker/Kubernetes 部署模板。
Read-only MCP gateway for OceanBase. It lets OpenCode and other MCP clients inspect OceanBase safely through explicit read-only tools, schema/table policy, HTTP authentication, source IP allowlists, diagnostics, metrics, and production deployment templates.
服务从设计上只读:没有写入工具,拒绝写入/控制 SQL,默认阻止 SELECT *,用户 SQL 默认走只读事务,并且 OB_MCP_READ_ONLY=false 会直接启动失败。
OceanBase MCP is read-only by design. It has no write tool, rejects write/control SQL, blocks SELECT * by default, runs user SQL in read-only transactions, and refuses to start when OB_MCP_READ_ONLY=false.
Documentation / 文档
| Topic | 中文 | English |
|---|---|---|
| Start here | 快速开始 | Quick start |
| OpenCode | 接入 OpenCode | OpenCode setup |
| Configuration | 配置说明 | Configuration |
| Deployment | 部署指南 | Deployment |
| Architecture | 架构说明 | Architecture |
| Security | 安全基线 | Security baseline |
| Examples | 示例索引 | Examples |
Capabilities / 能力
- MySQL and Oracle compatibility modes for OceanBase tenants.
- Local stdio MCP server for OpenCode desktop/local workflows.
- Streamable HTTP MCP server for shared or remote deployments.
- Multiple profiles for dev, staging, production, tenants, or clusters.
- Schema/table allowlist, denied system schemas, denied sensitive columns, hard row/response caps, and masked sample rows.
- Source IP allowlist with exact IP and CIDR entries through
OB_MCP_ALLOWED_IPS. - HTTP bearer token policies, Host allowlist, body limit, endpoint auth, and rate limiting.
- Health endpoint, Prometheus metrics, JSON audit logs, and config diagnostics.
- Database grant verification through a read-only permission check tool.
- Docker, Docker Compose, Kubernetes, Nginx, systemd, and local macOS/Linux/Windows client examples.
- GitHub Actions for CI, tagged releases, GHCR multi-architecture images, and offline image archives.
Quick Start / 快速开始
git clone https://github.com/sevoniva/oceanbase-mcp.git
cd oceanbase-mcp
npm install
npm run build
cp .env.example .env
npm run config:doctor
npm run start
Then configure OpenCode with opencode.jsonc or one of the files under examples.
Production Minimum / 生产最小配置
NODE_ENV=production
OB_HOST=your-obproxy.example.com
OB_PORT=2883
OB_USER=readonly_user@tenant#cluster
OB_PASSWORD_FILE=/run/secrets/ob_password
OB_COMPATIBILITY=mysql
OB_PRODUCTION=true
OB_MCP_READ_ONLY=true
OB_ALLOWED_SCHEMAS=app_schema
OB_ALLOW_SELECT_STAR=false
OB_ENFORCE_READ_ONLY_TX=true
OB_MAX_ROWS=100
OB_MAX_RESULT_BYTES=1048576
OB_MCP_HOST=127.0.0.1
OB_MCP_AUTH_TOKEN_FILE=/run/secrets/ob_mcp_auth_token
OB_MCP_ALLOWED_IPS=127.0.0.1,10.0.0.0/8
Use OB_MCP_HOST=0.0.0.0 only behind TLS/reverse proxy or a trusted network boundary. Non-local HTTP binds require OB_MCP_AUTH_TOKEN, OB_MCP_ALLOWED_HOSTS, and OB_MCP_ALLOWED_IPS.
Tools / 工具
| Tool | Purpose |
|---|---|
ob_list_profiles |
List configured profiles with secrets redacted. |
ob_config_diagnostics |
Report deployment and policy checks. |
ob_verify_permissions |
Check current database grants for write/admin privileges. |
ob_ping |
Verify the OceanBase connection. |
ob_policy_explain |
Explain whether SQL would be allowed. |
ob_query |
Run strict read-only SQL. |
ob_list_schemas |
List visible schemas/databases. |
ob_list_tables |
List visible tables. |
ob_describe_table |
Return column metadata. |
ob_explain |
Run EXPLAIN for read-only SQL. |
ob_search_catalog |
Search schemas, tables, and columns. |
ob_get_table_schema |
Return policy-filtered table schema. |
ob_get_table_ddl |
Return native or structured table DDL metadata. |
ob_find_related_tables |
Find foreign-key and conservative naming-based table relationships. |
ob_get_indexes |
Return table index metadata. |
ob_get_constraints |
Return primary, unique, foreign-key, check, and not-null constraints. |
ob_get_partitions |
Return table partition metadata. |
ob_sample_rows |
Return masked, explicit-column sample rows. |
Validation / 验证
npm test
npm run smoke
npm run mcp:smoke
npm run http:smoke
npm audit --omit=dev --audit-level=moderate
npm pack --dry-run
Oracle compatibility can be verified with:
npm run mcp:smoke:oracle
npm run http:smoke:oracle
See docs/en/README.md or docs/zh-CN/README.md for complete setup.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。