Skip to content

Releases: modelcontextprotocol/java-sdk

v0.17.2

22 Jan 13:05

Choose a tag to compare

This release:

  • Addresses mostly the testing infrastructure issues.
  • Fixes a client-side issue with servers that process client-initiated notifications with a 202 Accepted HTTP Header.

Full Changelog: v0.17.1...v0.17.2

v0.17.1

08 Jan 20:29

Choose a tag to compare

Bug fix release:

Full Changelog: v0.17.0...v0.17.1

v0.17.0

04 Dec 14:56

Choose a tag to compare

What's Changed

  • Fix experimental client capabilities tests by @Kehrlann in #670
  • Fix typo in test name by @mingo1996 in #661
  • Client transports: make #protocolVersions() configurable by @Kehrlann in #669
  • chore: Spring 5 compatibility by @He-Pin in #649
  • Fix the baseUrl is configured with a trailing slash #645 by @leehaut in #646
  • WebMvcSseServerTransportProvider: do not include session ID in SSE event by @Kehrlann in #677
  • refactor: use builder pattern for CallToolResult and simplify lambda expressions in tests by @codeboyzhou in #652
  • Basic version negotiation capabilities by @Kehrlann in #684
  • Revert "WebClientStreamableHttpTransport: use Spring-5 compatible met…hods (#649)" by @tzolov in #696

New Contributors

Full Changelog: v0.16.0...v0.17.0

v0.16.0

12 Nov 15:18

Choose a tag to compare

What's Changed

  • feat: enhance error handling with custom error code preservation by @tzolov in #653
  • Bump json-schema-validator from 1.5.7 to 2.0.0 by @uarlouski in #660
  • fix: JSONRPCResponse JavaDoc by @vorburger in #657
  • fix(docs): Remove broken @see link in McpServer.java Javadoc by @hbsjz-swl in #614
  • feat(schema): support Object type for progressToken by @tzolov in #663

New Contributors

Full Changelog: v0.15.0...v0.16.0

v0.15.0

30 Oct 18:04

Choose a tag to compare

What's Changed

  • define explicitely that values should always be included in code completions by @sdelamo in #601
  • fix remove name when using @JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION) by @sdelamo in #600
  • refactor: change int to Integer for optional numeric fields by @tzolov in #604
  • fix: allow additional properties by default per JSON Schema spec by @tzolov in #617
  • Close McpTransportSession on transport close by @Kehrlann in #632
  • Fix: McpAsyncClient#listTools prevent infinite recursion by @leehaut in #631
  • chore: standardize client/server implementation names and version by @tzolov in #642
  • Update dependencies minor versions to fix build on JDK 25 by @bedrin in #640
  • Support o.s.h.HttpHeaders from both 6.x and 7.x Spring branches by @bedrin in #639

New Contributors

Full Changelog: v0.14.1...v0.15.0

v0.14.1

06 Oct 23:20

Choose a tag to compare

Full Changelog: v0.14.0...v0.14.1

v0.14.0

01 Oct 23:14

Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v0.13.1...v0.14.0

v0.13.1

22 Sep 15:47

Choose a tag to compare

Full Changelog: v0.13.0...v0.13.1

v0.13.0

18 Sep 19:33

Choose a tag to compare

Release Notes

🚀 Major Features & Enhancements

Protocol Version Support

  • Added MCP protocol version 2025-06-18 support for streamable-http and stateless transports (#558)
    • Set MCP_2025_06_18 as upper supported protocol version
    • Updated LATEST_PROTOCOL_VERSION constant to reflect new upper bound

Module Restructuring

  • Extracted mcp-core module (#557) - ⚠️ BREAKING CHANGE

    • Created new mcp-core module free of Jackson dependencies
    • mcp module now serves as an umbrella module bringing together mcp-json-jackson2 and mcp-core
    • Classes are now in different JARs, which may affect classpath dependencies
  • Jackson decoupling (#543) - Related to (#557)

    • Abstract away Jackson usage with SPI interfaces
      Creates two modules, mcp-json and mcp-json-jackson. It removes the com.fasterxml.jackson.core:jackson-databind and com.networknt:json-schema-validator dependencies from the mcp (now mcp-core) module. The mcp-core (mcp previously) module now only depends on com.fasterxml.jackson.core:jackson-annotations.
      To use Jackson, you have to add mcp-jackson to your dependencies in addition to mcp-core. I added the dependency mcp-jackson to both mcp-spring-mvc and mcp-spring-webflux to avoid a breaking change in those modules.

Enhanced Tool Output Support

  • Support for array-type structured content in tools (#551) - ⚠️ BREAKING CHANGE
    • Changed CallToolResult.structuredContent type from Map<String,Object> to Object
    • Now supports both objects and arrays as structured content output
    • Updated JsonSchemaValidator to validate any Object type
    • Deprecated CallToolResult constructors in favor of builder pattern
    • Aligns with MCP specification requirements for array-type output schemas

🐛 Bug Fixes

Session Management

  • Fixed LifecycleInitializer error recovery (#549)
    • Initializer can now recover from errors during doInitialize (e.g., HTTP errors)
    • Prevents getting stuck in error state and allows subsequent initialization calls to work
    • Particularly beneficial for OAuth2 token fetch scenarios

Serialization Improvements

  • Added JsonInclude annotation to notification records (#552)
    • Enhanced proper JSON serialization for ResourcesUpdatedNotification and LoggingMessageNotification
    • Excludes absent (null/Optional.empty()) fields from serialized output
    • Ensures consistent serialization behavior across all notification types

Test Infrastructure

  • Standardized test parameterization (#556)
    • Replaced @valuesource with @MethodSource for parameterized tests
    • Added consistent clientsForTesting() methods
    • Removed hardcoded Spring-related labels from framework-agnostic mcp-test module
    • Minor breaking change: moved utility classes from io.modelcontextprotocol.utils to io.modelcontextprotocol.util

⚠️ Breaking Changes Summary

  1. Module Structure Changes (#557 and #543))

    • Classes previously in mcp are now in mcp-core. mcp module now serves as an umbrella module bringing together mcp-json-jackson2 and mcp-core.
    • May require classpath adjustments
  2. Tool Result API Changes (#551)

    • CallToolResult.structuredContent() now returns Object instead of Map<String,Object>
    • Requires explicit casting when accessing map-like content: ((Map<String,Object>) result.structuredContent()).get("key")
    • Deprecated constructors - use builder pattern instead
    • Custom JsonSchemaValidator implementations need signature updates
  3. Package Name Changes (#556)

    • Utility classes moved from io.modelcontextprotocol.utils to io.modelcontextprotocol.util

📝 Migration Guide

For Tool Result Changes

// Before
result.structuredContent().get("key")

// After  
((Map<String,Object>) result.structuredContent()).get("key")

// Use builder pattern instead of deprecated constructors
CallToolResult.builder()
  .content(content)
  .isError(isError)
  .structuredContent(structuredContent)
  .build()

For Module Dependencies

Ensure your dependencies account for the new module structure:

  • mcp-core for Jackson-free core functionality
  • mcp continues to work as umbrella module with Jackson support

New Contributors

Full Changelog: v0.12.1...v0.13.0

v0.12.1

08 Sep 13:46

Choose a tag to compare

Release Notes

  • Skip structured output validation for error tool results (#540) - ensures that when a tool handler returns an error result, the structured
    output schema validation is skipped, preventing validation failures on error responses that don't conform to the expected output schema.
  • Add null check for response ID to prevent memory leaks (#509) - The missing null check could lead to memory leaks as pending requests
    would never be completed when responses lack session IDs. This fix ensures proper handling of such cases with appropriate error logging.

Full Changelog: v0.12.0...v0.12.1