Implement conformance testing modules with comprehensive client/server test scenarios,
sync conversion for client/servlet code, CI integration, and documentation updates.
---------
Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
This is a follow-up to #742.
The `mcp-test`, `mcp-spring-webflux`, and `mcp-spring-webmvc` depended
on `mcp` module which transitively brought in Jackson 3 dependencies.
These modules are now decoupled and only depend on `mcp-core`.
The test dependencies bring in Jackson 2 for the time being.
This is a breaking change but it is required to allow easily exchanging
Jackson2 and Jackson3 modules.
Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
This change adds Jackson 3 support and aligns package naming in the existing Jackson 2 module.
Specific changes:
* Deprecated classes for removal in `io.modelcontextprotocol.json.jackson`/`io.modelcontextprotocol.json.schema.jackson`
* Copied the above to `io.modelcontextprotocol.json.jackson2`/`io.modelcontextprotocol.json.schema.jackson2` in non-deprecated form.
* Added tests for the default McpJsonMapper and JsonSchemaValidator
* Pin `npx @modelcontextprotocol/server-everything` version to `2025.12.18`.
* Replace `tzolov/mcp-everything-server` Docker image with `node:lts-alpine` + `npx` command.
* Handle HTTP 202 special case.
* Fix test assertions.
The recent rollout of everything-server broke integration tests which take the latest version from the node registry.
This PR unifies the everything-server usage - the Testcontainers Docker setup uses the same version as the STDIO npx-based tests and no longer relies on tzolov/mcp-everything-server.
Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
Update the ClientCapabilities.Elicitation record to accept optional "form"
and "url" fields as defined in the MCP 2025-11-25 specification.
Previously, deserializing an InitializeRequest with
`{"capabilities":{"elicitation":{"form":{}}}}` would fail with
UnrecognizedPropertyException because the Elicitation record was empty.
Changes:
- Add nested Form and Url marker records to Elicitation
- Add no-arg constructor for backward compatibility (serializes to {})
- Add elicitation(boolean form, boolean url) builder method
- Add comprehensive tests for deserialization and serialization
Fixes#724
- We do not support full version negotiation, but this commit allows the
client to the send the correct version to match that of the server.
- There is one limitation: the GET /mcp request happens too early,
before we have deserialized the initialization response, so we do not
know the negotiated version yet. This request will have the client
latest version as Mcp-Protocol-Version value.
Signed-off-by: Daniel Garnier-Moiroux <git@garnier.wf>
Change progressToken from String to Object throughout McpSchema
to allow both String and Number token types.
This makes it compliant with the MCP spec.
Resolves: #659
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
- Improve McpClientSession error handling to preserve custom error codes
and data from McpError instances.
- Add aggregated exception messages to error data field for better debugging.
- Include test coverage for various McpClientSession error scenarios.
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
Unifies client/server implementation names under "Java SDK" branding
and updates all versions to 0.15.0.
Resolves: #638
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
- Remove automatic additionalProperties: false injection (JSON Schema spec compliance)
- Support String input for structuredContent in validate() method
- Move tests to mcp-json-jackson2 module with proper dependencies
- Replace wildcard imports with explicit imports
Complies with JSON Schema Test Suite:
15e4505/tests/draft2020-12/additionalProperties.json\#L112
Fixes#584
BREAKING CHANGE: Additional properties now allowed by default when not explicitly specified.
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
- Enhanced DefaultMcpUriTemplateManager to use Pattern.quote() for escaping special regex characters like '?'
- Replaced simple string replacement regex generation with robust pattern building
- Added test case to verify URI matching with query parameters (e.g., "file://name/search?={search}")
- Fixed typo: renamed DeafaultMcpUriTemplateManagerFactory to DefaultMcpUriTemplateManagerFactory
- Updated all references across server classes and tests
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
Convert primitive int types to Integer wrapper class for:
- JSONRPCError.code
- CreateMessageRequest.maxTokens (including constructor and builder)
This allows these fields to be nullable, properly representing
optional parameters in the MCP protocol schema.
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
This pull-request removes the name member from the @JsonSubTypes.Type annotations when using JsonTypeInfo.Id.DEDUCTION.
With DEDUCTION, Jackson ignores the name entirely because it's inferring the type from the structure.
Ensure warnings are logged for all non-compliant responses to JSON-RPC
notifications, including empty responses. Empty responses now display
as "[empty]" in log messages for better clarity.
Resolves#586
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
- When the client sends `notification/initalized`, servers must respond
with HTTP 202 and an empty body. We checked for the absence of a
Content-Type header to verify whether the body was empty.
- However, some servers will send an empty body with a Content-Type
header, and that header may have an unsupported, default type such as
`text/html` or `text/plain`.
- Now we we also use the Content-Length header to check for an empty
body. This header is optional in HTTP/2, so we do not make it our
primary mechanism for detecting empty bodies.
- As part of this PR, we also move hard-coded HTTP header names to the
HttpHeaders interface. While they are not defined by the MCP spec,
they are used by it and are core to implementing the protocol.
Therefore, they have their place in a core interface.
- Fixes#582
Signed-off-by: Daniel Garnier-Moiroux <git@garnier.wf>
From the JSonTypeInfo Javadocs:
> If deduction is being used annotation properties visible, property and include are ignored.
This is causing issues with serialization downstream.
- Replace McpError with appropriate standard exceptions (IllegalArgumentException, IllegalStateException) for validation errors
- Change tool/prompt registration to replace existing items instead of rejecting duplicates with warningsi
- Change addTool behavior to replace existing tools instead of throwing errors
- Change addPrompt() to allow replacing existing prompts with warning instead of throwing error
- Make removal operations idempotent - log warnings instead of throwing errors for non-existent items
- Change removePrompt() to log warning instead of throwing error for non-existent prompts
- Change removeTool() to gracefully handle non-existent tools with warnings instead of errors
- Add listTools() and listPrompts() methods to all server variants (async, sync, stateless)
- Add listTools() method to all server classes for tool enumeration
- Add listPrompts() method to all server implementations for retrieving registered prompts
- Improve error construction using McpError.builder() pattern for protocol-specific errors
- Update error handling in session classes to properly propagate McpError JSON-RPC errors
- Use proper error codes (INVALID_PARAMS) for prompt not found scenarios
- Update tests to reflect new lenient behavior for duplicate registrations and removals
- Add aggregateExceptionMessages() utility method utility to aggregate the exception chains
- Update McpServerSession and McpStreamableServerSession to use the aggregated errors in the json-rpc-error data section
This change makes the MCP server APIs more resilient and user-friendly by using appropriate exception types,
supporting item replacement, and providing listing capabilities while maintaining backward compatibility.
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
- Provide separation of concerns between static resources and parameterized resource templates.
- Add AsyncResourceTemplateSpecification and SyncResourceTemplateSpecification for both McpServerFeatures and McpStatelessServerFeatures
- Change resource template storage from List to Map to acomodate the resource read handler.
- Add runtime management methods: addResourceTemplate(), removeResourceTemplate(), listResourceTemplates()
- Improve error handling by using IllegalArgumentException/IllegalStateException instead of McpError
- Add new interfaces (Meta, Identifier) and reorganize schema hierarchy
- Enhance completion request validation with better error messages
- Add ResourceTemplate.Builder for easier template construction
- Update all server implementations (Async, Sync, Stateless) consistently
- Add type-safe constants for reference types (PromptReference.TYPE, ResourceReference.TYPE)
- Add tests for new resource template management functionality
- Clean up imports and remove unused dependencies
Co-authored-by: Pascal Vantrepote <pascal@confluent.io>
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>