Commit abd0fac
committed
feat: Add MCP server with Server stdio/sse transport improve MCP client
- Implement MCP server with async/sync support and builder pattern configuration
- Add Server stdio/SSE transport layers with robust error handling
- Convert McpClient and McpServer to interfaces for better extensibility
- Add sampling capabilities for LLM interactions (text/image)
- Implement dynamic root management and runtime tool management
- Add comprehensive prompt and resource capabilities
- Add support for dynamic root management (add/remove roots at runtime)
Architecture Changes
- Introduce registration records for tools, resources, and prompts
- Improve thread safety with concurrent collections
- Enhance resource template handling
- Implement builder patterns for Server/Client capabilities
- Add support for server capabilities and implementation info
Transport Layer:
- Implement SseServerTransport with SSE endpoints
- Add StdioServerTransport for process-based communication
- Reorganize transport packages for better organization
- Improve transport error handling and shutdown processes
Documentation:
- Add detailed MCP reference documentation
- Include architecture diagrams and API documentation
- Add comprehensive test coverage for all components
- Include sample projects demonstrating stdio/SSE transports
BREAKING CHANGES:
Transport Package Reorganization
- Move StdioClientTransport to o.s.ai.mcp.client.transport
- Move SseClientTransport to o.s.ai.mcp.client.transport
- Move ServerParameters to o.s.ai.mcp.client.transport
- StdioClientTransport.errorHandler changed to private with
setter method Migration: Use setErrorHandler() method
instead of direct field access
API Changes
- Replace static factory methods with builder pattern
- Update ServerCapabilities to use builder pattern
- Make StdioClientTransport.errorHandler private with setter
- Replace rootsListProvider with direct root management
- Remove deprecated static factory methods
Resolves modelcontextprotocol#27,modelcontextprotocol#25,modelcontextprotocol#24,modelcontextprotocol#11
Related to modelcontextprotocol#121 parent c83a45f commit abd0fac
57 files changed
Lines changed: 5727 additions & 471 deletions
File tree
- docs
- mcp
- src
- main/java/org/springframework/ai/mcp
- client
- transport
- server
- transport
- spec
- test/java/org/springframework/ai/mcp
- attic
- client
- transport
- server
- transport
- spring-ai-mcp-sample
- src/main
- java/org/springframework/ai/mcp/sample
- client
- server
- resources
- spring-ai-mcp
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
| 88 | + | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| |||
This file was deleted.
Loading
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | | - | |
5 | | - | |
6 | | - | |
| 5 | + | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | | - | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| 23 | + | |
| 24 | + | |
21 | 25 | | |
22 | 26 | | |
| 27 | + | |
23 | 28 | | |
24 | | - | |
25 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
26 | 32 | | |
27 | 33 | | |
28 | 34 | | |
29 | 35 | | |
30 | | - | |
| 36 | + | |
31 | 37 | | |
32 | 38 | | |
33 | | - | |
| 39 | + | |
| 40 | + | |
34 | 41 | | |
35 | | - | |
| 42 | + | |
36 | 43 | | |
37 | 44 | | |
38 | 45 | | |
39 | 46 | | |
40 | | - | |
| 47 | + | |
41 | 48 | | |
42 | 49 | | |
43 | | - | |
| 50 | + | |
| 51 | + | |
44 | 52 | | |
45 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
46 | 59 | | |
47 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
48 | 80 | | |
49 | 81 | | |
50 | 82 | | |
| |||
54 | 86 | | |
55 | 87 | | |
56 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
57 | 96 | | |
58 | 97 | | |
59 | 98 | | |
60 | 99 | | |
61 | 100 | | |
62 | 101 | | |
| 102 | + | |
| 103 | + | |
63 | 104 | | |
64 | 105 | | |
65 | 106 | | |
66 | 107 | | |
67 | 108 | | |
68 | 109 | | |
69 | 110 | | |
70 | | - | |
71 | | - | |
72 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
73 | 118 | | |
| 119 | + | |
| 120 | + | |
74 | 121 | | |
75 | 122 | | |
76 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
77 | 129 | | |
78 | 130 | | |
79 | 131 | | |
| |||
92 | 144 | | |
93 | 145 | | |
94 | 146 | | |
95 | | - | |
96 | | - | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
97 | 152 | | |
98 | 153 | | |
99 | 154 | | |
| |||
113 | 168 | | |
114 | 169 | | |
115 | 170 | | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
116 | 182 | | |
117 | 183 | | |
118 | 184 | | |
119 | 185 | | |
120 | 186 | | |
121 | | - | |
122 | | - | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
123 | 192 | | |
124 | 193 | | |
125 | 194 | | |
| |||
129 | 198 | | |
130 | 199 | | |
131 | 200 | | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
132 | 204 | | |
0 commit comments