Refine McpJsonDefaults method names (#789)

As a follow-up of #779, this commit refines McpJsonDefaults
method names by shortening them to not repeat the qualifiers
already expressed at type level.
This commit is contained in:
Sébastien Deleuze 2026-02-13 16:54:01 +01:00 • committed by GitHub
commit e60a0743a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
31 changed files with 94 additions and 108 deletions

View file

@ -492,12 +492,9 @@ public interface McpClient {
McpClientFeatures.Async asyncFeatures = McpClientFeatures.Async.fromSync(syncFeatures); McpClientFeatures.Async asyncFeatures = McpClientFeatures.Async.fromSync(syncFeatures);
return new McpSyncClient( return new McpSyncClient(new McpAsyncClient(transport, this.requestTimeout, this.initializationTimeout,
new McpAsyncClient(transport, this.requestTimeout, this.initializationTimeout, jsonSchemaValidator != null ? jsonSchemaValidator : McpJsonDefaults.getSchemaValidator(),
jsonSchemaValidator != null ? jsonSchemaValidator asyncFeatures), this.contextProvider);
: McpJsonDefaults.getDefaultJsonSchemaValidator(),
asyncFeatures),
this.contextProvider);
} }
} }
@ -830,7 +827,7 @@ public interface McpClient {
*/ */
public McpAsyncClient build() { public McpAsyncClient build() {
var jsonSchemaValidator = (this.jsonSchemaValidator != null) ? this.jsonSchemaValidator var jsonSchemaValidator = (this.jsonSchemaValidator != null) ? this.jsonSchemaValidator
: McpJsonDefaults.getDefaultJsonSchemaValidator(); : McpJsonDefaults.getSchemaValidator();
return new McpAsyncClient(this.transport, this.requestTimeout, this.initializationTimeout, return new McpAsyncClient(this.transport, this.requestTimeout, this.initializationTimeout,
jsonSchemaValidator, jsonSchemaValidator,
new McpClientFeatures.Async(this.clientInfo, this.capabilities, this.roots, new McpClientFeatures.Async(this.clientInfo, this.capabilities, this.roots,

View file

@ -328,7 +328,7 @@ public class HttpClientSseClientTransport implements McpClientTransport {
public HttpClientSseClientTransport build() { public HttpClientSseClientTransport build() {
HttpClient httpClient = this.clientBuilder.connectTimeout(this.connectTimeout).build(); HttpClient httpClient = this.clientBuilder.connectTimeout(this.connectTimeout).build();
return new HttpClientSseClientTransport(httpClient, requestBuilder, baseUri, sseEndpoint, return new HttpClientSseClientTransport(httpClient, requestBuilder, baseUri, sseEndpoint,
jsonMapper == null ? McpJsonDefaults.getDefaultMcpJsonMapper() : jsonMapper, httpRequestCustomizer); jsonMapper == null ? McpJsonDefaults.getMapper() : jsonMapper, httpRequestCustomizer);
} }
} }

View file

@ -843,10 +843,9 @@ public class HttpClientStreamableHttpTransport implements McpClientTransport {
*/ */
public HttpClientStreamableHttpTransport build() { public HttpClientStreamableHttpTransport build() {
HttpClient httpClient = this.clientBuilder.connectTimeout(this.connectTimeout).build(); HttpClient httpClient = this.clientBuilder.connectTimeout(this.connectTimeout).build();
return new HttpClientStreamableHttpTransport( return new HttpClientStreamableHttpTransport(jsonMapper == null ? McpJsonDefaults.getMapper() : jsonMapper,
jsonMapper == null ? McpJsonDefaults.getDefaultMcpJsonMapper() : jsonMapper, httpClient, httpClient, requestBuilder, baseUri, endpoint, resumableStreams, openConnectionOnStartup,
requestBuilder, baseUri, endpoint, resumableStreams, openConnectionOnStartup, httpRequestCustomizer, httpRequestCustomizer, supportedProtocolVersions);
supportedProtocolVersions);
} }
} }

View file

@ -8,27 +8,29 @@ import io.modelcontextprotocol.json.schema.JsonSchemaValidatorSupplier;
import io.modelcontextprotocol.util.McpServiceLoader; import io.modelcontextprotocol.util.McpServiceLoader;
/** /**
* This class is to be used to provide access to the default McpJsonMapper and to the * This class is to be used to provide access to the default {@link McpJsonMapper} and to
* default JsonSchemaValidator instances via the static methods: getDefaultMcpJsonMapper * the default {@link JsonSchemaValidator} instances via the static methods:
* and getDefaultJsonSchemaValidator. * {@link #getMapper()} and {@link #getSchemaValidator()}.
* <p> * <p>
* The initialization of (singleton) instances of this class is different in non-OSGi * The initialization of (singleton) instances of this class is different in non-OSGi
* environments and OSGi environments. Specifically, in non-OSGi environments The * environments and OSGi environments. Specifically, in non-OSGi environments the
* McpJsonDefaults class will be loaded by whatever classloader is used to call one of the * {@code McpJsonDefaults} class will be loaded by whatever classloader is used to call
* existing static get methods for the first time. For servers, this will usually be in * one of the existing static get methods for the first time. For servers, this will
* response to the creation of the first McpServer instance. At that first time, the * usually be in response to the creation of the first {@code McpServer} instance. At that
* mcpMapperServiceLoader and mcpValidatorServiceLoader will be null, and the * first time, the {@code mcpMapperServiceLoader} and {@code mcpValidatorServiceLoader}
* McpJsonDefaults constructor will be called, creating/initializing the * will be null, and the {@code McpJsonDefaults} constructor will be called,
* mcpMapperServiceLoader and the mcpValidatorServiceLoader...which will then be used to * creating/initializing the {@code mcpMapperServiceLoader} and the
* call the ServiceLoader.load method. * {@code mcpValidatorServiceLoader}...which will then be used to call the
* {@code ServiceLoader.load} method.
* <p> * <p>
* In OSGi environments, upon bundle activation SCR will create a new (singleton) instance * In OSGi environments, upon bundle activation SCR will create a new (singleton) instance
* of McpJsonDefaults (via the constructor), and then inject suppliers via the * of {@code McpJsonDefaults} (via the constructor), and then inject suppliers via the
* setMcpJsonMapperSupplier and setJsonSchemaValidatorSupplier methods with the * {@code setMcpJsonMapperSupplier} and {@code setJsonSchemaValidatorSupplier} methods
* SCR-discovered instances of those services. This does depend upon the jars/bundles * with the SCR-discovered instances of those services. This does depend upon the
* providing those suppliers to be started/activated. This SCR behavior is dictated by xml * jars/bundles providing those suppliers to be started/activated. This SCR behavior is
* files in OSGi-INF directory of mcp-core (this project/jar/bundle), and the jsonmapper * dictated by xml files in {@code OSGi-INF} directory of {@code mcp-core} (this
* and jsonschemvalidator provider jars/bundles (e.g. mcp-json-jackson2, 3, or others). * project/jar/bundle), and the jsonmapper and jsonschemavalidator provider jars/bundles
* (e.g. {@code mcp-json-jackson2}, {@code mcp-json-jackson3}, or others).
*/ */
public class McpJsonDefaults { public class McpJsonDefaults {
@ -37,10 +39,8 @@ public class McpJsonDefaults {
protected static McpServiceLoader<JsonSchemaValidatorSupplier, JsonSchemaValidator> mcpValidatorServiceLoader; protected static McpServiceLoader<JsonSchemaValidatorSupplier, JsonSchemaValidator> mcpValidatorServiceLoader;
public McpJsonDefaults() { public McpJsonDefaults() {
mcpMapperServiceLoader = new McpServiceLoader<McpJsonMapperSupplier, McpJsonMapper>( mcpMapperServiceLoader = new McpServiceLoader<>(McpJsonMapperSupplier.class);
McpJsonMapperSupplier.class); mcpValidatorServiceLoader = new McpServiceLoader<>(JsonSchemaValidatorSupplier.class);
mcpValidatorServiceLoader = new McpServiceLoader<JsonSchemaValidatorSupplier, JsonSchemaValidator>(
JsonSchemaValidatorSupplier.class);
} }
void setMcpJsonMapperSupplier(McpJsonMapperSupplier supplier) { void setMcpJsonMapperSupplier(McpJsonMapperSupplier supplier) {
@ -51,7 +51,7 @@ public class McpJsonDefaults {
mcpMapperServiceLoader.unsetSupplier(supplier); mcpMapperServiceLoader.unsetSupplier(supplier);
} }
public synchronized static McpJsonMapper getDefaultMcpJsonMapper() { public synchronized static McpJsonMapper getMapper() {
if (mcpMapperServiceLoader == null) { if (mcpMapperServiceLoader == null) {
new McpJsonDefaults(); new McpJsonDefaults();
} }
@ -66,7 +66,7 @@ public class McpJsonDefaults {
mcpValidatorServiceLoader.unsetSupplier(supplier); mcpValidatorServiceLoader.unsetSupplier(supplier);
} }
public synchronized static JsonSchemaValidator getDefaultJsonSchemaValidator() { public synchronized static JsonSchemaValidator getSchemaValidator() {
if (mcpValidatorServiceLoader == null) { if (mcpValidatorServiceLoader == null) {
new McpJsonDefaults(); new McpJsonDefaults();
} }

View file

@ -240,11 +240,10 @@ public interface McpServer {
this.instructions); this.instructions);
var jsonSchemaValidator = (this.jsonSchemaValidator != null) ? this.jsonSchemaValidator var jsonSchemaValidator = (this.jsonSchemaValidator != null) ? this.jsonSchemaValidator
: McpJsonDefaults.getDefaultJsonSchemaValidator(); : McpJsonDefaults.getSchemaValidator();
return new McpAsyncServer(transportProvider, return new McpAsyncServer(transportProvider, jsonMapper == null ? McpJsonDefaults.getMapper() : jsonMapper,
jsonMapper == null ? McpJsonDefaults.getDefaultMcpJsonMapper() : jsonMapper, features, features, requestTimeout, uriTemplateManagerFactory, jsonSchemaValidator);
requestTimeout, uriTemplateManagerFactory, jsonSchemaValidator);
} }
} }
@ -268,10 +267,9 @@ public interface McpServer {
this.resources, this.resourceTemplates, this.prompts, this.completions, this.rootsChangeHandlers, this.resources, this.resourceTemplates, this.prompts, this.completions, this.rootsChangeHandlers,
this.instructions); this.instructions);
var jsonSchemaValidator = this.jsonSchemaValidator != null ? this.jsonSchemaValidator var jsonSchemaValidator = this.jsonSchemaValidator != null ? this.jsonSchemaValidator
: McpJsonDefaults.getDefaultJsonSchemaValidator(); : McpJsonDefaults.getSchemaValidator();
return new McpAsyncServer(transportProvider, return new McpAsyncServer(transportProvider, jsonMapper == null ? McpJsonDefaults.getMapper() : jsonMapper,
jsonMapper == null ? McpJsonDefaults.getDefaultMcpJsonMapper() : jsonMapper, features, features, requestTimeout, uriTemplateManagerFactory, jsonSchemaValidator);
requestTimeout, uriTemplateManagerFactory, jsonSchemaValidator);
} }
} }
@ -858,9 +856,9 @@ public interface McpServer {
this.immediateExecution); this.immediateExecution);
var asyncServer = new McpAsyncServer(transportProvider, var asyncServer = new McpAsyncServer(transportProvider,
jsonMapper == null ? McpJsonDefaults.getDefaultMcpJsonMapper() : jsonMapper, asyncFeatures, jsonMapper == null ? McpJsonDefaults.getMapper() : jsonMapper, asyncFeatures, requestTimeout,
requestTimeout, uriTemplateManagerFactory, jsonSchemaValidator != null ? jsonSchemaValidator uriTemplateManagerFactory,
: McpJsonDefaults.getDefaultJsonSchemaValidator()); jsonSchemaValidator != null ? jsonSchemaValidator : McpJsonDefaults.getSchemaValidator());
return new McpSyncServer(asyncServer, this.immediateExecution); return new McpSyncServer(asyncServer, this.immediateExecution);
} }
@ -888,10 +886,10 @@ public interface McpServer {
McpServerFeatures.Async asyncFeatures = McpServerFeatures.Async.fromSync(syncFeatures, McpServerFeatures.Async asyncFeatures = McpServerFeatures.Async.fromSync(syncFeatures,
this.immediateExecution); this.immediateExecution);
var jsonSchemaValidator = this.jsonSchemaValidator != null ? this.jsonSchemaValidator var jsonSchemaValidator = this.jsonSchemaValidator != null ? this.jsonSchemaValidator
: McpJsonDefaults.getDefaultJsonSchemaValidator(); : McpJsonDefaults.getSchemaValidator();
var asyncServer = new McpAsyncServer(transportProvider, var asyncServer = new McpAsyncServer(transportProvider,
jsonMapper == null ? McpJsonDefaults.getDefaultMcpJsonMapper() : jsonMapper, asyncFeatures, jsonMapper == null ? McpJsonDefaults.getMapper() : jsonMapper, asyncFeatures, this.requestTimeout,
this.requestTimeout, this.uriTemplateManagerFactory, jsonSchemaValidator); this.uriTemplateManagerFactory, jsonSchemaValidator);
return new McpSyncServer(asyncServer, this.immediateExecution); return new McpSyncServer(asyncServer, this.immediateExecution);
} }
@ -1938,10 +1936,9 @@ public interface McpServer {
public McpStatelessAsyncServer build() { public McpStatelessAsyncServer build() {
var features = new McpStatelessServerFeatures.Async(this.serverInfo, this.serverCapabilities, this.tools, var features = new McpStatelessServerFeatures.Async(this.serverInfo, this.serverCapabilities, this.tools,
this.resources, this.resourceTemplates, this.prompts, this.completions, this.instructions); this.resources, this.resourceTemplates, this.prompts, this.completions, this.instructions);
return new McpStatelessAsyncServer(transport, return new McpStatelessAsyncServer(transport, jsonMapper == null ? McpJsonDefaults.getMapper() : jsonMapper,
jsonMapper == null ? McpJsonDefaults.getDefaultMcpJsonMapper() : jsonMapper, features, features, requestTimeout, uriTemplateManagerFactory,
requestTimeout, uriTemplateManagerFactory, jsonSchemaValidator != null ? jsonSchemaValidator jsonSchemaValidator != null ? jsonSchemaValidator : McpJsonDefaults.getSchemaValidator());
: McpJsonDefaults.getDefaultJsonSchemaValidator());
} }
} }
@ -2440,9 +2437,9 @@ public interface McpServer {
this.resources, this.resourceTemplates, this.prompts, this.completions, this.instructions); this.resources, this.resourceTemplates, this.prompts, this.completions, this.instructions);
var asyncFeatures = McpStatelessServerFeatures.Async.fromSync(syncFeatures, this.immediateExecution); var asyncFeatures = McpStatelessServerFeatures.Async.fromSync(syncFeatures, this.immediateExecution);
var asyncServer = new McpStatelessAsyncServer(transport, var asyncServer = new McpStatelessAsyncServer(transport,
jsonMapper == null ? McpJsonDefaults.getDefaultMcpJsonMapper() : jsonMapper, asyncFeatures, jsonMapper == null ? McpJsonDefaults.getMapper() : jsonMapper, asyncFeatures, requestTimeout,
requestTimeout, uriTemplateManagerFactory, this.jsonSchemaValidator != null uriTemplateManagerFactory,
? this.jsonSchemaValidator : McpJsonDefaults.getDefaultJsonSchemaValidator()); this.jsonSchemaValidator != null ? this.jsonSchemaValidator : McpJsonDefaults.getSchemaValidator());
return new McpStatelessSyncServer(asyncServer, this.immediateExecution); return new McpStatelessSyncServer(asyncServer, this.immediateExecution);
} }

View file

@ -672,8 +672,8 @@ public class HttpServletSseServerTransportProvider extends HttpServlet implement
throw new IllegalStateException("MessageEndpoint must be set"); throw new IllegalStateException("MessageEndpoint must be set");
} }
return new HttpServletSseServerTransportProvider( return new HttpServletSseServerTransportProvider(
jsonMapper == null ? McpJsonDefaults.getDefaultMcpJsonMapper() : jsonMapper, baseUrl, jsonMapper == null ? McpJsonDefaults.getMapper() : jsonMapper, baseUrl, messageEndpoint,
messageEndpoint, sseEndpoint, keepAliveInterval, contextExtractor, securityValidator); sseEndpoint, keepAliveInterval, contextExtractor, securityValidator);
} }
} }

View file

@ -331,8 +331,8 @@ public class HttpServletStatelessServerTransport extends HttpServlet implements
public HttpServletStatelessServerTransport build() { public HttpServletStatelessServerTransport build() {
Assert.notNull(mcpEndpoint, "Message endpoint must be set"); Assert.notNull(mcpEndpoint, "Message endpoint must be set");
return new HttpServletStatelessServerTransport( return new HttpServletStatelessServerTransport(
jsonMapper == null ? McpJsonDefaults.getDefaultMcpJsonMapper() : jsonMapper, mcpEndpoint, jsonMapper == null ? McpJsonDefaults.getMapper() : jsonMapper, mcpEndpoint, contextExtractor,
contextExtractor, securityValidator); securityValidator);
} }
} }

View file

@ -895,8 +895,8 @@ public class HttpServletStreamableServerTransportProvider extends HttpServlet
public HttpServletStreamableServerTransportProvider build() { public HttpServletStreamableServerTransportProvider build() {
Assert.notNull(this.mcpEndpoint, "MCP endpoint must be set"); Assert.notNull(this.mcpEndpoint, "MCP endpoint must be set");
return new HttpServletStreamableServerTransportProvider( return new HttpServletStreamableServerTransportProvider(
jsonMapper == null ? McpJsonDefaults.getDefaultMcpJsonMapper() : jsonMapper, mcpEndpoint, jsonMapper == null ? McpJsonDefaults.getMapper() : jsonMapper, mcpEndpoint, disallowDelete,
disallowDelete, contextExtractor, keepAliveInterval, securityValidator); contextExtractor, keepAliveInterval, securityValidator);
} }
} }

View file

@ -8,6 +8,6 @@ public final class McpJsonMapperUtils {
private McpJsonMapperUtils() { private McpJsonMapperUtils() {
} }
public static final McpJsonMapper JSON_MAPPER = McpJsonDefaults.getDefaultMcpJsonMapper(); public static final McpJsonMapper JSON_MAPPER = McpJsonDefaults.getMapper();
} }

View file

@ -14,7 +14,7 @@ class McpJsonMapperTest {
@Test @Test
void shouldUseJackson2Mapper() { void shouldUseJackson2Mapper() {
assertThat(McpJsonDefaults.getDefaultMcpJsonMapper()).isInstanceOf(JacksonMcpJsonMapper.class); assertThat(McpJsonDefaults.getMapper()).isInstanceOf(JacksonMcpJsonMapper.class);
} }
} }

View file

@ -15,7 +15,7 @@ class JsonSchemaValidatorTest {
@Test @Test
void shouldUseJackson2Mapper() { void shouldUseJackson2Mapper() {
assertThat(McpJsonDefaults.getDefaultJsonSchemaValidator()).isInstanceOf(DefaultJsonSchemaValidator.class); assertThat(McpJsonDefaults.getSchemaValidator()).isInstanceOf(DefaultJsonSchemaValidator.class);
} }
} }

View file

@ -14,7 +14,7 @@ class McpJsonMapperTest {
@Test @Test
void shouldUseJackson2Mapper() { void shouldUseJackson2Mapper() {
assertThat(McpJsonDefaults.getDefaultMcpJsonMapper()).isInstanceOf(JacksonMcpJsonMapper.class); assertThat(McpJsonDefaults.getMapper()).isInstanceOf(JacksonMcpJsonMapper.class);
} }
} }

View file

@ -15,7 +15,7 @@ class JsonSchemaValidatorTest {
@Test @Test
void shouldUseJackson2Mapper() { void shouldUseJackson2Mapper() {
assertThat(McpJsonDefaults.getDefaultJsonSchemaValidator()).isInstanceOf(DefaultJsonSchemaValidator.class); assertThat(McpJsonDefaults.getSchemaValidator()).isInstanceOf(DefaultJsonSchemaValidator.class);
} }
} }

View file

@ -616,9 +616,8 @@ public class WebClientStreamableHttpTransport implements McpClientTransport {
* @return a new instance of {@link WebClientStreamableHttpTransport} * @return a new instance of {@link WebClientStreamableHttpTransport}
*/ */
public WebClientStreamableHttpTransport build() { public WebClientStreamableHttpTransport build() {
return new WebClientStreamableHttpTransport( return new WebClientStreamableHttpTransport(jsonMapper == null ? McpJsonDefaults.getMapper() : jsonMapper,
jsonMapper == null ? McpJsonDefaults.getDefaultMcpJsonMapper() : jsonMapper, webClientBuilder, webClientBuilder, endpoint, resumableStreams, openConnectionOnStartup, supportedProtocolVersions);
endpoint, resumableStreams, openConnectionOnStartup, supportedProtocolVersions);
} }
} }

View file

@ -405,7 +405,7 @@ public class WebFluxSseClientTransport implements McpClientTransport {
*/ */
public WebFluxSseClientTransport build() { public WebFluxSseClientTransport build() {
return new WebFluxSseClientTransport(webClientBuilder, return new WebFluxSseClientTransport(webClientBuilder,
jsonMapper == null ? McpJsonDefaults.getDefaultMcpJsonMapper() : jsonMapper, sseEndpoint); jsonMapper == null ? McpJsonDefaults.getMapper() : jsonMapper, sseEndpoint);
} }
} }

View file

@ -562,9 +562,8 @@ public class WebFluxSseServerTransportProvider implements McpServerTransportProv
*/ */
public WebFluxSseServerTransportProvider build() { public WebFluxSseServerTransportProvider build() {
Assert.notNull(messageEndpoint, "Message endpoint must be set"); Assert.notNull(messageEndpoint, "Message endpoint must be set");
return new WebFluxSseServerTransportProvider( return new WebFluxSseServerTransportProvider(jsonMapper == null ? McpJsonDefaults.getMapper() : jsonMapper,
jsonMapper == null ? McpJsonDefaults.getDefaultMcpJsonMapper() : jsonMapper, baseUrl, baseUrl, messageEndpoint, sseEndpoint, keepAliveInterval, contextExtractor, securityValidator);
messageEndpoint, sseEndpoint, keepAliveInterval, contextExtractor, securityValidator);
} }
} }

View file

@ -245,9 +245,8 @@ public class WebFluxStatelessServerTransport implements McpStatelessServerTransp
*/ */
public WebFluxStatelessServerTransport build() { public WebFluxStatelessServerTransport build() {
Assert.notNull(mcpEndpoint, "Message endpoint must be set"); Assert.notNull(mcpEndpoint, "Message endpoint must be set");
return new WebFluxStatelessServerTransport( return new WebFluxStatelessServerTransport(jsonMapper == null ? McpJsonDefaults.getMapper() : jsonMapper,
jsonMapper == null ? McpJsonDefaults.getDefaultMcpJsonMapper() : jsonMapper, mcpEndpoint, mcpEndpoint, contextExtractor, securityValidator);
contextExtractor, securityValidator);
} }
} }

View file

@ -533,8 +533,8 @@ public class WebFluxStreamableServerTransportProvider implements McpStreamableSe
public WebFluxStreamableServerTransportProvider build() { public WebFluxStreamableServerTransportProvider build() {
Assert.notNull(mcpEndpoint, "Message endpoint must be set"); Assert.notNull(mcpEndpoint, "Message endpoint must be set");
return new WebFluxStreamableServerTransportProvider( return new WebFluxStreamableServerTransportProvider(
jsonMapper == null ? McpJsonDefaults.getDefaultMcpJsonMapper() : jsonMapper, mcpEndpoint, jsonMapper == null ? McpJsonDefaults.getMapper() : jsonMapper, mcpEndpoint, contextExtractor,
contextExtractor, disallowDelete, keepAliveInterval, securityValidator); disallowDelete, keepAliveInterval, securityValidator);
} }
} }

View file

@ -221,7 +221,7 @@ public class WebFluxServerTransportSecurityIntegrationTests {
public McpSyncClient createMcpClient(String baseUrl, TestHeaderExchangeFilterFunction exchangeFilterFunction) { public McpSyncClient createMcpClient(String baseUrl, TestHeaderExchangeFilterFunction exchangeFilterFunction) {
var transport = WebFluxSseClientTransport var transport = WebFluxSseClientTransport
.builder(WebClient.builder().baseUrl(baseUrl).filter(exchangeFilterFunction)) .builder(WebClient.builder().baseUrl(baseUrl).filter(exchangeFilterFunction))
.jsonMapper(McpJsonDefaults.getDefaultMcpJsonMapper()) .jsonMapper(McpJsonDefaults.getMapper())
.build(); .build();
return McpClient.sync(transport).initializationTimeout(Duration.ofMillis(500)).build(); return McpClient.sync(transport).initializationTimeout(Duration.ofMillis(500)).build();
} }
@ -254,7 +254,7 @@ public class WebFluxServerTransportSecurityIntegrationTests {
public McpSyncClient createMcpClient(String baseUrl, TestHeaderExchangeFilterFunction exchangeFilterFunction) { public McpSyncClient createMcpClient(String baseUrl, TestHeaderExchangeFilterFunction exchangeFilterFunction) {
var transport = WebClientStreamableHttpTransport var transport = WebClientStreamableHttpTransport
.builder(WebClient.builder().baseUrl(baseUrl).filter(exchangeFilterFunction)) .builder(WebClient.builder().baseUrl(baseUrl).filter(exchangeFilterFunction))
.jsonMapper(McpJsonDefaults.getDefaultMcpJsonMapper()) .jsonMapper(McpJsonDefaults.getMapper())
.openConnectionOnStartup(true) .openConnectionOnStartup(true)
.build(); .build();
return McpClient.sync(transport).initializationTimeout(Duration.ofMillis(500)).build(); return McpClient.sync(transport).initializationTimeout(Duration.ofMillis(500)).build();
@ -288,7 +288,7 @@ public class WebFluxServerTransportSecurityIntegrationTests {
public McpSyncClient createMcpClient(String baseUrl, TestHeaderExchangeFilterFunction exchangeFilterFunction) { public McpSyncClient createMcpClient(String baseUrl, TestHeaderExchangeFilterFunction exchangeFilterFunction) {
var transport = WebClientStreamableHttpTransport var transport = WebClientStreamableHttpTransport
.builder(WebClient.builder().baseUrl(baseUrl).filter(exchangeFilterFunction)) .builder(WebClient.builder().baseUrl(baseUrl).filter(exchangeFilterFunction))
.jsonMapper(McpJsonDefaults.getDefaultMcpJsonMapper()) .jsonMapper(McpJsonDefaults.getMapper())
.openConnectionOnStartup(true) .openConnectionOnStartup(true)
.build(); .build();
return McpClient.sync(transport).initializationTimeout(Duration.ofMillis(500)).build(); return McpClient.sync(transport).initializationTimeout(Duration.ofMillis(500)).build();

View file

@ -8,6 +8,6 @@ public final class McpJsonMapperUtils {
private McpJsonMapperUtils() { private McpJsonMapperUtils() {
} }
public static final McpJsonMapper JSON_MAPPER = McpJsonDefaults.getDefaultMcpJsonMapper(); public static final McpJsonMapper JSON_MAPPER = McpJsonDefaults.getMapper();
} }

Some files were not shown because too many files have changed in this diff Show more