Skip to content

Commit b16cfd7

Browse files
committed
More permissive access to member variables
for subclassing/extension.
1 parent b513938 commit b16cfd7

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

mcp-core/src/main/java/io/modelcontextprotocol/server/McpAsyncServer.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -97,29 +97,29 @@ public class McpAsyncServer {
9797

9898
protected final JsonSchemaValidator jsonSchemaValidator;
9999

100-
private final McpSchema.ServerCapabilities serverCapabilities;
100+
protected final McpSchema.ServerCapabilities serverCapabilities;
101101

102-
private final McpSchema.Implementation serverInfo;
102+
protected final McpSchema.Implementation serverInfo;
103103

104-
private final String instructions;
104+
protected final String instructions;
105105

106106
protected final CopyOnWriteArrayList<McpServerFeatures.AsyncToolSpecification> tools = new CopyOnWriteArrayList<>();
107107

108-
private final ConcurrentHashMap<String, McpServerFeatures.AsyncResourceSpecification> resources = new ConcurrentHashMap<>();
108+
protected final ConcurrentHashMap<String, McpServerFeatures.AsyncResourceSpecification> resources = new ConcurrentHashMap<>();
109109

110-
private final ConcurrentHashMap<String, McpServerFeatures.AsyncResourceTemplateSpecification> resourceTemplates = new ConcurrentHashMap<>();
110+
protected final ConcurrentHashMap<String, McpServerFeatures.AsyncResourceTemplateSpecification> resourceTemplates = new ConcurrentHashMap<>();
111111

112-
private final ConcurrentHashMap<String, McpServerFeatures.AsyncPromptSpecification> prompts = new ConcurrentHashMap<>();
112+
protected final ConcurrentHashMap<String, McpServerFeatures.AsyncPromptSpecification> prompts = new ConcurrentHashMap<>();
113113

114114
// FIXME: this field is deprecated and should be remvoed together with the
115115
// broadcasting loggingNotification.
116116
private LoggingLevel minLoggingLevel = LoggingLevel.DEBUG;
117117

118-
private final ConcurrentHashMap<McpSchema.CompleteReference, McpServerFeatures.AsyncCompletionSpecification> completions = new ConcurrentHashMap<>();
118+
protected final ConcurrentHashMap<McpSchema.CompleteReference, McpServerFeatures.AsyncCompletionSpecification> completions = new ConcurrentHashMap<>();
119119

120-
private List<String> protocolVersions;
120+
protected List<String> protocolVersions;
121121

122-
private McpUriTemplateManagerFactory uriTemplateManagerFactory = new DefaultMcpUriTemplateManagerFactory();
122+
protected McpUriTemplateManagerFactory uriTemplateManagerFactory = new DefaultMcpUriTemplateManagerFactory();
123123

124124
/**
125125
* Create a new McpAsyncServer with the given transport provider and capabilities.
@@ -178,7 +178,7 @@ public McpAsyncServer(McpStreamableServerTransportProvider mcpTransportProvider,
178178
this::asyncInitializeRequestHandler, requestHandlers, notificationHandlers));
179179
}
180180

181-
private Map<String, McpNotificationHandler> prepareNotificationHandlers(McpServerFeatures.Async features) {
181+
protected Map<String, McpNotificationHandler> prepareNotificationHandlers(McpServerFeatures.Async features) {
182182
Map<String, McpNotificationHandler> notificationHandlers = new HashMap<>();
183183

184184
notificationHandlers.put(McpSchema.METHOD_NOTIFICATION_INITIALIZED, (exchange, params) -> Mono.empty());
@@ -196,7 +196,7 @@ private Map<String, McpNotificationHandler> prepareNotificationHandlers(McpServe
196196
return notificationHandlers;
197197
}
198198

199-
private Map<String, McpRequestHandler<?>> prepareRequestHandlers() {
199+
protected Map<String, McpRequestHandler<?>> prepareRequestHandlers() {
200200
Map<String, McpRequestHandler<?>> requestHandlers = new HashMap<>();
201201

202202
// Initialize request handlers for standard MCP methods

mcp-core/src/main/java/io/modelcontextprotocol/server/McpSyncServer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ public class McpSyncServer {
5454
/**
5555
* The async server to wrap.
5656
*/
57-
private final McpAsyncServer asyncServer;
57+
protected final McpAsyncServer asyncServer;
5858

59-
private final boolean immediateExecution;
59+
protected final boolean immediateExecution;
6060

6161
/**
6262
* Creates a new synchronous server that wraps the provided async server.

0 commit comments

Comments
 (0)