This module contains a comprehensive MCP (Model Context Protocol) server implementation for conformance testing using the servlet stack with an embedded Tomcat server and streamable HTTP transport.
Status: 40 out of 40 tests passing (100%)
The server has been validated against the official MCP conformance test suite. See VALIDATION_RESULTS.md for detailed results.
✅ Lifecycle & Utilities (4/4)
- Server initialization, ping, logging, completion
✅ Tools (11/11)
- Text, image, audio, embedded resources, mixed content
- Logging, error handling, sampling, elicitation
- Progress notifications
✅ Elicitation (10/10)
- SEP-1034: Default values for all primitive types
- SEP-1330: All enum schema variants
✅ Resources (6/6)
- List, read text/binary, templates, subscribe, unsubscribe
✅ Prompts (4/4)
- Simple, parameterized, embedded resources, images
✅ SSE Transport (2/2)
- Multiple streams support
✅ Security (2/2)
- ✅ DNS rebinding protection
- Embedded Tomcat servlet container
- MCP server using HttpServletStreamableServerTransportProvider
- Comprehensive test coverage with 15+ tools
- Streamable HTTP transport with SSE on
/mcpendpoint - Support for all MCP content types (text, image, audio, resources)
- Advanced features: sampling, elicitation, progress (partial), completion
To run the conformance server:
cd conformance-tests/server-servlet
../../mvnw compile exec:java -Dexec.mainClass="io.modelcontextprotocol.conformance.server.ConformanceServlet"Or from the root directory:
./mvnw compile exec:java -pl conformance-tests/server-servlet -Dexec.mainClass="io.modelcontextprotocol.conformance.server.ConformanceServlet"The server will start on port 8080 with the MCP endpoint at /mcp.
Once the server is running, you can validate it against the official MCP conformance test suite using npx:
npx @modelcontextprotocol/conformance server --url http://localhost:8080/mcp --suite active# Test tools
npx @modelcontextprotocol/conformance server --url http://localhost:8080/mcp --scenario tools-list --verbose
# Test prompts
npx @modelcontextprotocol/conformance server --url http://localhost:8080/mcp --scenario prompts-list --verbose
# Test resources
npx @modelcontextprotocol/conformance server --url http://localhost:8080/mcp --scenario resources-read-text --verbose
# Test elicitation with defaults
npx @modelcontextprotocol/conformance server --url http://localhost:8080/mcp --scenario elicitation-sep1034-defaults --verboseactive(default) - All active/stable tests (30 scenarios)all- All tests including pending/experimentalpending- Only pending/experimental tests
Lifecycle & Utilities:
server-initialize- Server initializationping- Ping utilitylogging-set-level- Logging configurationcompletion-complete- Argument completion
Tools:
tools-list- List available toolstools-call-simple-text- Simple text responsetools-call-image- Image contenttools-call-audio- Audio contenttools-call-with-logging- Logging during executiontools-call-with-progress- Progress notificationstools-call-sampling- LLM samplingtools-call-elicitation- User input requests
Resources:
resources-list- List resourcesresources-read-text- Read text resourceresources-read-binary- Read binary resourceresources-templates-read- Resource templatesresources-subscribe- Subscribe to resource updatesresources-unsubscribe- Unsubscribe from updates
Prompts:
prompts-list- List promptsprompts-get-simple- Simple promptprompts-get-with-args- Parameterized promptprompts-get-embedded-resource- Prompt with resourceprompts-get-with-image- Prompt with image
Elicitation:
elicitation-sep1034-defaults- Default values (SEP-1034)elicitation-sep1330-enums- Enum schemas (SEP-1330)
You can also test the endpoint manually:
# Check endpoint (will show SSE requirement)
curl -X GET http://localhost:8080/mcp
# Initialize session with proper headers
curl -X POST http://localhost:8080/mcp \
-H "Content-Type: application/json" \
-H "Accept: text/event-stream" \
-H "mcp-session-id: test-session-123" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test-client","version":"1.0.0"}}}'- Transport: HttpServletStreamableServerTransportProvider (streamable HTTP with SSE)
- Container: Embedded Apache Tomcat
- Protocol: Streamable HTTP with Server-Sent Events
- Port: 8080 (default)
- Endpoint:
/mcp - Request Timeout: 30 seconds
test_simple_text- Returns simple text contenttest_image_content- Returns a minimal PNG image (1x1 red pixel)test_audio_content- Returns a minimal WAV audio filetest_embedded_resource- Returns embedded resource contenttest_multiple_content_types- Returns mixed text, image, and resource content
test_tool_with_logging- Sends log notifications during executiontest_error_handling- Intentionally returns an error for testingtest_tool_with_progress- Reports progress notifications (⚠️ SDK issue)
test_sampling- Requests LLM sampling from clienttest_elicitation- Requests user input from clienttest_elicitation_sep1034_defaults- Elicitation with default values (SEP-1034)test_elicitation_sep1330_enums- Elicitation with enum schemas (SEP-1330)
test_simple_prompt- Simple prompt without argumentstest_prompt_with_arguments- Prompt with required arguments (arg1, arg2)test_prompt_with_embedded_resource- Prompt with embedded resource contenttest_prompt_with_image- Prompt with image content
test://static-text- Static text resourcetest://static-binary- Static binary resource (PNG image)test://watched-resource- Resource that can be subscribed totest://template/{id}/data- Resource template with parameter substitution
See VALIDATION_RESULTS.md for details on remaining client-side limitations.