Skip to content

Fix typo & Remove a useless instance and finalize the injecting property #266

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import io.modelcontextprotocol.spec.McpSchema.Tool;
import io.modelcontextprotocol.spec.McpServerSession;
import io.modelcontextprotocol.spec.McpServerTransportProvider;
import io.modelcontextprotocol.util.DeafaultMcpUriTemplateManagerFactory;
import io.modelcontextprotocol.util.McpUriTemplateManagerFactory;
import io.modelcontextprotocol.util.Utils;
import org.slf4j.Logger;
Expand Down Expand Up @@ -108,7 +107,7 @@ public class McpAsyncServer {

private List<String> protocolVersions = List.of(McpSchema.LATEST_PROTOCOL_VERSION);

private McpUriTemplateManagerFactory uriTemplateManagerFactory = new DeafaultMcpUriTemplateManagerFactory();
private final McpUriTemplateManagerFactory uriTemplateManagerFactory;

/**
* Create a new McpAsyncServer with the given transport provider and capabilities.
Expand All @@ -117,9 +116,13 @@ public class McpAsyncServer {
* @param features The MCP server supported features.
* @param objectMapper The ObjectMapper to use for JSON serialization/deserialization
*/
McpAsyncServer(McpServerTransportProvider mcpTransportProvider, ObjectMapper objectMapper,
McpServerFeatures.Async features, Duration requestTimeout,
McpUriTemplateManagerFactory uriTemplateManagerFactory) {
McpAsyncServer(
McpServerTransportProvider mcpTransportProvider,
ObjectMapper objectMapper,
McpServerFeatures.Async features,
Duration requestTimeout,
McpUriTemplateManagerFactory uriTemplateManagerFactory
) {
this.mcpTransportProvider = mcpTransportProvider;
this.objectMapper = objectMapper;
this.serverInfo = features.serverInfo();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import io.modelcontextprotocol.spec.McpSchema.ResourceTemplate;
import io.modelcontextprotocol.spec.McpServerTransportProvider;
import io.modelcontextprotocol.util.Assert;
import io.modelcontextprotocol.util.DeafaultMcpUriTemplateManagerFactory;
import io.modelcontextprotocol.util.DefaultMcpUriTemplateManagerFactory;
import io.modelcontextprotocol.util.McpUriTemplateManagerFactory;
import reactor.core.publisher.Mono;

Expand Down Expand Up @@ -158,7 +158,7 @@ class AsyncSpecification {

private final McpServerTransportProvider transportProvider;

private McpUriTemplateManagerFactory uriTemplateManagerFactory = new DeafaultMcpUriTemplateManagerFactory();
private McpUriTemplateManagerFactory uriTemplateManagerFactory = new DefaultMcpUriTemplateManagerFactory();

private ObjectMapper objectMapper;

Expand Down Expand Up @@ -648,7 +648,7 @@ class SyncSpecification {
private static final McpSchema.Implementation DEFAULT_SERVER_INFO = new McpSchema.Implementation("mcp-server",
"1.0.0");

private McpUriTemplateManagerFactory uriTemplateManagerFactory = new DeafaultMcpUriTemplateManagerFactory();
private McpUriTemplateManagerFactory uriTemplateManagerFactory = new DefaultMcpUriTemplateManagerFactory();

private final McpServerTransportProvider transportProvider;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,23 @@
package io.modelcontextprotocol.util;

/**
* @deprecated Use {@link DefaultMcpUriTemplateManagerFactory} instead. This
* class will be removed in future versions.
* @author Christian Tzolov
*/
@Deprecated
public class DeafaultMcpUriTemplateManagerFactory implements McpUriTemplateManagerFactory {

/**
* Creates a new instance of {@link McpUriTemplateManager} with the specified URI
* template.
* @param uriTemplate The URI template to be used for variable extraction
* @return A new instance of {@link McpUriTemplateManager}
* @throws IllegalArgumentException if the URI template is null or empty
*/
@Override
public McpUriTemplateManager create(String uriTemplate) {
return new DefaultMcpUriTemplateManager(uriTemplate);
}

/**
* Creates a new instance of {@link McpUriTemplateManager} with the specified URI
* template.
*
* @param uriTemplate The URI template to be used for variable extraction
* @return A new instance of {@link McpUriTemplateManager}
* @throws IllegalArgumentException if the URI template is null or empty
*/
@Override
public McpUriTemplateManager create(String uriTemplate) {
return new DefaultMcpUriTemplateManager(uriTemplate);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright 2025 - 2025 the original author or authors.
*/
package io.modelcontextprotocol.util;

/**
* @author Christian Tzolov
*/
public class DefaultMcpUriTemplateManagerFactory implements McpUriTemplateManagerFactory {

/**
* Creates a new instance of {@link McpUriTemplateManager} with the specified URI
* template.
* @param uriTemplate The URI template to be used for variable extraction
* @return A new instance of {@link McpUriTemplateManager}
* @throws IllegalArgumentException if the URI template is null or empty
*/
@Override
public McpUriTemplateManager create(String uriTemplate) {
return new DefaultMcpUriTemplateManager(uriTemplate);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import java.util.List;
import java.util.Map;

import io.modelcontextprotocol.util.DeafaultMcpUriTemplateManagerFactory;
import io.modelcontextprotocol.util.DefaultMcpUriTemplateManagerFactory;
import io.modelcontextprotocol.util.McpUriTemplateManager;
import io.modelcontextprotocol.util.McpUriTemplateManagerFactory;
import org.junit.jupiter.api.BeforeEach;
Expand All @@ -29,7 +29,7 @@ public class McpUriTemplateManagerTests {

@BeforeEach
void setUp() {
this.uriTemplateFactory = new DeafaultMcpUriTemplateManagerFactory();
this.uriTemplateFactory = new DefaultMcpUriTemplateManagerFactory();
}

@Test
Expand Down