Improve docs
40
README.md
|
|
@ -1,26 +1,27 @@
|
|||
# Java & Spring MCP
|
||||
# MCP Java SDK
|
||||
[](https://github.com/modelcontextprotocol/java-sdk/actions/workflows/continuous-integration.yml)
|
||||
|
||||
Set of projects that provide Java SDK and Spring Framework integration for the [Model Context Protocol](https://modelcontextprotocol.org/docs/concepts/architecture).
|
||||
Set of projects that provide Java SDK integration for the [Model Context Protocol](https://modelcontextprotocol.org/docs/concepts/architecture).
|
||||
It enables Java applications to interact with AI models and tools through a standardized interface, supporting both synchronous and asynchronous communication patterns.
|
||||
|
||||
## 📚 Reference Documentation
|
||||
For comprehensive guides and API documentation, visit the [Spring AI MCP Reference Documentation](https://docs.spring.io/spring-ai-mcp/reference/overview.html).
|
||||
|
||||
<img src="mcp-docs/src/main/antora/modules/ROOT/images/spring-ai-mcp-clinet-architecture.jpg" width="600">
|
||||
For comprehensive guides and API documentation, visit the [MCP Java SDK Reference Documentation](docs/docs/overview.mdx).
|
||||
|
||||
<img src="mcp-docs/src/main/antora/modules/ROOT/images/spring-ai-mcp-server-architecture.jpg" width="600">
|
||||
<img src="docs/images/java-mcp-client-architecture" width="600">
|
||||
|
||||
<img src="docs/images/java-mcp-server-architecture.jpg" width="600">
|
||||
|
||||
## Projects
|
||||
|
||||
### [MCP Java SDK](https://docs.spring.io/spring-ai-mcp/reference/mcp.html)
|
||||
### MCP
|
||||
|
||||
Java implementation of the Model Context Protocol specification. It includes:
|
||||
- Synchronous and asynchronous [MCP Client](https://docs.spring.io/spring-ai-mcp/reference/mcp.html#_mcp_client) and [MCP Server](https://docs.spring.io/spring-ai-mcp/reference/mcp.html#_mcp_server) implementations
|
||||
- Standard MCP operations support (tool discovery, resource management, prompt handling, structured logging). Support for request and notification handling.
|
||||
- [Stdio](https://spec.modelcontextprotocol.io/specification/2024-11-05/basic/transports/#stdio) and [SSE](https://spec.modelcontextprotocol.io/specification/2024-11-05/basic/transports/#http-with-sse) transport implementations.
|
||||
|
||||
### MCP Transports
|
||||
### MCP Spring
|
||||
|
||||
#### Core Transports
|
||||
- Stdio-based (`StdioClientTransport`, `StdioServerTransport`) for process-based communication
|
||||
|
|
@ -32,13 +33,6 @@ Java implementation of the Model Context Protocol specification. It includes:
|
|||
- [WebMvc SSE Transport](https://github.com/modelcontextprotocol/java-sdk/tree/main/mcp-spring/mcp-spring-webmvc) - Spring MVC based HTTP SSE transport (Server only).
|
||||
You can use the core `HttpClientSseClientTransport` transport as a SSE client.
|
||||
|
||||
### [Spring AI MCP](https://docs.spring.io/spring-ai-mcp/reference/spring-mcp.html)
|
||||
|
||||
The Spring integration module provides Spring-specific functionality:
|
||||
- Integration with Spring AI's function calling system
|
||||
- Spring-friendly abstractions for MCP clients
|
||||
- Auto-configurations (WIP)
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
|
|
@ -64,24 +58,6 @@ Add the following dependencies to your Maven project:
|
|||
</dependency>
|
||||
```
|
||||
|
||||
This is a milestone release, not available on Maven Central.
|
||||
Add this repository to your POM:
|
||||
|
||||
```xml
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spring-milestones</id>
|
||||
<name>Spring Milestones</name>
|
||||
<url>https://repo.spring.io/milestone</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
```
|
||||
|
||||
Reffer to the [Dependency Management](https://docs.spring.io/spring-ai-mcp/reference/dependency-management.html) page for more information.
|
||||
|
||||
## Example Demos
|
||||
|
||||
Explore these MCP examples in the [spring-ai-examples/model-context-protocol](https://github.com/spring-projects/spring-ai-examples/tree/main/model-context-protocol) repository:
|
||||
|
|
|
|||
|
|
@ -64,41 +64,3 @@ The following dependencies are available and managed by the BOM:
|
|||
|
||||
- `org.modelcontextprotocol.sdk:mcp-test` - Testing utilities and support for MCP-based applications.
|
||||
|
||||
### Milestone and Snapshot Repositories
|
||||
|
||||
To use the Milestone and Snapshot version, you need to add references to the Spring Milestone and/or Snapshot repositories in your build file.
|
||||
Add the following repository definitions to your Maven or Gradle build file:
|
||||
|
||||
<Tabs>
|
||||
<Tab title="Maven">
|
||||
```xml
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spring-milestones</id>
|
||||
<n>Spring Milestones</n>
|
||||
<url>https://repo.spring.io/milestone</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spring-snapshots</id>
|
||||
<n>Spring Snapshots</n>
|
||||
<url>https://repo.spring.io/snapshot</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
</repository>
|
||||
</repositories>
|
||||
```
|
||||
</Tab>
|
||||
|
||||
<Tab title="Gradle">
|
||||
```groovy
|
||||
repositories {
|
||||
maven { url 'https://repo.spring.io/milestone' }
|
||||
maven { url 'https://repo.spring.io/snapshot' }
|
||||
}
|
||||
```
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ description: Overview of the Model Context Protocol (MCP) architecture and key c
|
|||
|
||||
Java SDK implementation of the [Model Context Protocol](https://modelcontextprotocol.io/introduction), enabling seamless integration with language models and AI tools.
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
## Features
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ The SDK follows a layered architecture with clear separation of concerns:
|
|||
|
||||
Following class diagram illustrates the layered architecture of the MCP SDK, showing the relationships between core interfaces (McpTransport, McpSession), their implementations, and the client/server components. It highlights how the transport layer connects to sessions, which in turn support both synchronous and asynchronous client/server implementations.
|
||||
|
||||

|
||||

|
||||
|
||||
Key Interactions:
|
||||
|
||||
|
|
|
|||
|
|
@ -3,36 +3,12 @@ title: Overview
|
|||
description: Introduction to the Model Context Protocol (MCP) Java SDK
|
||||
---
|
||||
|
||||
# Java & Spring MCP
|
||||
# MCP Java SDK
|
||||
|
||||
Java SDK and Spring Framework integration for the [Model Context Protocol](https://modelcontextprotocol.org/docs/concepts/architecture), enabling standardized interaction with AI models and tools through both synchronous and asynchronous communication.
|
||||
Java SDK for the [Model Context Protocol](https://modelcontextprotocol.org/docs/concepts/architecture), enabling standardized interaction with AI models and tools through both synchronous and asynchronous communication.
|
||||
|
||||

|
||||

|
||||
|
||||
## Core Components
|
||||
|
||||
### [MCP Java SDK](/docs/mcp)
|
||||
Core implementation of the Model Context Protocol specification, providing:
|
||||
|
||||
- Synchronous and asynchronous [Client](/docs/mcp#mcp-client) and [Server](/docs/mcp#mcp-server) implementations
|
||||
- Tool discovery and execution
|
||||
- Resource management with URI templates
|
||||
- Prompt handling and management
|
||||
- Structured logging
|
||||
- Request and Notification handling
|
||||
|
||||
### MCP Transports
|
||||
|
||||
#### Core Transports
|
||||
- Stdio-based (`StdioClientTransport`, `StdioServerTransport`) for process-based communication
|
||||
- Java HttpClient-based SSE client (`HttpClientSseClientTransport`) for HTTP SSE Client-side streaming
|
||||
- Servlet-based SSE server (`HttpServletSseServerTransport`) for HTTP SSE Server streaming using traditional Servlet API
|
||||
|
||||
#### Optional SSE Transports
|
||||
- [WebFlux SSE Transport](https://github.com/modelcontextprotocol/java-sdk/tree/main/mcp-spring/mcp-spring-webflux) - Reactive HTTP streaming with Spring WebFlux (Client & Server)
|
||||
- [WebMvc SSE Transport](https://github.com/modelcontextprotocol/java-sdk/tree/main/mcp-spring/mcp-spring-webmvc) - Spring MVC based SSE transport (Server only).
|
||||
You can use the core `HttpClientSseClientTransport` transport as a SSE client.
|
||||

|
||||

|
||||
|
||||
## Getting Started
|
||||
|
||||
|
|
|
|||
BIN
docs/images/java-mcp-client-architecture.jpg
Normal file
|
After Width: | Height: | Size: 661 KiB |
BIN
docs/images/java-mcp-server-architecture.jpg
Normal file
|
After Width: | Height: | Size: 840 KiB |
|
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 67 KiB |
|
Before Width: | Height: | Size: 686 KiB |
|
Before Width: | Height: | Size: 791 KiB |
|
|
@ -33,7 +33,7 @@
|
|||
"docs/mcp-overview",
|
||||
"docs/mcp-client",
|
||||
"docs/mcp-server",
|
||||
"docs/mcp-spring",
|
||||
"docs/mcp-transport",
|
||||
"docs/mcp-capabilities"
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@
|
|||
<artifactId>mcp-bom</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>Spring AI MCP BOM</name>
|
||||
<description>Spring AI MCP Bill of Materials</description>
|
||||
<name>Java SDK MCP BOM</name>
|
||||
<description>Java SDK MCP Bill of Materials</description>
|
||||
|
||||
<url>https://github.com/modelcontextprotocol/java-sdk</url>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,89 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Copyright 2023-2024 the original author or authors.
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ https://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>io.modelcontextprotocol.sdk</groupId>
|
||||
<artifactId>mcp-parent</artifactId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>mcp-docs</artifactId>
|
||||
<name>Spring AI MCP Docs</name>
|
||||
<description>Spring AI MCP documentation</description>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.antora</groupId>
|
||||
<artifactId>antora-maven-plugin</artifactId>
|
||||
<version>${org.maven.antora-version}</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<options>
|
||||
<option>--to-dir=target/antora/site</option>
|
||||
<option>--stacktrace</option>
|
||||
<option>--fetch</option>
|
||||
</options>
|
||||
<playbook>src/main/antora/antora-playbook.yml</playbook>
|
||||
<packages>
|
||||
<package>@antora/cli@3.2.0-alpha.6</package>
|
||||
<package>@antora/atlas-extension@1.0.0-alpha.2</package>
|
||||
<package>@antora/collector-extension@1.0.0-beta.1</package>
|
||||
<package>@asciidoctor/tabs@1.0.0-beta.6</package>
|
||||
<package>@springio/antora-extensions@1.14.2</package>
|
||||
<package>@springio/asciidoctor-extensions@1.0.0-alpha.12</package>
|
||||
<package>@djencks/asciidoctor-mathjax@0.0.9</package>
|
||||
</packages>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>io.spring.maven.antora</groupId>
|
||||
<artifactId>antora-component-version-maven-plugin</artifactId>
|
||||
<version>${io.spring.maven.antora-version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>antora-component-version</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>${maven-assembly-plugin.version}</version>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/assembly/javadocs.xml</descriptor>
|
||||
</descriptors>
|
||||
<finalName>mcp-${project.version}</finalName>
|
||||
<appendAssemblyId>true</appendAssemblyId>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>${maven-deploy-plugin.version}</version>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
<!--
|
||||
~ Copyright 2023-2024 the original author or authors.
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ https://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.1.0 http://maven.apache.org/xsd/assembly-2.1.0.xsd">
|
||||
<id>docs</id>
|
||||
<formats>
|
||||
<format>zip</format>
|
||||
</formats>
|
||||
<includeBaseDirectory>false</includeBaseDirectory>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>../target/site/apidocs</directory>
|
||||
<outputDirectory>api</outputDirectory>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</assembly>
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
# PACKAGES antora@3.2.0-alpha.6 @antora/atlas-extension:1.0.0-alpha.1 @antora/collector-extension@1.0.0-alpha.3 @springio/antora-extensions@1.1.0-alpha.2 @asciidoctor/tabs@1.0.0-alpha.12 @opendevise/antora-release-line-extension@1.0.0-alpha.2
|
||||
#
|
||||
# The purpose of this Antora playbook is to build the docs in the current branch.
|
||||
antora:
|
||||
extensions:
|
||||
- '@antora/collector-extension'
|
||||
# - require: '@springio/antora-extensions/root-component-extension'
|
||||
- require: '@springio/antora-extensions'
|
||||
root_component_name: 'ai'
|
||||
site:
|
||||
title: Spring AI Reference
|
||||
url: https://docs.spring.io/spring-ai-mcp/reference
|
||||
robots: allow
|
||||
git:
|
||||
ensure_git_suffix: false
|
||||
content:
|
||||
sources:
|
||||
- url: ./../../../..
|
||||
branches: HEAD
|
||||
start_path: mcp-docs/src/main/antora
|
||||
worktrees: true
|
||||
asciidoc:
|
||||
attributes:
|
||||
page-related-doc-categories: ai,java,ml,mcp
|
||||
page-pagination: ''
|
||||
hide-uri-scheme: '@'
|
||||
tabs-sync-option: '@'
|
||||
chomp: 'all'
|
||||
stem: 'asciimath'
|
||||
extensions:
|
||||
- '@asciidoctor/tabs'
|
||||
- '@springio/asciidoctor-extensions'
|
||||
- '@springio/asciidoctor-extensions/javadoc-extension'
|
||||
- '@springio/asciidoctor-extensions/include-code-extension'
|
||||
- '@djencks/asciidoctor-mathjax'
|
||||
sourcemap: true
|
||||
urls:
|
||||
latest_version_segment_strategy: redirect:to
|
||||
latest_version_segment: ''
|
||||
redirect_facility: httpd
|
||||
runtime:
|
||||
log:
|
||||
failure_level: warn
|
||||
format: pretty
|
||||
ui:
|
||||
bundle:
|
||||
url: https://github.com/spring-io/antora-ui-spring/releases/download/v0.4.17/ui-bundle.zip
|
||||
snapshot: true
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
name: ai
|
||||
version: true
|
||||
title: Spring AI
|
||||
nav:
|
||||
- modules/ROOT/nav.adoc
|
||||
ext:
|
||||
collector:
|
||||
- run:
|
||||
command: mvnw process-resources
|
||||
local: true
|
||||
scan:
|
||||
dir: mcp-docs/target/classes/antora-resources
|
||||
|
|
@ -1,282 +0,0 @@
|
|||
@startuml Core Components
|
||||
|
||||
' Core Interfaces
|
||||
interface McpTransport {
|
||||
+Mono<Void> connect(Function<Mono<JSONRPCMessage>, Mono<JSONRPCMessage>> handler)
|
||||
+Mono<Void> sendMessage(JSONRPCMessage message)
|
||||
+void close()
|
||||
+Mono<Void> closeGracefully()
|
||||
+<T> T unmarshalFrom(Object data, TypeReference<T> typeRef)
|
||||
}
|
||||
|
||||
interface McpSession {
|
||||
+<T> Mono<T> sendRequest(String method, Object requestParams, TypeReference<T> typeRef)
|
||||
+Mono<Void> sendNotification(String method, Map<String, Object> params)
|
||||
+Mono<Void> closeGracefully()
|
||||
+void close()
|
||||
}
|
||||
|
||||
' Core Implementation Classes
|
||||
class DefaultMcpSession {
|
||||
+interface RequestHandler
|
||||
+interface NotificationHandler
|
||||
}
|
||||
|
||||
' Client Classes
|
||||
class McpClient {
|
||||
+{static} Builder using(ClientMcpTransport transport)
|
||||
}
|
||||
|
||||
class McpAsyncClient {
|
||||
+Mono<InitializeResult> initialize()
|
||||
+ServerCapabilities getServerCapabilities()
|
||||
+Implementation getServerInfo()
|
||||
+ClientCapabilities getClientCapabilities()
|
||||
+Implementation getClientInfo()
|
||||
+void close()
|
||||
+Mono<Void> closeGracefully()
|
||||
+Mono<Object> ping()
|
||||
+Mono<Void> addRoot(Root root)
|
||||
+Mono<Void> removeRoot(String rootUri)
|
||||
+Mono<Void> rootsListChangedNotification()
|
||||
+Mono<CallToolResult> callTool(CallToolRequest request)
|
||||
+Mono<ListToolsResult> listTools()
|
||||
+Mono<ListResourcesResult> listResources()
|
||||
+Mono<ReadResourceResult> readResource(ReadResourceRequest request)
|
||||
+Mono<ListResourceTemplatesResult> listResourceTemplates()
|
||||
+Mono<Void> subscribeResource(SubscribeRequest request)
|
||||
+Mono<Void> unsubscribeResource(UnsubscribeRequest request)
|
||||
+Mono<ListPromptsResult> listPrompts()
|
||||
+Mono<GetPromptResult> getPrompt(GetPromptRequest request)
|
||||
+Mono<Void> setLoggingLevel(LoggingLevel level)
|
||||
}
|
||||
|
||||
class McpSyncClient {
|
||||
+InitializeResult initialize()
|
||||
+ServerCapabilities getServerCapabilities()
|
||||
+Implementation getServerInfo()
|
||||
+ClientCapabilities getClientCapabilities()
|
||||
+Implementation getClientInfo()
|
||||
+void close()
|
||||
+boolean closeGracefully()
|
||||
+Object ping()
|
||||
+void addRoot(Root root)
|
||||
+void removeRoot(String rootUri)
|
||||
+void rootsListChangedNotification()
|
||||
+CallToolResult callTool(CallToolRequest request)
|
||||
+ListToolsResult listTools()
|
||||
+ListResourcesResult listResources()
|
||||
+ReadResourceResult readResource(ReadResourceRequest request)
|
||||
+ListResourceTemplatesResult listResourceTemplates()
|
||||
+void subscribeResource(SubscribeRequest request)
|
||||
+void unsubscribeResource(UnsubscribeRequest request)
|
||||
+ListPromptsResult listPrompts()
|
||||
+GetPromptResult getPrompt(GetPromptRequest request)
|
||||
+void setLoggingLevel(LoggingLevel level)
|
||||
}
|
||||
|
||||
' Server Classes
|
||||
class McpServer {
|
||||
+{static} Builder using(ServerMcpTransport transport)
|
||||
}
|
||||
|
||||
class McpAsyncServer {
|
||||
|
||||
+ServerCapabilities getServerCapabilities()
|
||||
+Implementation getServerInfo()
|
||||
+ClientCapabilities getClientCapabilities()
|
||||
+Implementation getClientInfo()
|
||||
+void close()
|
||||
+Mono<Void> closeGracefully()
|
||||
|
||||
' Tool Management
|
||||
+Mono<Void> addTool(ToolRegistration toolRegistration)
|
||||
+Mono<Void> removeTool(String toolName)
|
||||
+Mono<Void> notifyToolsListChanged()
|
||||
|
||||
' Resource Management
|
||||
+Mono<Void> addResource(ResourceRegistration resourceHandler)
|
||||
+Mono<Void> removeResource(String resourceUri)
|
||||
+Mono<Void> notifyResourcesListChanged()
|
||||
|
||||
' Prompt Management
|
||||
+Mono<Void> addPrompt(PromptRegistration promptRegistration)
|
||||
+Mono<Void> removePrompt(String promptName)
|
||||
+Mono<Void> notifyPromptsListChanged()
|
||||
|
||||
' Logging
|
||||
+Mono<Void> loggingNotification(LoggingMessageNotification notification)
|
||||
|
||||
' Sampling
|
||||
+Mono<CreateMessageResult> createMessage(CreateMessageRequest request)
|
||||
}
|
||||
|
||||
class McpSyncServer {
|
||||
+McpAsyncServer getAsyncServer()
|
||||
|
||||
+ServerCapabilities getServerCapabilities()
|
||||
+Implementation getServerInfo()
|
||||
+ClientCapabilities getClientCapabilities()
|
||||
+Implementation getClientInfo()
|
||||
+void close()
|
||||
+void closeGracefully()
|
||||
|
||||
' Tool Management
|
||||
+void addTool(ToolRegistration toolHandler)
|
||||
+void removeTool(String toolName)
|
||||
+void notifyToolsListChanged()
|
||||
|
||||
' Resource Management
|
||||
+void addResource(ResourceRegistration resourceHandler)
|
||||
+void removeResource(String resourceUri)
|
||||
+void notifyResourcesListChanged()
|
||||
|
||||
' Prompt Management
|
||||
+void addPrompt(PromptRegistration promptRegistration)
|
||||
+void removePrompt(String promptName)
|
||||
+void notifyPromptsListChanged()
|
||||
|
||||
' Logging
|
||||
+void loggingNotification(LoggingMessageNotification notification)
|
||||
|
||||
' Sampling
|
||||
+CreateMessageResult createMessage(CreateMessageRequest request)
|
||||
}
|
||||
|
||||
' Transport Implementations
|
||||
class StdioClientTransport implements ClientMcpTransport {
|
||||
+void setErrorHandler(Consumer<String> errorHandler)
|
||||
+Sinks.Many<String> getErrorSink()
|
||||
}
|
||||
|
||||
class StdioServerTransport implements ServerMcpTransport {
|
||||
}
|
||||
|
||||
|
||||
class HttpServletSseServerTransport implements ServerMcpTransport {
|
||||
}
|
||||
|
||||
|
||||
class HttpClientSseClientTransport implements ClientMcpTransport {
|
||||
}
|
||||
|
||||
|
||||
class WebFluxSseClientTransport implements ClientMcpTransport {
|
||||
}
|
||||
|
||||
|
||||
class WebFluxSseServerTransport implements ServerMcpTransport {
|
||||
+RouterFunction<?> getRouterFunction()
|
||||
}
|
||||
|
||||
class WebMvcSseServerTransport implements ServerMcpTransport {
|
||||
+RouterFunction<?> getRouterFunction()
|
||||
}
|
||||
|
||||
|
||||
' Schema and Error Classes
|
||||
class McpSchema {
|
||||
+class ErrorCodes
|
||||
+interface Request
|
||||
+interface JSONRPCMessage
|
||||
+interface ResourceContents
|
||||
+interface Content
|
||||
+interface ServerCapabilities
|
||||
+{static} JSONRPCMessage deserializeJsonRpcMessage()
|
||||
}
|
||||
|
||||
class McpError {
|
||||
}
|
||||
|
||||
' Relationships
|
||||
McpTransport <|.. ClientMcpTransport
|
||||
McpTransport <|.. ServerMcpTransport
|
||||
|
||||
McpSession <|.. DefaultMcpSession
|
||||
DefaultMcpSession --o McpAsyncClient
|
||||
DefaultMcpSession --o McpAsyncServer
|
||||
|
||||
McpClient ..> McpAsyncClient : creates
|
||||
McpClient ..> McpSyncClient : creates
|
||||
McpSyncClient --> McpAsyncClient : delegates to
|
||||
|
||||
McpServer ..> McpAsyncServer : creates
|
||||
McpServer ..> McpSyncServer : creates
|
||||
McpSyncServer o-- McpAsyncServer
|
||||
|
||||
DefaultMcpSession o-- McpTransport
|
||||
McpSchema <.. McpSession : uses
|
||||
McpError ..> McpSession : throws
|
||||
|
||||
@enduml
|
||||
|
||||
@startuml Message Flow
|
||||
|
||||
package "MCP Schema" {
|
||||
interface JSONRPCMessage {
|
||||
+String jsonrpc()
|
||||
}
|
||||
|
||||
interface Request {
|
||||
}
|
||||
|
||||
class InitializeRequest
|
||||
class CallToolRequest
|
||||
class ListToolsRequest
|
||||
class ListResourcesRequest
|
||||
class ReadResourceRequest
|
||||
class ListResourceTemplatesRequest
|
||||
class ListPromptsRequest
|
||||
class GetPromptRequest
|
||||
}
|
||||
|
||||
package "Resource Types" {
|
||||
interface ResourceContents {
|
||||
+String uri()
|
||||
+String mimeType()
|
||||
}
|
||||
|
||||
class TextResourceContents
|
||||
class BlobResourceContents
|
||||
|
||||
interface Content {
|
||||
+String type()
|
||||
}
|
||||
|
||||
class TextContent
|
||||
class ImageContent
|
||||
class EmbeddedResource
|
||||
|
||||
interface Annotated {
|
||||
+Annotations annotations()
|
||||
}
|
||||
|
||||
interface PromptOrResourceReference {
|
||||
+String type()
|
||||
}
|
||||
|
||||
class PromptReference
|
||||
class ResourceReference
|
||||
}
|
||||
|
||||
JSONRPCMessage <|.. Request
|
||||
Request <|.. InitializeRequest
|
||||
Request <|.. CallToolRequest
|
||||
Request <|.. ListToolsRequest
|
||||
Request <|.. ListResourcesRequest
|
||||
Request <|.. ReadResourceRequest
|
||||
Request <|.. ListResourceTemplatesRequest
|
||||
Request <|.. ListPromptsRequest
|
||||
Request <|.. GetPromptRequest
|
||||
|
||||
ResourceContents <|.. TextResourceContents
|
||||
ResourceContents <|.. BlobResourceContents
|
||||
|
||||
Content <|.. TextContent
|
||||
Content <|.. ImageContent
|
||||
Content <|.. EmbeddedResource
|
||||
|
||||
PromptOrResourceReference <|.. PromptReference
|
||||
PromptOrResourceReference <|.. ResourceReference
|
||||
|
||||
@enduml
|
||||
|
Before Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 686 KiB |
|
Before Width: | Height: | Size: 791 KiB |