Skip to content

Commit 904083c

Browse files
zcklytzolovchemicLdsp-ant
authored
(WIP) Base for Java docs (modelcontextprotocol#125)
* Base for Java docs * docs(java): Migrate Java-SDK/docs Add visual documentation for Java SDK architecture: - PlantUML class diagrams showing core components and relationships - Client and server architecture diagrams - Stack architecture overview - Generated UML class diagram with detailed implementation structure * Add Java Client and Server quickstarts * reorder, redact, correct java-sdk docs Signed-off-by: Dariusz Jędrzejczyk <[email protected]> * updated updates.mdx * fix docs.json --------- Signed-off-by: Dariusz Jędrzejczyk <[email protected]> Co-authored-by: Christian Tzolov <[email protected]> Co-authored-by: Dariusz Jędrzejczyk <[email protected]> Co-authored-by: David Soria Parra <[email protected]>
1 parent 1772fb8 commit 904083c

13 files changed

+1780
-5
lines changed

development/updates.mdx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@ title: "What's New"
33
description: 'The latest updates and improvements to MCP'
44
---
55

6+
<Update label="2025-02-07" description="Java SDK released">
7+
- We're excited to announce that the Java SDK developed by Spring AI at VMware Tanzu is now
8+
the official [Java SDK](https://github.com/modelcontextprotocol/java-sdk) for MCP.
9+
This joins our existing Kotlin SDK in our growing list of supported languages.
10+
The Spring AI team will maintain the SDK as an integral part of the Model Context Protocol
11+
organization. We're thrilled to welcome them to the MCP community!
12+
</Update>
13+
14+
<Update label="2025-01-27" description="Python SDK 1.2.1">
15+
- Version [1.2.1](https://github.com/modelcontextprotocol/python-sdk/releases/tag/v1.2.1) of the MCP Python SDK has been released,
16+
delivering important stability improvements and bug fixes.
17+
</Update>
618
<Update label="2025-01-18" description="SDK and Server Improvements">
719
- Simplified, express-like API in the [TypeScript SDK](https://github.com/modelcontextprotocol/typescript-sdk)
820
- Added 8 new clients to the [clients page](https://modelcontextprotocol.io/clients)
@@ -16,4 +28,4 @@ description: 'The latest updates and improvements to MCP'
1628
<Update label="2024-12-21" description="Kotlin SDK released">
1729
- Jetbrains released a Kotlin SDK for MCP!
1830
- For a sample MCP Kotlin server, check out [this repository](https://github.com/modelcontextprotocol/kotlin-sdk/tree/main/samples/kotlin-mcp-server)
19-
</Update>
31+
</Update>

docs.json

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99
},
1010
"favicon": "/favicon.svg",
1111
"navigation": {
12-
"anchors": [
12+
"tabs": [
1313
{
14-
"anchor": "Documentation",
15-
"icon": "book-open",
14+
"tab": "Documentation",
1615
"groups": [
1716
{
1817
"group": "Get Started",
@@ -59,6 +58,20 @@
5958
]
6059
}
6160
]
61+
},
62+
{
63+
"tab": "SDKs",
64+
"icon": "book-open",
65+
"groups": [
66+
{
67+
"group": "Java",
68+
"pages": [
69+
"sdk/java/mcp-overview",
70+
"sdk/java/mcp-client",
71+
"sdk/java/mcp-server"
72+
]
73+
}
74+
]
6275
}
6376
],
6477
"global": {

images/java/class-diagrams.puml

Lines changed: 282 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,282 @@
1+
@startuml Core Components
2+
3+
' Core Interfaces
4+
interface McpTransport {
5+
+Mono<Void> connect(Function<Mono<JSONRPCMessage>, Mono<JSONRPCMessage>> handler)
6+
+Mono<Void> sendMessage(JSONRPCMessage message)
7+
+void close()
8+
+Mono<Void> closeGracefully()
9+
+<T> T unmarshalFrom(Object data, TypeReference<T> typeRef)
10+
}
11+
12+
interface McpSession {
13+
+<T> Mono<T> sendRequest(String method, Object requestParams, TypeReference<T> typeRef)
14+
+Mono<Void> sendNotification(String method, Map<String, Object> params)
15+
+Mono<Void> closeGracefully()
16+
+void close()
17+
}
18+
19+
' Core Implementation Classes
20+
class DefaultMcpSession {
21+
+interface RequestHandler
22+
+interface NotificationHandler
23+
}
24+
25+
' Client Classes
26+
class McpClient {
27+
+{static} Builder using(ClientMcpTransport transport)
28+
}
29+
30+
class McpAsyncClient {
31+
+Mono<InitializeResult> initialize()
32+
+ServerCapabilities getServerCapabilities()
33+
+Implementation getServerInfo()
34+
+ClientCapabilities getClientCapabilities()
35+
+Implementation getClientInfo()
36+
+void close()
37+
+Mono<Void> closeGracefully()
38+
+Mono<Object> ping()
39+
+Mono<Void> addRoot(Root root)
40+
+Mono<Void> removeRoot(String rootUri)
41+
+Mono<Void> rootsListChangedNotification()
42+
+Mono<CallToolResult> callTool(CallToolRequest request)
43+
+Mono<ListToolsResult> listTools()
44+
+Mono<ListResourcesResult> listResources()
45+
+Mono<ReadResourceResult> readResource(ReadResourceRequest request)
46+
+Mono<ListResourceTemplatesResult> listResourceTemplates()
47+
+Mono<Void> subscribeResource(SubscribeRequest request)
48+
+Mono<Void> unsubscribeResource(UnsubscribeRequest request)
49+
+Mono<ListPromptsResult> listPrompts()
50+
+Mono<GetPromptResult> getPrompt(GetPromptRequest request)
51+
+Mono<Void> setLoggingLevel(LoggingLevel level)
52+
}
53+
54+
class McpSyncClient {
55+
+InitializeResult initialize()
56+
+ServerCapabilities getServerCapabilities()
57+
+Implementation getServerInfo()
58+
+ClientCapabilities getClientCapabilities()
59+
+Implementation getClientInfo()
60+
+void close()
61+
+boolean closeGracefully()
62+
+Object ping()
63+
+void addRoot(Root root)
64+
+void removeRoot(String rootUri)
65+
+void rootsListChangedNotification()
66+
+CallToolResult callTool(CallToolRequest request)
67+
+ListToolsResult listTools()
68+
+ListResourcesResult listResources()
69+
+ReadResourceResult readResource(ReadResourceRequest request)
70+
+ListResourceTemplatesResult listResourceTemplates()
71+
+void subscribeResource(SubscribeRequest request)
72+
+void unsubscribeResource(UnsubscribeRequest request)
73+
+ListPromptsResult listPrompts()
74+
+GetPromptResult getPrompt(GetPromptRequest request)
75+
+void setLoggingLevel(LoggingLevel level)
76+
}
77+
78+
' Server Classes
79+
class McpServer {
80+
+{static} Builder using(ServerMcpTransport transport)
81+
}
82+
83+
class McpAsyncServer {
84+
85+
+ServerCapabilities getServerCapabilities()
86+
+Implementation getServerInfo()
87+
+ClientCapabilities getClientCapabilities()
88+
+Implementation getClientInfo()
89+
+void close()
90+
+Mono<Void> closeGracefully()
91+
92+
' Tool Management
93+
+Mono<Void> addTool(ToolRegistration toolRegistration)
94+
+Mono<Void> removeTool(String toolName)
95+
+Mono<Void> notifyToolsListChanged()
96+
97+
' Resource Management
98+
+Mono<Void> addResource(ResourceRegistration resourceHandler)
99+
+Mono<Void> removeResource(String resourceUri)
100+
+Mono<Void> notifyResourcesListChanged()
101+
102+
' Prompt Management
103+
+Mono<Void> addPrompt(PromptRegistration promptRegistration)
104+
+Mono<Void> removePrompt(String promptName)
105+
+Mono<Void> notifyPromptsListChanged()
106+
107+
' Logging
108+
+Mono<Void> loggingNotification(LoggingMessageNotification notification)
109+
110+
' Sampling
111+
+Mono<CreateMessageResult> createMessage(CreateMessageRequest request)
112+
}
113+
114+
class McpSyncServer {
115+
+McpAsyncServer getAsyncServer()
116+
117+
+ServerCapabilities getServerCapabilities()
118+
+Implementation getServerInfo()
119+
+ClientCapabilities getClientCapabilities()
120+
+Implementation getClientInfo()
121+
+void close()
122+
+void closeGracefully()
123+
124+
' Tool Management
125+
+void addTool(ToolRegistration toolHandler)
126+
+void removeTool(String toolName)
127+
+void notifyToolsListChanged()
128+
129+
' Resource Management
130+
+void addResource(ResourceRegistration resourceHandler)
131+
+void removeResource(String resourceUri)
132+
+void notifyResourcesListChanged()
133+
134+
' Prompt Management
135+
+void addPrompt(PromptRegistration promptRegistration)
136+
+void removePrompt(String promptName)
137+
+void notifyPromptsListChanged()
138+
139+
' Logging
140+
+void loggingNotification(LoggingMessageNotification notification)
141+
142+
' Sampling
143+
+CreateMessageResult createMessage(CreateMessageRequest request)
144+
}
145+
146+
' Transport Implementations
147+
class StdioClientTransport implements ClientMcpTransport {
148+
+void setErrorHandler(Consumer<String> errorHandler)
149+
+Sinks.Many<String> getErrorSink()
150+
}
151+
152+
class StdioServerTransport implements ServerMcpTransport {
153+
}
154+
155+
156+
class HttpServletSseServerTransport implements ServerMcpTransport {
157+
}
158+
159+
160+
class HttpClientSseClientTransport implements ClientMcpTransport {
161+
}
162+
163+
164+
class WebFluxSseClientTransport implements ClientMcpTransport {
165+
}
166+
167+
168+
class WebFluxSseServerTransport implements ServerMcpTransport {
169+
+RouterFunction<?> getRouterFunction()
170+
}
171+
172+
class WebMvcSseServerTransport implements ServerMcpTransport {
173+
+RouterFunction<?> getRouterFunction()
174+
}
175+
176+
177+
' Schema and Error Classes
178+
class McpSchema {
179+
+class ErrorCodes
180+
+interface Request
181+
+interface JSONRPCMessage
182+
+interface ResourceContents
183+
+interface Content
184+
+interface ServerCapabilities
185+
+{static} JSONRPCMessage deserializeJsonRpcMessage()
186+
}
187+
188+
class McpError {
189+
}
190+
191+
' Relationships
192+
McpTransport <|.. ClientMcpTransport
193+
McpTransport <|.. ServerMcpTransport
194+
195+
McpSession <|.. DefaultMcpSession
196+
DefaultMcpSession --o McpAsyncClient
197+
DefaultMcpSession --o McpAsyncServer
198+
199+
McpClient ..> McpAsyncClient : creates
200+
McpClient ..> McpSyncClient : creates
201+
McpSyncClient --> McpAsyncClient : delegates to
202+
203+
McpServer ..> McpAsyncServer : creates
204+
McpServer ..> McpSyncServer : creates
205+
McpSyncServer o-- McpAsyncServer
206+
207+
DefaultMcpSession o-- McpTransport
208+
McpSchema <.. McpSession : uses
209+
McpError ..> McpSession : throws
210+
211+
@enduml
212+
213+
@startuml Message Flow
214+
215+
package "MCP Schema" {
216+
interface JSONRPCMessage {
217+
+String jsonrpc()
218+
}
219+
220+
interface Request {
221+
}
222+
223+
class InitializeRequest
224+
class CallToolRequest
225+
class ListToolsRequest
226+
class ListResourcesRequest
227+
class ReadResourceRequest
228+
class ListResourceTemplatesRequest
229+
class ListPromptsRequest
230+
class GetPromptRequest
231+
}
232+
233+
package "Resource Types" {
234+
interface ResourceContents {
235+
+String uri()
236+
+String mimeType()
237+
}
238+
239+
class TextResourceContents
240+
class BlobResourceContents
241+
242+
interface Content {
243+
+String type()
244+
}
245+
246+
class TextContent
247+
class ImageContent
248+
class EmbeddedResource
249+
250+
interface Annotated {
251+
+Annotations annotations()
252+
}
253+
254+
interface PromptOrResourceReference {
255+
+String type()
256+
}
257+
258+
class PromptReference
259+
class ResourceReference
260+
}
261+
262+
JSONRPCMessage <|.. Request
263+
Request <|.. InitializeRequest
264+
Request <|.. CallToolRequest
265+
Request <|.. ListToolsRequest
266+
Request <|.. ListResourcesRequest
267+
Request <|.. ReadResourceRequest
268+
Request <|.. ListResourceTemplatesRequest
269+
Request <|.. ListPromptsRequest
270+
Request <|.. GetPromptRequest
271+
272+
ResourceContents <|.. TextResourceContents
273+
ResourceContents <|.. BlobResourceContents
274+
275+
Content <|.. TextContent
276+
Content <|.. ImageContent
277+
Content <|.. EmbeddedResource
278+
279+
PromptOrResourceReference <|.. PromptReference
280+
PromptOrResourceReference <|.. ResourceReference
281+
282+
@enduml
661 KB
Loading
840 KB
Loading

images/java/java-mcp-uml-classdiagram.svg

Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)