Client integration connects this controlled database access path to desktop clients, IDE extensions, agent platforms, or custom LLM applications. After integration, the model does not connect to the database directly. It calls the resources, tools, prompts, and completion capabilities exposed by ShardingSphere-MCP through an MCP client. It is not a replacement for the curl-based smoke test in Quick Start, and it is not a guide for users to hand-write JSON-RPC. The client manages connection configuration, session headers, completion, and call orchestration. Users only need to describe the metadata lookup, read-only SQL query, or database governance task they want to complete.
Use client integration when:
See Capability Catalog for the full list of resources, tools, prompts, and completion targets.
Add the following snippet to the MCP client’s server configuration. The exact file location depends on the client.
url points to an already running HTTP MCP Server.
{
"mcpServers": {
"shardingsphere-http": {
"url": "http://127.0.0.1:18088/mcp"
}
}
}
An HTTP client must complete the session lifecycle before normal MCP calls:
initialize.MCP-Session-Id and MCP-Protocol-Version response headers.notifications/initialized with both response headers and expect HTTP status code 202.After the session is closed, the session id cannot be reused.
Add the following snippet to the MCP client’s server configuration. The exact file location depends on the client.
command points to the packaged startup script, and args points to the STDIO configuration file.
{
"mcpServers": {
"shardingsphere": {
"command": "/path/to/apache-shardingsphere-mcp/bin/start.sh",
"args": ["/path/to/apache-shardingsphere-mcp/conf/mcp-stdio.yaml"]
}
}
}
STDIO mode is for local MCP clients that launch ShardingSphere-MCP as a child process.
It is not a human-oriented interactive shell.
Replace /path/to/apache-shardingsphere-mcp with the actual distribution directory.
In STDIO mode:
logs/mcp.log.command and args in the client configuration should point to the packaged startup script and STDIO config file.When using an existing MCP client or agent platform, users usually describe tasks in natural language, such as “show tables in the logical database” or “inspect columns in the orders table”. The client sends MCP protocol requests automatically based on the model’s choices. Users do not paste the following JSON into a model chat. The examples below show protocol messages sent behind the scenes, and are useful for client development, integration debugging, or troubleshooting.
Read runtime status:
{"jsonrpc":"2.0","id":"runtime-1","method":"resources/read","params":{"uri":"shardingsphere://runtime"}}
Read the capability catalog:
{"jsonrpc":"2.0","id":"capabilities-1","method":"resources/read","params":{"uri":"shardingsphere://capabilities"}}
Search metadata:
{
"jsonrpc": "2.0",
"id": "search-1",
"method": "tools/call",
"params": {
"name": "database_gateway_search_metadata",
"arguments": {
"database": "<logic-database>",
"query": "<metadata-keyword>",
"object_types": ["table"]
}
}
}
Execute read-only SQL:
{
"jsonrpc": "2.0",
"id": "query-1",
"method": "tools/call",
"params": {
"name": "database_gateway_execute_query",
"arguments": {
"database": "<logic-database>",
"sql": "SELECT * FROM <table-name> LIMIT 100",
"max_rows": 100
}
}
}
