本页说明如何在 Codex 中接入已经启动的 ShardingSphere-MCP HTTP Server。ShardingSphere-MCP 是 Apache ShardingSphere 提供的 MCP Server,用于把数据库元数据访问、受控 SQL 查询和数据库治理能力暴露给支持 MCP 的 AI 客户端和平台。
database_gateway_validate_runtime_database 进行接入前校验。http://127.0.0.1:18088/mcp,或访问你实际配置的 MCP Server 地址。使用 Codex CLI 添加 ShardingSphere-MCP:
codex mcp add shardingsphere --url http://127.0.0.1:18088/mcp
查看是否添加成功:
codex mcp list
也可以直接写入 ~/.codex/config.toml:
[mcp_servers.shardingsphere]
url = "http://127.0.0.1:18088/mcp"
如果 MCP Server 地址不是默认值,请把 URL 替换为实际地址。
识别成功:
codex mcp list,确认 shardingsphere 已出现在 MCP Server 列表中。调用成功:
<logic-database> 中有哪些表。orders 表的列和索引。database_gateway_validate_runtime_database。STDIO 进程拉起模式。