This page shows how to build ShardingSphere-MCP from source, connect it to a user-prepared ShardingSphere-Proxy logical database, and verify basic database tasks through natural language in an AI application.
JAVA_HOME or PATH.Run the following command from the repository root:
./mvnw -pl distribution/mcp -am -DskipTests package
Enter the distribution directory:
cd distribution/mcp/target/apache-shardingsphere-mcp-${version}
Expected result:
bin/, conf/, and lib/.${version} with the built distribution version, such as 5.5.4-SNAPSHOT.Edit conf/mcp-http.yaml and point runtimeDatabases to an existing ShardingSphere-Proxy logical database:
runtimeDatabases:
"<logic-database>":
databaseType: MySQL
jdbcUrl: "jdbc:mysql://<proxy-host>:<proxy-port>/<logic-database>"
username: "<proxy-username>"
password: "<proxy-password>"
driverClassName: "com.mysql.cj.jdbc.Driver"
Replace <logic-database>, <proxy-host>, <proxy-port>, <proxy-username>, and <proxy-password> with the actual ShardingSphere-Proxy connection information.
If the target database driver is not provided with the distribution, put the corresponding JDBC driver jar under plugins/ before startup.
Unix-like systems:
bin/start.sh > logs/mcp-http.log 2>&1 &
Windows:
start "ShardingSphere MCP" cmd /c "bin\start.bat > logs\mcp-http.log 2>&1"
The default configuration file is conf/mcp-http.yaml, and the default endpoint is http://127.0.0.1:18088/mcp.
Choose an MCP-capable AI application, IDE extension, or agent platform, and configure the HTTP MCP Server address started in the previous step.
Typical client configuration examples:
For other clients, follow their own documentation and use the ShardingSphere-MCP address: http://127.0.0.1:18088/mcp.
After configuration, enter the following tasks in the AI application to verify that ShardingSphere-MCP can access the target logical database:
<logic-database>.”<table-name>.”<table-name>.”If the application returns the logical database, table structure, or query results, the MCP Server can access the target ShardingSphere-Proxy logical database through the AI application. For deployment choices, health checks, and basic observability entrypoints, see Deployment. If the AI application cannot connect or cannot see the logical database, see Troubleshooting.
