Commit 1d72d81
authored
[fel] Enhanced MCP Client and Server Interaction with Tool Management Improvements (#141)
This commit introduces several enhancements to the MCP (Model Communication Protocol) client and server interaction, focusing on improving tool management and communication capabilities. Key changes include:
1. ToolInfo Interface Expansion:
- Added a new static method parseIdentifier to parse tool identifiers into namespace and tool name components, enhancing tool identification and management.
2. MCP Client Enhancements:
- Updated the DefaultMcpClient class to support more robust initialization and communication with the MCP server.
- Introduced new methods for handling Server-Sent Events (SSE) and improved error handling for tool calls.
- Enhanced the callTool method to return results directly and manage pending requests more efficiently.
3. MCP Server Adjustments:
- Modified the McpServer interface and its implementations to better support tool addition and retrieval.
- Updated the DefaultMcpServer to provide a more structured server schema and improved tool registration logic.
4. Weather Service Example:
- Introduced a new weather service example (WeatherService and WeatherServiceImpl) to demonstrate tool implementation and usage within the MCP framework.
5. Code Structure and Cleanup:
- Reorganized and cleaned up code in various classes to improve readability and maintainability.
- Removed deprecated or unused code related to the MCP server entity.
6. Dependency and Plugin Updates:
- Added new dependencies and updated plugins in the pom.xml file to support the enhanced MCP functionality.
7. Test Code Updates:
- Expanded test cases for the MCP client and server to ensure compatibility and functionality of the new features.
These changes collectively enhance the MCP framework's ability to manage and interact with tools, providing a more robust and flexible platform for model communication and execution.1 parent 43566e8 commit 1d72d81
File tree
38 files changed
+593
-435
lines changed- framework
- fel/java
- fel-core/src/main/java/modelengine/fel/core/tool
- plugins
- tool-executor/src/main/java/modelengine/fel/tool/support
- tool-mcp-client/src/main/java/modelengine/fel/tool/mcp/client/support
- tool-mcp-server/src
- main/java/modelengine/fel/tool/mcp/server
- handler
- support
- test/java/modelengine/fel/tool/mcp/server
- support
- tool-mcp-test
- src/main/java/modelengine/fel/tool/mcp/test
- tool
- tool-repository-simple/src/main/java/modelengine/fel/tool/support
- services
- tool-mcp-client-service/src/main/java/modelengine/fel/tool/mcp/client
- tool-mcp-common/src/main/java/modelengine/fel/tool/mcp/entity
- tool-service/src/main/java/modelengine/fel/tool/service
- fit/java/fit-builtin
- plugins
- fit-http-client-okhttp/src/main/java/modelengine/fit/http/client/okhttp
- fit-http-handler-registry/src/test/java/modelengine/fit/http/server/handler
- support
- fit-http-server-netty/src/main/java/modelengine/fit/http/server/netty
- services
- fit-http-classic/definition/src
- main/java/modelengine/fit/http
- support
- util
- test/java/modelengine/fit/http
- client
- support
- server/handler
- support
- fit-http-protocol/definition/src
- main/java/modelengine/fit/http/protocol
- support
- util
- test/java/modelengine/fit/http/protocol/support
38 files changed
+593
-435
lines changedLines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
144 | 161 | | |
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
73 | | - | |
| 74 | + | |
| 75 | + | |
74 | 76 | | |
75 | 77 | | |
76 | 78 | | |
77 | 79 | | |
78 | 80 | | |
79 | | - | |
| 81 | + | |
| 82 | + | |
80 | 83 | | |
81 | 84 | | |
82 | 85 | | |
| |||
Lines changed: 107 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | | - | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| 30 | + | |
29 | 31 | | |
| 32 | + | |
30 | 33 | | |
| 34 | + | |
31 | 35 | | |
32 | 36 | | |
33 | 37 | | |
| |||
54 | 58 | | |
55 | 59 | | |
56 | 60 | | |
57 | | - | |
| 61 | + | |
| 62 | + | |
58 | 63 | | |
59 | 64 | | |
60 | 65 | | |
61 | | - | |
| 66 | + | |
62 | 67 | | |
63 | | - | |
| 68 | + | |
64 | 69 | | |
65 | 70 | | |
66 | 71 | | |
67 | 72 | | |
68 | 73 | | |
69 | 74 | | |
| 75 | + | |
70 | 76 | | |
71 | 77 | | |
72 | 78 | | |
73 | 79 | | |
74 | 80 | | |
75 | 81 | | |
76 | | - | |
| 82 | + | |
| 83 | + | |
77 | 84 | | |
78 | | - | |
| 85 | + | |
| 86 | + | |
79 | 87 | | |
80 | 88 | | |
81 | | - | |
| 89 | + | |
| 90 | + | |
82 | 91 | | |
83 | 92 | | |
84 | 93 | | |
85 | 94 | | |
86 | 95 | | |
87 | | - | |
| 96 | + | |
| 97 | + | |
88 | 98 | | |
89 | 99 | | |
90 | 100 | | |
| |||
125 | 135 | | |
126 | 136 | | |
127 | 137 | | |
128 | | - | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
129 | 145 | | |
130 | 146 | | |
131 | 147 | | |
| |||
157 | 173 | | |
158 | 174 | | |
159 | 175 | | |
160 | | - | |
| 176 | + | |
| 177 | + | |
161 | 178 | | |
162 | 179 | | |
163 | 180 | | |
| |||
183 | 200 | | |
184 | 201 | | |
185 | 202 | | |
186 | | - | |
187 | | - | |
188 | | - | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
189 | 208 | | |
190 | 209 | | |
191 | | - | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
192 | 214 | | |
193 | 215 | | |
194 | 216 | | |
| |||
223 | 245 | | |
224 | 246 | | |
225 | 247 | | |
226 | | - | |
227 | | - | |
228 | | - | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
229 | 251 | | |
230 | 252 | | |
231 | 253 | | |
| |||
249 | 271 | | |
250 | 272 | | |
251 | 273 | | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
252 | 280 | | |
253 | 281 | | |
254 | 282 | | |
255 | 283 | | |
256 | 284 | | |
257 | | - | |
| 285 | + | |
| 286 | + | |
258 | 287 | | |
259 | 288 | | |
260 | 289 | | |
| |||
292 | 321 | | |
293 | 322 | | |
294 | 323 | | |
| 324 | + | |
295 | 325 | | |
296 | 326 | | |
297 | 327 | | |
| |||
301 | 331 | | |
302 | 332 | | |
303 | 333 | | |
304 | | - | |
305 | 334 | | |
| 335 | + | |
306 | 336 | | |
307 | 337 | | |
308 | 338 | | |
309 | 339 | | |
310 | 340 | | |
311 | 341 | | |
312 | 342 | | |
313 | | - | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
314 | 401 | | |
315 | 402 | | |
316 | 403 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
48 | | - | |
| 47 | + | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
Lines changed: 11 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
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 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| |||
0 commit comments