refactor: remove deprecated 0.7.0 code

These changes are part of the planned deprecation cycle announced in 0.8.0,
with the deprecated classes scheduled for removal in 0.9.0

- Delete WebFluxSseServerTransport, WebMvcSseServerTransport, StdioServerTransport, and HttpServletSseServerTransport
- Remove deprecated interfaces: ServerMcpTransport, ClientMcpTransport
- Delete DefaultMcpSession implementation
- Remove all deprecated test classes for the removed implementations
- Update references to use McpServerTransport and McpClientTransport interfaces
- Split MockMcpTransport into client and server implementations
  * Rename MockMcpTransport to MockMcpClientTransport in mcp/src/test
  * Create new MockMcpServerTransport implementation
  * Add MockMcpServerTransportProvider for server tests
  * Mark MockMcpTransport in mcp-test module as deprecated
  * Update all test classes to use the new implementations

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
This commit is contained in:
Christian Tzolov 2025-03-22 16:50:33 +01:00
commit 25f3bad68d

View file

@ -65,40 +65,6 @@ public class McpSyncServer {
this.asyncServer = asyncServer;
}
/**
* Retrieves the list of all roots provided by the client.
* @return The list of roots
* @deprecated This method will be removed in 0.9.0. Use
* {@link McpSyncServerExchange#listRoots()}.
*/
@Deprecated
public McpSchema.ListRootsResult listRoots() {
return this.listRoots(null);
}
/**
* Retrieves a paginated list of roots provided by the server.
* @param cursor Optional pagination cursor from a previous list request
* @return The list of roots
* @deprecated This method will be removed in 0.9.0. Use
* {@link McpSyncServerExchange#listRoots(String)}.
*/
@Deprecated
public McpSchema.ListRootsResult listRoots(String cursor) {
return this.asyncServer.listRoots(cursor).block();
}
/**
* Add a new tool handler.
* @param toolHandler The tool handler to add
* @deprecated This method will be removed in 0.9.0. Use
* {@link #addTool(McpServerFeatures.SyncToolSpecification)}.
*/
@Deprecated
public void addTool(McpServerFeatures.SyncToolRegistration toolHandler) {
this.asyncServer.addTool(McpServerFeatures.AsyncToolRegistration.fromSync(toolHandler)).block();
}
/**
* Add a new tool handler.
* @param toolHandler The tool handler to add
@ -115,17 +81,6 @@ public class McpSyncServer {
this.asyncServer.removeTool(toolName).block();
}
/**
* Add a new resource handler.
* @param resourceHandler The resource handler to add
* @deprecated This method will be removed in 0.9.0. Use
* {@link #addResource(McpServerFeatures.SyncResourceSpecification)}.
*/
@Deprecated
public void addResource(McpServerFeatures.SyncResourceRegistration resourceHandler) {
this.asyncServer.addResource(McpServerFeatures.AsyncResourceRegistration.fromSync(resourceHandler)).block();
}
/**
* Add a new resource handler.
* @param resourceHandler The resource handler to add
@ -142,17 +97,6 @@ public class McpSyncServer {
this.asyncServer.removeResource(resourceUri).block();
}
/**
* Add a new prompt handler.
* @param promptRegistration The prompt registration to add
* @deprecated This method will be removed in 0.9.0. Use
* {@link #addPrompt(McpServerFeatures.SyncPromptSpecification)}.
*/
@Deprecated
public void addPrompt(McpServerFeatures.SyncPromptRegistration promptRegistration) {
this.asyncServer.addPrompt(McpServerFeatures.AsyncPromptRegistration.fromSync(promptRegistration)).block();
}
/**
* Add a new prompt handler.
* @param promptSpecification The prompt specification to add
@ -192,28 +136,6 @@ public class McpSyncServer {
return this.asyncServer.getServerInfo();
}
/**
* Get the client capabilities that define the supported features and functionality.
* @return The client capabilities
* @deprecated This method will be removed in 0.9.0. Use
* {@link McpSyncServerExchange#getClientCapabilities()}.
*/
@Deprecated
public ClientCapabilities getClientCapabilities() {
return this.asyncServer.getClientCapabilities();
}
/**
* Get the client implementation information.
* @return The client implementation details
* @deprecated This method will be removed in 0.9.0. Use
* {@link McpSyncServerExchange#getClientInfo()}.
*/
@Deprecated
public McpSchema.Implementation getClientInfo() {
return this.asyncServer.getClientInfo();
}
/**
* Notify clients that the list of available resources has changed.
*/
@ -258,36 +180,4 @@ public class McpSyncServer {
return this.asyncServer;
}
/**
* Create a new message using the sampling capabilities of the client. The Model
* Context Protocol (MCP) provides a standardized way for servers to request LLM
* sampling ("completions" or "generations") from language models via clients.
*
* <p>
* This flow allows clients to maintain control over model access, selection, and
* permissions while enabling servers to leverage AI capabilities—with no server API
* keys necessary. Servers can request text or image-based interactions and optionally
* include context from MCP servers in their prompts.
*
* <p>
* Unlike its async counterpart, this method blocks until the message creation is
* complete, making it easier to use in synchronous code paths.
* @param createMessageRequest The request to create a new message
* @return The result of the message creation
* @throws McpError if the client has not been initialized or does not support
* sampling capabilities
* @throws McpError if the client does not support the createMessage method
* @see McpSchema.CreateMessageRequest
* @see McpSchema.CreateMessageResult
* @see <a href=
* "https://spec.modelcontextprotocol.io/specification/client/sampling/">Sampling
* Specification</a>
* @deprecated This method will be removed in 0.9.0. Use
* {@link McpSyncServerExchange#createMessage(McpSchema.CreateMessageRequest)}.
*/
@Deprecated
public McpSchema.CreateMessageResult createMessage(McpSchema.CreateMessageRequest createMessageRequest) {
return this.asyncServer.createMessage(createMessageRequest).block();
}
}