This chapter describes ShardingSphere-MCP end-to-end contract validation and LLM usability validation.
test/e2e/mcp covers:
The StreamableHttpMCPServerIT in mcp/bootstrap covers HTTP protocol, session, and security boundaries that require neither Docker nor an external service.
When an MCP feature is used as a workflow template, E2E tests should cover protocol discoverability, model usability, and negative contracts. For the Encrypt workflow, template-level acceptance should include at least:
resources_to_read points to feature-owned algorithm, rule, or configuration resources, not physical metadata resources outside the feature.Test reuse should stay in local helpers under test/e2e/mcp; do not add a test jar or a cross-module test-support module for template acceptance.
Build and install the MCP E2E dependencies and distribution:
./mvnw -pl test/e2e/mcp,distribution/mcp -am install -DskipTests -DskipITs -Dspotless.skip=true -B -ntp
Build the local distribution image:
docker build --platform "$(docker version --format '{{.Server.Os}}/{{.Server.Arch}}')" -f distribution/mcp/Dockerfile -t apache/shardingsphere-mcp-e2e:local distribution/mcp/target
The MCP LLM lane uses a local Docker image to host an OpenAI-compatible endpoint. Before building, inspect Docker usage:
docker system df
Check host architecture selection without downloading the model:
sh test/e2e/mcp/src/test/resources/docker/llm-runtime/build-local.sh --dry-run
Build the local runtime image:
sh test/e2e/mcp/src/test/resources/docker/llm-runtime/build-local.sh
MCP E2E runtime configuration is centralized in test/e2e/mcp/src/test/resources/env/e2e-env.properties.
For local runs, edit that file or override the same keys with -D system properties.
./mvnw -pl test/e2e/mcp test -Pe2e.mcp
This test starts the real HTTP server without connecting to Docker, a database, or a model:
./mvnw -pl mcp/bootstrap verify
./mvnw -pl test/e2e/mcp test -Pe2e.mcp.llm -Dtest=LLMUsabilitySuiteE2ETest
The evaluation loads ten independent read-only questions from llm/evaluation/mcp-builder-evaluation.xml.
Each question starts a fresh MCP session, derives model function definitions from the live tools/list response, preserves raw model responses and structured MCP responses, and compares the final answer exactly without correction prompts or expected-answer injection.
Score-closing runs use an explicit 32768-token context window. Missing Docker, model, database, or MCP infrastructure fails the selected llm-e2e lane instead of converting a score failure into a skipped case.
./mvnw -pl test/e2e/mcp test -Pe2e.mcp.llm -Dtest=MCPBuilderEvaluationE2ETest
The CI conformance lane pins modelcontextprotocol/conformance to commit 21a9a2febd7100d7c17ac1021ee7f2ed9f66a1e0, passes protocol version 2025-11-25, and executes only the applicable generic server scenarios declared in the workflow.
Upstream calls tied to fixed test_* tools or resources, unadvertised optional capabilities, and scenarios outside the fixed HTTP transport surface do not apply to this project. Product capabilities remain covered by deterministic E2E tests, and no production test hooks are added for upstream fixtures.
The packaged server runs with its loopback HTTP configuration so the DNS rebinding scenario validates the loopback Origin policy rather than the separate Docker remote-binding policy.
For local debugging only, connect to an already running OpenAI-compatible endpoint:
./mvnw -pl test/e2e/mcp test -Pe2e.mcp.llm -Dtest=LLMUsabilitySuiteE2ETest -Dmcp.llm.runtime-mode=external-debug -Dmcp.llm.base-url=http://127.0.0.1:8080/v1
External debug endpoints cannot be used as score-closing evidence.
LLM usability and MCP Builder evaluation artifacts are written under:
test/e2e/mcp/target/llm-e2e/
Each autonomous evaluation case records the question, expected and actual answer, raw model response, MCP interaction trace, live tool definitions, runtime evidence, and assertion report. Artifact writing redacts secret-shaped values, and scoring runs fail if an unredacted secret pattern or the known model API key is present.
GitHub Actions entry points:
.github/workflows/e2e-mcp.ymlThis workflow is the mandatory MCP runtime E2E entry point.
If a very large PR misses a path-filter match, use workflow_dispatch to add manual evidence.
