Protocol Surface
The public surface of ShardingSphere-MCP is defined by descriptors under META-INF/shardingsphere-mcp/mcp-descriptors.
The MCP runtime uses these descriptors to publish tools, resources, resource templates, prompts, and completions.
Protocol capabilities
ShardingSphere-MCP uses MCP Java SDK 1.1.2 and exposes only MCP protocol revision 2025-11-25.
The SDK and protocol revision are fixed compatibility boundaries for this implementation, not dependency-upgrade or multi-version compatibility targets.
Enabled:
resources/listresources/templates/listresources/readtools/listtools/callprompts/listprompts/getcompletion/complete
Not implemented or future scope:
- Resource subscriptions.
- Resource, tool, and prompt list-changed notifications.
- ShardingSphere product logs through
notifications/message. progress.notifications/cancelled.- Task-augmented requests.
Tool.execution, which is not exposed through the fixed MCP Java SDK1.1.2boundary.
MCP icons are an intentional non-goal because this server has no product scenario that consumes them.
roots and sampling are client capabilities.
ShardingSphere-MCP does not require roots and does not send sampling/createMessage requests.
Tools
database_gateway_search_metadata
- Searches logical database metadata.
- Narrows scope by
database,schema,query, andobject_types, then returns a deterministically ordered page selected byoffsetandlimit. object_typessupportsdatabase,schema,storage_unit,table,view,column,index, andsequence.limitdefaults to100and supports1..100;offsetdefaults to0. Whenhas_more=true, continue with the returnednext_offsetand the same search scope.
database_gateway_validate_runtime_database
- Validates a configured runtime database before formal onboarding.
- Required input is
database. - Uses the administrator-configured runtime database connection details; JDBC URL, username, password, and driver class are not tool inputs.
- Returns
status, orderedchecks, overallcategory, and a structuredrecoveryobject. - Common failure categories include
missing_jdbc_driver,authentication_failed,authorization_failed,connection_timeout,invalid_configuration,database_unavailable,connection_failed, anddatabase_not_visible.
database_gateway_execute_query
- Executes one classifier-approved
SELECT. - Rejects DML, DDL, DCL, transaction control, savepoints, and known side-effecting query forms.
max_rowsrange is0..5000; omitted or0uses the server default100.timeout_msrange is0..300000;0means no explicit timeout.
database_gateway_execute_explain_query
- Executes one model-generated database-native
EXPLAINfor one classifier-approvedSELECT. - Requires the original
SELECTassqland the generatedEXPLAINasexplain_sql. - Rejects
EXPLAIN ANALYZE,EXPLAIN PLAN FOR, multiple statements, and side-effecting SQL. max_rowsrange is0..5000; omitted or0uses the server default100.timeout_msrange is0..300000;0means no explicit timeout.
database_gateway_execute_update
- Previews or executes one supported side-effecting SQL statement.
execution_mode=previewonly classifies the SQL and previews the side-effect scope; it is not a database dry run.execution_mode=executeexecutes the SQL after review.- Multiple statements and banned commands are rejected.
database_gateway_apply_workflow
- Previews, executes, or exports an existing workflow plan in the current session.
execution_modesupportspreview,review-then-execute, andmanual-only.approved_stepsmust use approval steps returned by preview.
database_gateway_validate_workflow
- Validates an existing workflow plan in the current session.
- Use after planning review or after apply to confirm runtime state.
Feature plugin planning tools:
database_gateway_plan_encrypt_ruledatabase_gateway_plan_mask_ruledatabase_gateway_plan_broadcast_ruledatabase_gateway_plan_readwrite_splitting_ruledatabase_gateway_plan_readwrite_splitting_statusdatabase_gateway_plan_shadow_ruledatabase_gateway_plan_default_shadow_algorithmdatabase_gateway_plan_shadow_algorithm_cleanupdatabase_gateway_plan_sharding_table_ruledatabase_gateway_plan_sharding_table_reference_ruledatabase_gateway_plan_sharding_default_strategydatabase_gateway_plan_sharding_key_generatordatabase_gateway_plan_sharding_key_generate_strategydatabase_gateway_plan_sharding_rule_component_cleanup
Resources
Runtime and capability:
shardingsphere://capabilitiesshardingsphere://runtimeshardingsphere://databasesshardingsphere://databases/{database}shardingsphere://databases/{database}/capabilitiesshardingsphere://databases/{database}/storage-unitsshardingsphere://databases/{database}/storage-units/{storageUnit}shardingsphere://databases/{database}/storage-units/{storageUnit}/used-by-rulesshardingsphere://databases/{database}/single-tablesshardingsphere://databases/{database}/single-tables/{table}shardingsphere://databases/{database}/single-table/default-storage-unit
Metadata:
shardingsphere://databases/{database}/schemasshardingsphere://databases/{database}/schemas/{schema}shardingsphere://databases/{database}/schemas/{schema}/tablesshardingsphere://databases/{database}/schemas/{schema}/tables/{table}shardingsphere://databases/{database}/schemas/{schema}/tables/{table}/columnsshardingsphere://databases/{database}/schemas/{schema}/tables/{table}/columns/{column}shardingsphere://databases/{database}/schemas/{schema}/tables/{table}/indexesshardingsphere://databases/{database}/schemas/{schema}/tables/{table}/indexes/{index}shardingsphere://databases/{database}/schemas/{schema}/viewsshardingsphere://databases/{database}/schemas/{schema}/views/{view}shardingsphere://databases/{database}/schemas/{schema}/views/{view}/columnsshardingsphere://databases/{database}/schemas/{schema}/views/{view}/columns/{column}shardingsphere://databases/{database}/schemas/{schema}/sequencesshardingsphere://databases/{database}/schemas/{schema}/sequences/{sequence}
Workflow:
shardingsphere://workflows/{plan_id}
Feature resources:
shardingsphere://features/encrypt/algorithmsshardingsphere://features/encrypt/databases/{database}/rulesshardingsphere://features/encrypt/databases/{database}/tables/{table}/rulesshardingsphere://features/mask/algorithmsshardingsphere://features/mask/databases/{database}/rulesshardingsphere://features/mask/databases/{database}/tables/{table}/rulesshardingsphere://features/broadcast/databases/{database}/rulesshardingsphere://features/broadcast/databases/{database}/tables/{table}/ruleshardingsphere://features/broadcast/databases/{database}/rule-countshardingsphere://features/readwrite-splitting/load-balance-algorithm-pluginsshardingsphere://features/readwrite-splitting/databases/{database}/rulesshardingsphere://features/readwrite-splitting/databases/{database}/rules/{rule}shardingsphere://features/readwrite-splitting/databases/{database}/statusshardingsphere://features/readwrite-splitting/databases/{database}/rules/{rule}/statusshardingsphere://features/readwrite-splitting/databases/{database}/rule-countshardingsphere://features/shadow/algorithm-pluginsshardingsphere://features/shadow/databases/{database}/rulesshardingsphere://features/shadow/databases/{database}/rules/{rule}shardingsphere://features/shadow/databases/{database}/table-rulesshardingsphere://features/shadow/databases/{database}/tables/{table}/rulesshardingsphere://features/shadow/databases/{database}/algorithmsshardingsphere://features/shadow/databases/{database}/default-algorithmshardingsphere://features/shadow/databases/{database}/rule-countshardingsphere://features/sharding/algorithm-pluginsshardingsphere://features/sharding/key-generate-algorithm-pluginsshardingsphere://features/sharding/databases/{database}/algorithmsshardingsphere://features/sharding/databases/{database}/table-rulesshardingsphere://features/sharding/databases/{database}/tables/{table}/table-ruleshardingsphere://features/sharding/databases/{database}/table-nodesshardingsphere://features/sharding/databases/{database}/tables/{table}/nodesshardingsphere://features/sharding/databases/{database}/table-reference-rulesshardingsphere://features/sharding/databases/{database}/table-reference-rules/{rule}shardingsphere://features/sharding/databases/{database}/default-strategyshardingsphere://features/sharding/databases/{database}/key-generatorsshardingsphere://features/sharding/databases/{database}/key-generators/{keyGenerator}shardingsphere://features/sharding/databases/{database}/key-generate-strategiesshardingsphere://features/sharding/databases/{database}/key-generate-strategies/{strategy}shardingsphere://features/sharding/databases/{database}/auditorsshardingsphere://features/sharding/databases/{database}/unused-algorithmsshardingsphere://features/sharding/databases/{database}/unused-key-generatorsshardingsphere://features/sharding/databases/{database}/unused-auditorsshardingsphere://features/sharding/databases/{database}/algorithms/{algorithm}/table-rulesshardingsphere://features/sharding/databases/{database}/key-generators/{keyGenerator}/table-rulesshardingsphere://features/sharding/databases/{database}/auditors/{auditor}/table-rulesshardingsphere://features/sharding/databases/{database}/rule-count
Prompts
inspect_metadata: guides the model to read metadata and avoid SQL execution when the user only asks for metadata.safe_sql_execution: guides the model to distinguish read-only query from side-effecting SQL.recover_workflow: guides recovery from failed or stale workflows.plan_encrypt_rule: guides Encrypt feature workflow planning.plan_mask_rule: guides Mask feature workflow planning.plan_broadcast_rule: guides Broadcast feature workflow planning.plan_readwrite_splitting_rule: guides Readwrite-Splitting rule workflow planning.plan_readwrite_splitting_status: guides Readwrite-Splitting status workflow planning.plan_shadow_rule: guides Shadow rule workflow planning.plan_default_shadow_algorithm: guides default Shadow algorithm workflow planning.plan_shadow_algorithm_cleanup: guides unused Shadow algorithm cleanup workflow planning.plan_sharding_table_rule: guides Sharding table rule workflow planning.plan_sharding_table_reference_rule: guides Sharding table reference rule workflow planning.plan_sharding_default_strategy: guides default Sharding strategy workflow planning.plan_sharding_key_generator: guides Sharding key generator workflow planning.plan_sharding_key_generate_strategy: guides Sharding key generate strategy workflow planning.plan_sharding_rule_component_cleanup: guides unused Sharding algorithm, key generator, or auditor cleanup workflow planning.
Completions
Completions suggest runtime names, metadata identifiers, algorithms, and workflow plan_id values in the current session.
Before choosing uncertain database, schema, table, column, storage unit, algorithm, or plan_id values, clients should call completion/complete or read the nearest MCP resource.
When a completion response includes meta next_actions, clients should follow those actions before guessing a value or switching to another tool.
Use resources/templates/list to discover URI variables for the nearest resource before retrying completion with additional context.
Responses and recovery
List-shaped business payloads usually contain:
itemscountcontinuation_modehas_moreandnext_offsetwhen offset continuation is available
Large-result payloads use:
truncatedtotal_countlarge_result_guidance
Recoverable error payloads use summary, error_id, and structured recovery hints.
Common recovery cases include missing arguments, unsupported tools or resources, invalid enum values, workflow state errors, and unsafe SQL tool selection.
Model-facing business payloads that require continuation include a top-level summary and canonical top-level next_actions.
Workflow planning, apply, manual-only export, and validation responses use these fields to guide the next tool call, user question, resource read, completion call, or terminal stop.
JSON-RPC numeric error codes are the MCP protocol error contract.