Add docs for the mcp/client-starter projects
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
This commit is contained in:
@@ -1,58 +0,0 @@
|
||||
2025-02-09T21:26:38.153+01:00 INFO 95924 --- [main] .s.a.m.s.s.s.McpServletServerApplication : Starting McpServletServerApplication using Java 17.0.12 with PID 95924 (/Users/christiantzolov/Dev/projects/spring-ai-examples/model-context-protocol/book-library/manual-servlet-server/target/classes started by christiantzolov in /Users/christiantzolov/Dev/projects/spring-ai-examples)
|
||||
2025-02-09T21:26:38.154+01:00 INFO 95924 --- [main] .s.a.m.s.s.s.McpServletServerApplication : No active profile set, falling back to 1 default profile: "default"
|
||||
2025-02-09T21:26:38.468+01:00 INFO 95924 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port 8080 (http)
|
||||
2025-02-09T21:26:38.473+01:00 INFO 95924 --- [main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
|
||||
2025-02-09T21:26:38.473+01:00 INFO 95924 --- [main] o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/10.1.33]
|
||||
2025-02-09T21:26:38.493+01:00 INFO 95924 --- [main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
|
||||
2025-02-09T21:26:38.493+01:00 INFO 95924 --- [main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 319 ms
|
||||
2025-02-09T21:26:38.711+01:00 INFO 95924 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port 8080 (http) with context path '/'
|
||||
2025-02-09T21:26:38.715+01:00 INFO 95924 --- [main] .s.a.m.s.s.s.McpServletServerApplication : Started McpServletServerApplication in 0.731 seconds (process running for 0.85)
|
||||
2025-02-09T21:26:43.707+01:00 INFO 95924 --- [http-nio-8080-exec-2] i.m.spec.DefaultMcpSession : Received request: JSONRPCRequest[jsonrpc=2.0, method=initialize, id=6c0682de-0, params={protocolVersion=2024-11-05, capabilities={}, clientInfo={name=Java SDK MCP Client, version=1.0.0}}]
|
||||
2025-02-09T21:26:43.711+01:00 INFO 95924 --- [http-nio-8080-exec-2] i.m.server.McpAsyncServer : Client initialize request - Protocol: 2024-11-05, Capabilities: ClientCapabilities[experimental=null, roots=null, sampling=null], Info: Implementation[name=Java SDK MCP Client, version=1.0.0]
|
||||
2025-02-09T21:26:43.756+01:00 INFO 95924 --- [http-nio-8080-exec-3] i.m.spec.DefaultMcpSession : Received notification: JSONRPCNotification[jsonrpc=2.0, method=notifications/initialized, params=null]
|
||||
2025-02-09T21:26:43.758+01:00 INFO 95924 --- [http-nio-8080-exec-4] i.m.spec.DefaultMcpSession : Received request: JSONRPCRequest[jsonrpc=2.0, method=ping, id=6c0682de-1, params=null]
|
||||
2025-02-09T21:26:43.760+01:00 INFO 95924 --- [http-nio-8080-exec-5] i.m.spec.DefaultMcpSession : Received request: JSONRPCRequest[jsonrpc=2.0, method=tools/list, id=6c0682de-2, params={}]
|
||||
2025-02-09T21:26:43.770+01:00 INFO 95924 --- [http-nio-8080-exec-6] i.m.spec.DefaultMcpSession : Received request: JSONRPCRequest[jsonrpc=2.0, method=tools/call, id=6c0682de-3, params={name=toUpperCase, arguments={input=accountName}}]
|
||||
2025-02-09T21:26:43.794+01:00 INFO 95924 --- [http-nio-8080-exec-7] i.m.spec.DefaultMcpSession : Received request: JSONRPCRequest[jsonrpc=2.0, method=tools/call, id=6c0682de-4, params={name=getBooks, arguments={title=Spring Framework}}]
|
||||
2025-02-09T21:26:44.908+01:00 INFO 95924 --- [http-nio-8080-exec-8] i.m.spec.DefaultMcpSession : Received request: JSONRPCRequest[jsonrpc=2.0, method=resources/list, id=6c0682de-5, params={}]
|
||||
2025-02-09T21:26:44.917+01:00 INFO 95924 --- [http-nio-8080-exec-9] i.m.spec.DefaultMcpSession : Received request: JSONRPCRequest[jsonrpc=2.0, method=resources/read, id=6c0682de-6, params={uri=system://info}]
|
||||
2025-02-09T21:26:44.927+01:00 INFO 95924 --- [http-nio-8080-exec-10] i.m.spec.DefaultMcpSession : Received request: JSONRPCRequest[jsonrpc=2.0, method=prompts/list, id=6c0682de-7, params={}]
|
||||
2025-02-09T21:26:44.934+01:00 INFO 95924 --- [http-nio-8080-exec-1] i.m.spec.DefaultMcpSession : Received request: JSONRPCRequest[jsonrpc=2.0, method=prompts/get, id=6c0682de-8, params={name=greeting, arguments={name=Spring}}]
|
||||
2025-02-09T21:26:46.642+01:00 ERROR 95924 --- [SpringApplicationShutdownHook] reactor.core.publisher.Operators : Operator called default onErrorDropped
|
||||
|
||||
reactor.core.Exceptions$ErrorCallbackNotImplemented: java.lang.IllegalStateException: The request associated with the AsyncContext has already completed processing.
|
||||
Caused by: java.lang.IllegalStateException: The request associated with the AsyncContext has already completed processing.
|
||||
at org.apache.catalina.core.AsyncContextImpl.check(AsyncContextImpl.java:529) ~[tomcat-embed-core-10.1.33.jar:10.1.33]
|
||||
at org.apache.catalina.core.AsyncContextImpl.complete(AsyncContextImpl.java:92) ~[tomcat-embed-core-10.1.33.jar:10.1.33]
|
||||
at io.modelcontextprotocol.server.transport.HttpServletSseServerTransport.removeSession(HttpServletSseServerTransport.java:379) ~[mcp-0.7.0-SNAPSHOT.jar:0.7.0-SNAPSHOT]
|
||||
at java.base/java.util.concurrent.ConcurrentHashMap$ValuesView.forEach(ConcurrentHashMap.java:4780) ~[na:na]
|
||||
at io.modelcontextprotocol.server.transport.HttpServletSseServerTransport.lambda$closeGracefully$4(HttpServletSseServerTransport.java:351) ~[mcp-0.7.0-SNAPSHOT.jar:0.7.0-SNAPSHOT]
|
||||
at reactor.core.publisher.MonoCreate.subscribe(MonoCreate.java:61) ~[reactor-core-3.6.12.jar:3.6.12]
|
||||
at reactor.core.publisher.Mono.subscribe(Mono.java:4576) ~[reactor-core-3.6.12.jar:3.6.12]
|
||||
at reactor.core.publisher.Mono.subscribeWith(Mono.java:4642) ~[reactor-core-3.6.12.jar:3.6.12]
|
||||
at reactor.core.publisher.Mono.subscribe(Mono.java:4403) ~[reactor-core-3.6.12.jar:3.6.12]
|
||||
at io.modelcontextprotocol.spec.McpTransport.close(McpTransport.java:61) ~[mcp-0.7.0-SNAPSHOT.jar:0.7.0-SNAPSHOT]
|
||||
at io.modelcontextprotocol.server.transport.HttpServletSseServerTransport.close(HttpServletSseServerTransport.java:323) ~[mcp-0.7.0-SNAPSHOT.jar:0.7.0-SNAPSHOT]
|
||||
at io.modelcontextprotocol.spec.DefaultMcpSession.close(DefaultMcpSession.java:283) ~[mcp-0.7.0-SNAPSHOT.jar:0.7.0-SNAPSHOT]
|
||||
at io.modelcontextprotocol.server.McpAsyncServer.close(McpAsyncServer.java:255) ~[mcp-0.7.0-SNAPSHOT.jar:0.7.0-SNAPSHOT]
|
||||
at io.modelcontextprotocol.server.McpSyncServer.close(McpSyncServer.java:205) ~[mcp-0.7.0-SNAPSHOT.jar:0.7.0-SNAPSHOT]
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
|
||||
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
|
||||
at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
|
||||
at org.springframework.beans.factory.support.DisposableBeanAdapter.invokeCustomDestroyMethod(DisposableBeanAdapter.java:316) ~[spring-beans-6.1.15.jar:6.1.15]
|
||||
at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:249) ~[spring-beans-6.1.15.jar:6.1.15]
|
||||
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:587) ~[spring-beans-6.1.15.jar:6.1.15]
|
||||
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:559) ~[spring-beans-6.1.15.jar:6.1.15]
|
||||
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:1202) ~[spring-beans-6.1.15.jar:6.1.15]
|
||||
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:520) ~[spring-beans-6.1.15.jar:6.1.15]
|
||||
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:1195) ~[spring-beans-6.1.15.jar:6.1.15]
|
||||
at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1195) ~[spring-context-6.1.15.jar:6.1.15]
|
||||
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1156) ~[spring-context-6.1.15.jar:6.1.15]
|
||||
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.doClose(ServletWebServerApplicationContext.java:174) ~[spring-boot-3.3.6.jar:3.3.6]
|
||||
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1102) ~[spring-context-6.1.15.jar:6.1.15]
|
||||
at org.springframework.boot.SpringApplicationShutdownHook.closeAndWait(SpringApplicationShutdownHook.java:145) ~[spring-boot-3.3.6.jar:3.3.6]
|
||||
at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[na:na]
|
||||
at org.springframework.boot.SpringApplicationShutdownHook.run(SpringApplicationShutdownHook.java:114) ~[spring-boot-3.3.6.jar:3.3.6]
|
||||
at java.base/java.lang.Thread.run(Thread.java:842) ~[na:na]
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
2025-02-09T21:25:36.624+01:00 INFO 95283 --- [main] o.s.a.m.s.server.McpServerApplication : Starting McpServerApplication using Java 17.0.12 with PID 95283 (/Users/christiantzolov/Dev/projects/spring-ai-examples/model-context-protocol/book-library/manual-webflux-server/target/classes started by christiantzolov in /Users/christiantzolov/Dev/projects/spring-ai-examples)
|
||||
2025-02-09T21:25:36.625+01:00 INFO 95283 --- [main] o.s.a.m.s.server.McpServerApplication : No active profile set, falling back to 1 default profile: "default"
|
||||
2025-02-09T21:25:38.595+01:00 WARN 95283 --- [main] o.s.c.support.DefaultLifecycleProcessor : Failed to stop bean 'reactorResourceFactory'
|
||||
|
||||
reactor.core.Exceptions$ReactiveException: java.lang.InterruptedException
|
||||
at reactor.core.Exceptions.propagate(Exceptions.java:410) ~[reactor-core-3.6.12.jar:3.6.12]
|
||||
at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:96) ~[reactor-core-3.6.12.jar:3.6.12]
|
||||
at reactor.core.publisher.Mono.block(Mono.java:1779) ~[reactor-core-3.6.12.jar:3.6.12]
|
||||
at org.springframework.http.client.ReactorResourceFactory.stop(ReactorResourceFactory.java:298) ~[spring-web-6.1.15.jar:6.1.15]
|
||||
at org.springframework.context.SmartLifecycle.stop(SmartLifecycle.java:117) ~[spring-context-6.1.15.jar:6.1.15]
|
||||
at org.springframework.context.support.DefaultLifecycleProcessor.doStop(DefaultLifecycleProcessor.java:346) ~[spring-context-6.1.15.jar:6.1.15]
|
||||
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.stop(DefaultLifecycleProcessor.java:488) ~[spring-context-6.1.15.jar:6.1.15]
|
||||
at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[na:na]
|
||||
at org.springframework.context.support.DefaultLifecycleProcessor.stopBeans(DefaultLifecycleProcessor.java:315) ~[spring-context-6.1.15.jar:6.1.15]
|
||||
at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:207) ~[spring-context-6.1.15.jar:6.1.15]
|
||||
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:990) ~[spring-context-6.1.15.jar:6.1.15]
|
||||
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:628) ~[spring-context-6.1.15.jar:6.1.15]
|
||||
at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:66) ~[spring-boot-3.3.6.jar:3.3.6]
|
||||
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-3.3.6.jar:3.3.6]
|
||||
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456) ~[spring-boot-3.3.6.jar:3.3.6]
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:335) ~[spring-boot-3.3.6.jar:3.3.6]
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1363) ~[spring-boot-3.3.6.jar:3.3.6]
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1352) ~[spring-boot-3.3.6.jar:3.3.6]
|
||||
at org.springframework.ai.mcp.sample.server.McpServerApplication.main(McpServerApplication.java:10) ~[classes/:na]
|
||||
Caused by: java.lang.InterruptedException: null
|
||||
at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1048) ~[na:na]
|
||||
at java.base/java.util.concurrent.CountDownLatch.await(CountDownLatch.java:230) ~[na:na]
|
||||
at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:91) ~[reactor-core-3.6.12.jar:3.6.12]
|
||||
... 17 common frames omitted
|
||||
|
||||
2025-02-09T21:25:38.599+01:00 WARN 95283 --- [main] onfigReactiveWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'
|
||||
2025-02-09T21:25:38.609+01:00 INFO 95283 --- [main] o.s.a.m.s.t.WebFluxSseServerTransport : Graceful shutdown completed
|
||||
2025-02-09T21:25:38.610+01:00 INFO 95283 --- [main] o.s.a.m.s.t.WebFluxSseServerTransport : Graceful shutdown completed
|
||||
2025-02-09T21:25:44.586+01:00 INFO 95411 --- [main] o.s.a.m.s.server.McpServerApplication : Starting McpServerApplication using Java 17.0.12 with PID 95411 (/Users/christiantzolov/Dev/projects/spring-ai-examples/model-context-protocol/book-library/manual-webflux-server/target/classes started by christiantzolov in /Users/christiantzolov/Dev/projects/spring-ai-examples)
|
||||
2025-02-09T21:25:44.587+01:00 INFO 95411 --- [main] o.s.a.m.s.server.McpServerApplication : No active profile set, falling back to 1 default profile: "default"
|
||||
2025-02-09T21:25:45.244+01:00 INFO 95411 --- [main] o.s.b.web.embedded.netty.NettyWebServer : Netty started on port 8080 (http)
|
||||
2025-02-09T21:25:45.252+01:00 INFO 95411 --- [main] o.s.a.m.s.server.McpServerApplication : Started McpServerApplication in 0.833 seconds (process running for 0.968)
|
||||
2025-02-09T21:25:49.434+01:00 INFO 95411 --- [reactor-http-nio-3] o.s.ai.mcp.spec.DefaultMcpSession : Received request: JSONRPCRequest[jsonrpc=2.0, method=initialize, id=12e95de7-0, params={protocolVersion=2024-11-05, capabilities={}, clientInfo={name=Spring AI MCP Client, version=1.0.0}}]
|
||||
2025-02-09T21:25:49.438+01:00 INFO 95411 --- [reactor-http-nio-3] o.s.ai.mcp.server.McpAsyncServer : Client initialize request - Protocol: 2024-11-05, Capabilities: ClientCapabilities[experimental=null, roots=null, sampling=null], Info: Implementation[name=Spring AI MCP Client, version=1.0.0]
|
||||
2025-02-09T21:25:49.488+01:00 INFO 95411 --- [reactor-http-nio-4] o.s.ai.mcp.spec.DefaultMcpSession : Received notification: JSONRPCNotification[jsonrpc=2.0, method=notifications/initialized, params=null]
|
||||
2025-02-09T21:25:49.492+01:00 INFO 95411 --- [reactor-http-nio-3] o.s.ai.mcp.spec.DefaultMcpSession : Received request: JSONRPCRequest[jsonrpc=2.0, method=ping, id=12e95de7-1, params=null]
|
||||
2025-02-09T21:25:49.496+01:00 INFO 95411 --- [reactor-http-nio-4] o.s.ai.mcp.spec.DefaultMcpSession : Received request: JSONRPCRequest[jsonrpc=2.0, method=tools/list, id=12e95de7-2, params={}]
|
||||
2025-02-09T21:25:49.508+01:00 INFO 95411 --- [reactor-http-nio-3] o.s.ai.mcp.spec.DefaultMcpSession : Received request: JSONRPCRequest[jsonrpc=2.0, method=tools/call, id=12e95de7-3, params={name=toUpperCase, arguments={input=accountName}}]
|
||||
2025-02-09T21:25:49.527+01:00 INFO 95411 --- [reactor-http-nio-4] o.s.ai.mcp.spec.DefaultMcpSession : Received request: JSONRPCRequest[jsonrpc=2.0, method=tools/call, id=12e95de7-4, params={name=getBooks, arguments={title=Spring Framework}}]
|
||||
2025-02-09T21:25:50.384+01:00 INFO 95411 --- [reactor-http-nio-3] o.s.ai.mcp.spec.DefaultMcpSession : Received request: JSONRPCRequest[jsonrpc=2.0, method=resources/list, id=12e95de7-5, params={}]
|
||||
2025-02-09T21:25:50.396+01:00 INFO 95411 --- [reactor-http-nio-4] o.s.ai.mcp.spec.DefaultMcpSession : Received request: JSONRPCRequest[jsonrpc=2.0, method=resources/read, id=12e95de7-6, params={uri=system://info}]
|
||||
2025-02-09T21:25:50.408+01:00 INFO 95411 --- [reactor-http-nio-3] o.s.ai.mcp.spec.DefaultMcpSession : Received request: JSONRPCRequest[jsonrpc=2.0, method=prompts/list, id=12e95de7-7, params={}]
|
||||
2025-02-09T21:25:50.417+01:00 INFO 95411 --- [reactor-http-nio-4] o.s.ai.mcp.spec.DefaultMcpSession : Received request: JSONRPCRequest[jsonrpc=2.0, method=prompts/get, id=12e95de7-8, params={name=greeting, arguments={name=Spring}}]
|
||||
2025-02-09T21:25:54.383+01:00 INFO 95411 --- [SpringApplicationShutdownHook] o.s.a.m.s.t.WebFluxSseServerTransport : Graceful shutdown completed
|
||||
2025-02-09T21:25:54.384+01:00 INFO 95411 --- [SpringApplicationShutdownHook] o.s.a.m.s.t.WebFluxSseServerTransport : Graceful shutdown completed
|
||||
@@ -1,50 +0,0 @@
|
||||
2025-02-09T21:21:11.760+01:00 INFO 93310 --- [main] o.s.a.m.s.w.s.McpMvcServerApplication : Starting McpMvcServerApplication using Java 17.0.12 with PID 93310 (/Users/christiantzolov/Dev/projects/spring-ai-examples/model-context-protocol/book-library/manual-webmvc-server/target/classes started by christiantzolov in /Users/christiantzolov/Dev/projects/spring-ai-examples)
|
||||
2025-02-09T21:21:11.761+01:00 INFO 93310 --- [main] o.s.a.m.s.w.s.McpMvcServerApplication : No active profile set, falling back to 1 default profile: "default"
|
||||
2025-02-09T21:21:12.089+01:00 INFO 93310 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port 8080 (http)
|
||||
2025-02-09T21:21:12.095+01:00 INFO 93310 --- [main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
|
||||
2025-02-09T21:21:12.095+01:00 INFO 93310 --- [main] o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/10.1.33]
|
||||
2025-02-09T21:21:12.125+01:00 INFO 93310 --- [main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
|
||||
2025-02-09T21:21:12.125+01:00 INFO 93310 --- [main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 344 ms
|
||||
2025-02-09T21:21:12.481+01:00 INFO 93310 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port 8080 (http) with context path '/'
|
||||
2025-02-09T21:21:12.487+01:00 INFO 93310 --- [main] o.s.a.m.s.w.s.McpMvcServerApplication : Started McpMvcServerApplication in 0.895 seconds (process running for 1.022)
|
||||
2025-02-09T21:21:36.802+01:00 INFO 93310 --- [SpringApplicationShutdownHook] o.s.a.m.s.t.WebMvcSseServerTransport : Graceful shutdown completed
|
||||
2025-02-09T21:21:36.803+01:00 INFO 93310 --- [SpringApplicationShutdownHook] o.s.a.m.s.t.WebMvcSseServerTransport : Graceful shutdown completed
|
||||
2025-02-09T21:22:52.834+01:00 INFO 93938 --- [main] o.s.a.m.s.w.s.McpMvcServerApplication : Starting McpMvcServerApplication using Java 17.0.12 with PID 93938 (/Users/christiantzolov/Dev/projects/spring-ai-examples/model-context-protocol/book-library/manual-webmvc-server/target/classes started by christiantzolov in /Users/christiantzolov/Dev/projects/spring-ai-examples)
|
||||
2025-02-09T21:22:52.835+01:00 INFO 93938 --- [main] o.s.a.m.s.w.s.McpMvcServerApplication : No active profile set, falling back to 1 default profile: "default"
|
||||
2025-02-09T21:22:53.140+01:00 INFO 93938 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port 8080 (http)
|
||||
2025-02-09T21:22:53.145+01:00 INFO 93938 --- [main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
|
||||
2025-02-09T21:22:53.145+01:00 INFO 93938 --- [main] o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/10.1.33]
|
||||
2025-02-09T21:22:53.167+01:00 INFO 93938 --- [main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
|
||||
2025-02-09T21:22:53.167+01:00 INFO 93938 --- [main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 313 ms
|
||||
2025-02-09T21:22:53.484+01:00 INFO 93938 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port 8080 (http) with context path '/'
|
||||
2025-02-09T21:22:53.490+01:00 INFO 93938 --- [main] o.s.a.m.s.w.s.McpMvcServerApplication : Started McpMvcServerApplication in 0.82 seconds (process running for 0.943)
|
||||
2025-02-09T21:23:04.979+01:00 INFO 93938 --- [SpringApplicationShutdownHook] o.s.a.m.s.t.WebMvcSseServerTransport : Graceful shutdown completed
|
||||
2025-02-09T21:23:04.979+01:00 INFO 93938 --- [SpringApplicationShutdownHook] o.s.a.m.s.t.WebMvcSseServerTransport : Graceful shutdown completed
|
||||
2025-02-09T21:24:24.073+01:00 INFO 94676 --- [main] o.s.a.m.s.w.s.McpMvcServerApplication : Starting McpMvcServerApplication using Java 17.0.12 with PID 94676 (/Users/christiantzolov/Dev/projects/spring-ai-examples/model-context-protocol/book-library/manual-webmvc-server/target/classes started by christiantzolov in /Users/christiantzolov/Dev/projects/spring-ai-examples)
|
||||
2025-02-09T21:24:24.074+01:00 INFO 94676 --- [main] o.s.a.m.s.w.s.McpMvcServerApplication : No active profile set, falling back to 1 default profile: "default"
|
||||
2025-02-09T21:24:24.425+01:00 INFO 94676 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port 8080 (http)
|
||||
2025-02-09T21:24:24.430+01:00 INFO 94676 --- [main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
|
||||
2025-02-09T21:24:24.431+01:00 INFO 94676 --- [main] o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/10.1.33]
|
||||
2025-02-09T21:24:24.455+01:00 INFO 94676 --- [main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
|
||||
2025-02-09T21:24:24.456+01:00 INFO 94676 --- [main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 362 ms
|
||||
2025-02-09T21:24:24.789+01:00 INFO 94676 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port 8080 (http) with context path '/'
|
||||
2025-02-09T21:24:24.795+01:00 INFO 94676 --- [main] o.s.a.m.s.w.s.McpMvcServerApplication : Started McpMvcServerApplication in 0.896 seconds (process running for 1.022)
|
||||
2025-02-09T21:24:27.528+01:00 INFO 94676 --- [http-nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
|
||||
2025-02-09T21:24:27.529+01:00 INFO 94676 --- [http-nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
|
||||
2025-02-09T21:24:27.529+01:00 INFO 94676 --- [http-nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 0 ms
|
||||
2025-02-09T21:24:27.578+01:00 INFO 94676 --- [http-nio-8080-exec-2] o.s.ai.mcp.spec.DefaultMcpSession : Received request: JSONRPCRequest[jsonrpc=2.0, method=initialize, id=1f83bbd8-0, params={protocolVersion=2024-11-05, capabilities={}, clientInfo={name=Spring AI MCP Client, version=1.0.0}}]
|
||||
2025-02-09T21:24:27.582+01:00 INFO 94676 --- [http-nio-8080-exec-2] o.s.ai.mcp.server.McpAsyncServer : Client initialize request - Protocol: 2024-11-05, Capabilities: ClientCapabilities[experimental=null, roots=null, sampling=null], Info: Implementation[name=Spring AI MCP Client, version=1.0.0]
|
||||
2025-02-09T21:24:27.630+01:00 INFO 94676 --- [http-nio-8080-exec-3] o.s.ai.mcp.spec.DefaultMcpSession : Received notification: JSONRPCNotification[jsonrpc=2.0, method=notifications/initialized, params=null]
|
||||
2025-02-09T21:24:27.633+01:00 INFO 94676 --- [http-nio-8080-exec-4] o.s.ai.mcp.spec.DefaultMcpSession : Received request: JSONRPCRequest[jsonrpc=2.0, method=ping, id=1f83bbd8-1, params=null]
|
||||
2025-02-09T21:24:27.637+01:00 INFO 94676 --- [http-nio-8080-exec-5] o.s.ai.mcp.spec.DefaultMcpSession : Received request: JSONRPCRequest[jsonrpc=2.0, method=tools/list, id=1f83bbd8-2, params={}]
|
||||
2025-02-09T21:24:27.649+01:00 INFO 94676 --- [http-nio-8080-exec-6] o.s.ai.mcp.spec.DefaultMcpSession : Received request: JSONRPCRequest[jsonrpc=2.0, method=tools/call, id=1f83bbd8-3, params={name=toUpperCase, arguments={input=accountName}}]
|
||||
2025-02-09T21:24:27.672+01:00 INFO 94676 --- [http-nio-8080-exec-7] o.s.ai.mcp.spec.DefaultMcpSession : Received request: JSONRPCRequest[jsonrpc=2.0, method=tools/call, id=1f83bbd8-4, params={name=getBooks, arguments={title=Spring Framework}}]
|
||||
2025-02-09T21:24:28.635+01:00 INFO 94676 --- [http-nio-8080-exec-8] o.s.ai.mcp.spec.DefaultMcpSession : Received request: JSONRPCRequest[jsonrpc=2.0, method=resources/list, id=1f83bbd8-5, params={}]
|
||||
2025-02-09T21:24:28.645+01:00 INFO 94676 --- [http-nio-8080-exec-9] o.s.ai.mcp.spec.DefaultMcpSession : Received request: JSONRPCRequest[jsonrpc=2.0, method=resources/read, id=1f83bbd8-6, params={uri=system://info}]
|
||||
2025-02-09T21:24:28.657+01:00 INFO 94676 --- [http-nio-8080-exec-10] o.s.ai.mcp.spec.DefaultMcpSession : Received request: JSONRPCRequest[jsonrpc=2.0, method=prompts/list, id=1f83bbd8-7, params={}]
|
||||
2025-02-09T21:24:28.665+01:00 INFO 94676 --- [http-nio-8080-exec-1] o.s.ai.mcp.spec.DefaultMcpSession : Received request: JSONRPCRequest[jsonrpc=2.0, method=prompts/get, id=1f83bbd8-8, params={name=greeting, arguments={name=Spring}}]
|
||||
2025-02-09T21:24:57.797+01:00 WARN 94676 --- [http-nio-8080-exec-3] .w.s.m.s.DefaultHandlerExceptionResolver : Ignoring exception, response committed already: org.springframework.web.context.request.async.AsyncRequestTimeoutException
|
||||
2025-02-09T21:24:57.798+01:00 WARN 94676 --- [http-nio-8080-exec-3] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.web.context.request.async.AsyncRequestTimeoutException]
|
||||
2025-02-09T21:25:37.487+01:00 WARN 94676 --- [SpringApplicationShutdownHook] o.s.a.m.s.t.WebMvcSseServerTransport : Failed to complete SSE emitter for session 76fdc444-38d2-4884-9e75-dc747611b756: The response object has been recycled and is no longer associated with this facade
|
||||
2025-02-09T21:25:37.487+01:00 INFO 94676 --- [SpringApplicationShutdownHook] o.s.a.m.s.t.WebMvcSseServerTransport : Graceful shutdown completed
|
||||
2025-02-09T21:25:37.487+01:00 INFO 94676 --- [SpringApplicationShutdownHook] o.s.a.m.s.t.WebMvcSseServerTransport : Graceful shutdown completed
|
||||
@@ -0,0 +1,138 @@
|
||||
# Spring AI - MCP Starter Client
|
||||
|
||||
This project demonstrates how to use the Spring AI MCP (Model Context Protocol) Client Boot Starter in a Spring Boot application. It showcases how to connect to MCP servers and integrate them with Spring AI's tool execution framework.
|
||||
|
||||
Follow the [MCP Client Boot Starter](https://docs.spring.io/spring-ai/reference/api/mcp/mcp-client-boot-starter-docs.html) reference documentation.
|
||||
|
||||
## Overview
|
||||
|
||||
The project uses Spring Boot and Spring AI to create a command-line application that:
|
||||
- Connects to MCP servers using STDIO and/or SSE (HttpClient-based) transports
|
||||
- Integrates with Spring AI's chat capabilities
|
||||
- Demonstrates tool execution through MCP servers
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Java 17 or later
|
||||
- Maven 3.6+
|
||||
- Anthropic API key (for Claude AI model)
|
||||
|
||||
## Dependencies
|
||||
|
||||
The project uses the following main dependencies:
|
||||
|
||||
```xml
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.ai</groupId>
|
||||
<artifactId>spring-ai-mcp-client-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.ai</groupId>
|
||||
<artifactId>spring-ai-anthropic-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
### Application Properties
|
||||
|
||||
Check the [MCP Client configuration properties](https://docs.spring.io/spring-ai/reference/api/mcp/mcp-client-boot-starter-docs.html#_configuration_properties) documentation.
|
||||
|
||||
The application can be configured through `application.properties` or `application.yml`:
|
||||
|
||||
#### Common Properties
|
||||
```properties
|
||||
# Application Configuration
|
||||
spring.application.name=mcp
|
||||
spring.main.web-application-type=none
|
||||
|
||||
# AI Provider Configuration
|
||||
spring.ai.anthropic.api-key=${ANTHROPIC_API_KEY}
|
||||
```
|
||||
|
||||
#### STDIO Transport Properties
|
||||
|
||||
Follow the [STDIO Configuration properties](https://docs.spring.io/spring-ai/reference/api/mcp/mcp-client-boot-starter-docs.html#_stdio_transport_properties) documentation.
|
||||
|
||||
Configure a separate, named configuration for each STDIO server you connect to:
|
||||
|
||||
```properties
|
||||
spring.ai.mcp.client.stdio.connections.brave-search.command=npx
|
||||
spring.ai.mcp.client.stdio.connections.brave-search.args=-y,@modelcontextprotocol/server-brave-search
|
||||
```
|
||||
|
||||
Here, `brave-search` is the name of your connection.
|
||||
|
||||
Alternatively, you can configure STDIO connections using an external JSON file in the Claude Desktop format:
|
||||
|
||||
```properties
|
||||
spring.ai.mcp.client.stdio.servers-configuration=classpath:/mcp-servers-config.json
|
||||
```
|
||||
|
||||
Example `mcp-servers-config.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"brave-search": {
|
||||
"command": "npx",
|
||||
"args": [
|
||||
"-y",
|
||||
"@modelcontextprotocol/server-brave-search"
|
||||
],
|
||||
"env": {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### SSE Transport Properties
|
||||
|
||||
You can also connect to Server-Sent Events (SSE) servers using HttpClient.
|
||||
Follow the [SSE Configuration properties](https://docs.spring.io/spring-ai/reference/api/mcp/mcp-client-boot-starter-docs.html#_sse_transport_properties) documentation.
|
||||
|
||||
The properties for SSE transport are prefixed with `spring.ai.mcp.client.sse`:
|
||||
|
||||
```properties
|
||||
spring.ai.mcp.client.sse.connections.server1.url=http://localhost:8080
|
||||
spring.ai.mcp.client.sse.connections.server2.url=http://localhost:8081
|
||||
```
|
||||
|
||||
## How It Works
|
||||
|
||||
The application demonstrates a simple command-line interaction with an AI model using MCP tools:
|
||||
|
||||
1. The application starts and configures multiple MCP Clients (one for each provided STDIO or SSE connection configuration)
|
||||
2. It builds a ChatClient with the configured MCP tools
|
||||
3. Sends a predefined question (set vi the `ai.user.input` property) to the AI model
|
||||
4. Displays the AI's response
|
||||
5. Automatically closes the application
|
||||
|
||||
## Running the Application
|
||||
|
||||
1. Set the required environment variable:
|
||||
```bash
|
||||
export ANTHROPIC_API_KEY=your-api-key
|
||||
```
|
||||
|
||||
2. Build the application:
|
||||
```bash
|
||||
./mvnw clean install
|
||||
```
|
||||
|
||||
3. Run the application:
|
||||
```bash
|
||||
java -Dai.user.input='Does Spring AI support MCP?' -jar target/mcp-starter-default-client-0.0.1-SNAPSHOT.jar
|
||||
```
|
||||
|
||||
The application will execute the question "Does Spring AI support MCP?", use the provided brave (or other tools) to answer it, and display the AI assistant's response.
|
||||
|
||||
## Additional Resources
|
||||
|
||||
- [Spring AI Documentation](https://docs.spring.io/spring-ai/reference/)
|
||||
- [MCP Client Boot Starter](https://docs.spring.io/spring-ai/reference/api/mcp/mcp-client-boot-starter-docs.html)
|
||||
- [Model Context Protocol Specification](https://modelcontextprotocol.github.io/specification/)
|
||||
- [Spring Boot Documentation](https://docs.spring.io/spring-boot/docs/current/reference/html/)
|
||||
@@ -33,7 +33,7 @@ public class Application {
|
||||
SpringApplication.run(Application.class, args);
|
||||
}
|
||||
|
||||
@Value("${spring.ai.mcp.client.demo.user.input}")
|
||||
@Value("${ai.user.input}")
|
||||
private String userInput;
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -11,4 +11,4 @@ spring.ai.mcp.client.stdio.connections.brave-search.args=-y,@modelcontextprotoco
|
||||
# spring.ai.mcp.client.stdio.connections.brave-search.env.FOO=BAAR
|
||||
|
||||
|
||||
spring.ai.mcp.client.demo.user.input=What tools are available?
|
||||
ai.user.input=What tools are available?
|
||||
@@ -0,0 +1,138 @@
|
||||
# Spring AI - MCP Starter WebFlux Client
|
||||
|
||||
This project demonstrates how to use the Spring AI MCP (Model Context Protocol) Client Boot Starter with WebFlux in a Spring Boot application. It showcases how to connect to MCP servers and integrate them with Spring AI's tool execution framework.
|
||||
|
||||
Follow the [MCP Client Boot Starter](https://docs.spring.io/spring-ai/reference/api/mcp/mcp-client-boot-starter-docs.html) reference documentation.
|
||||
|
||||
## Overview
|
||||
|
||||
The project uses Spring Boot and Spring AI to create a command-line application that:
|
||||
- Connects to MCP servers using STDIO and/or SSE (WebFlux-based) transports
|
||||
- Integrates with Spring AI's chat capabilities
|
||||
- Demonstrates tool execution through MCP servers
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Java 17 or later
|
||||
- Maven 3.6+
|
||||
- Anthropic API key (for Claude AI model)
|
||||
|
||||
## Dependencies
|
||||
|
||||
The project uses the following main dependencies:
|
||||
|
||||
```xml
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.ai</groupId>
|
||||
<artifactId>spring-ai-mcp-client-webflux-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.ai</groupId>
|
||||
<artifactId>spring-ai-anthropic-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
### Application Properties
|
||||
|
||||
Check the [MCP Client configuration properties](https://docs.spring.io/spring-ai/reference/api/mcp/mcp-client-boot-starter-docs.html#_configuration_properties) documentation.
|
||||
|
||||
The application can be configured through `application.properties` or `application.yml`:
|
||||
|
||||
#### Common Properties
|
||||
```properties
|
||||
# Application Configuration
|
||||
spring.application.name=mcp
|
||||
spring.main.web-application-type=none
|
||||
|
||||
# AI Provider Configuration
|
||||
spring.ai.anthropic.api-key=${ANTHROPIC_API_KEY}
|
||||
```
|
||||
|
||||
#### STDIO Transport Properties
|
||||
|
||||
Follow the [STDIO Configuration properties](https://docs.spring.io/spring-ai/reference/api/mcp/mcp-client-boot-starter-docs.html#_stdio_transport_properties) documentation.
|
||||
|
||||
Configure a separate, named configuration for each STDIO server you connect to:
|
||||
|
||||
```properties
|
||||
spring.ai.mcp.client.stdio.connections.brave-search.command=npx
|
||||
spring.ai.mcp.client.stdio.connections.brave-search.args=-y,@modelcontextprotocol/server-brave-search
|
||||
```
|
||||
|
||||
Here, `brave-search` is the name of your connection.
|
||||
|
||||
Alternatively, you can configure STDIO connections using an external JSON file in the Claude Desktop format:
|
||||
|
||||
```properties
|
||||
spring.ai.mcp.client.stdio.servers-configuration=classpath:/mcp-servers-config.json
|
||||
```
|
||||
|
||||
Example `mcp-servers-config.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"brave-search": {
|
||||
"command": "npx",
|
||||
"args": [
|
||||
"-y",
|
||||
"@modelcontextprotocol/server-brave-search"
|
||||
],
|
||||
"env": {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### SSE Transport Properties
|
||||
|
||||
You can also connect to Server-Sent Events (SSE) servers using WebFlux.
|
||||
Follow the [SSE Configuration properties](https://docs.spring.io/spring-ai/reference/api/mcp/mcp-client-boot-starter-docs.html#_sse_transport_properties) documentation.
|
||||
|
||||
The properties for SSE transport are prefixed with `spring.ai.mcp.client.sse`:
|
||||
|
||||
```properties
|
||||
spring.ai.mcp.client.sse.connections.server1.url=http://localhost:8080
|
||||
spring.ai.mcp.client.sse.connections.server2.url=http://localhost:8081
|
||||
```
|
||||
|
||||
## How It Works
|
||||
|
||||
The application demonstrates a simple command-line interaction with an AI model using MCP tools:
|
||||
|
||||
1. The application starts and configures multiple MCP Clients (one for each provided STDIO or SSE connection configuration)
|
||||
2. It builds a ChatClient with the configured MCP tools
|
||||
3. Sends a predefined question (set vi the `ai.user.input` property) to the AI model
|
||||
4. Displays the AI's response
|
||||
5. Automatically closes the application
|
||||
|
||||
## Running the Application
|
||||
|
||||
1. Set the required environment variable:
|
||||
```bash
|
||||
export ANTHROPIC_API_KEY=your-api-key
|
||||
```
|
||||
|
||||
2. Build the application:
|
||||
```bash
|
||||
./mvnw clean install
|
||||
```
|
||||
|
||||
3. Run the application:
|
||||
```bash
|
||||
java -Dai.user.input='Does Spring AI support MCP?' -jar target/mcp-starter-webflux-client-0.0.1-SNAPSHOT.jar
|
||||
```
|
||||
|
||||
The application will execute the question "Does Spring AI support MCP?", use the provided brave (or other tools) to answer it, and display the AI assistant's response.
|
||||
|
||||
## Additional Resources
|
||||
|
||||
- [Spring AI Documentation](https://docs.spring.io/spring-ai/reference/)
|
||||
- [MCP Client Boot Starter](https://docs.spring.io/spring-ai/reference/api/mcp/mcp-client-boot-starter-docs.html)
|
||||
- [Model Context Protocol Specification](https://modelcontextprotocol.github.io/specification/)
|
||||
- [Spring Boot Documentation](https://docs.spring.io/spring-boot/docs/current/reference/html/)
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.ai</groupId>
|
||||
<artifactId>spring-ai-mcp-server-webmvc-spring-boot-starter</artifactId>
|
||||
<artifactId>spring-ai-mcp-client-webflux-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>
|
||||
|
||||
@@ -33,7 +33,7 @@ public class Application {
|
||||
SpringApplication.run(Application.class, args);
|
||||
}
|
||||
|
||||
@Value("${spring.ai.mcp.client.demo.user.input}")
|
||||
@Value("${ai.user.input}")
|
||||
private String userInput;
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -11,4 +11,4 @@ spring.ai.mcp.client.stdio.connections.brave-search.args=-y,@modelcontextprotoco
|
||||
# spring.ai.mcp.client.stdio.connections.brave-search.env.FOO=BAAR
|
||||
|
||||
|
||||
spring.ai.mcp.client.demo.user.input=What tools are available?
|
||||
ai.user.input=What tools are available?
|
||||
@@ -0,0 +1,18 @@
|
||||
spring:
|
||||
application:
|
||||
name: mcp
|
||||
main:
|
||||
web-application-type: none
|
||||
|
||||
ai:
|
||||
openai:
|
||||
api-key: ${OPENAI_API_KEY}
|
||||
anthropic:
|
||||
api-key: ${ANTHROPIC_API_KEY}
|
||||
|
||||
mcp:
|
||||
client:
|
||||
stdio:
|
||||
servers-configuration: classpath:/mcp-servers-config.json
|
||||
|
||||
ai.user.input=Does Srping AI support MCP?
|
||||
@@ -76,49 +76,6 @@ spring.main.banner-mode=off
|
||||
logging.file.name=./target/starter-webflux-server.log
|
||||
```
|
||||
|
||||
## Sample Clients
|
||||
|
||||
### WebFlux SSE Client
|
||||
```java
|
||||
var transport = new WebFluxSseClientTransport(WebClient.builder().baseUrl("http://localhost:8080"));
|
||||
var client = McpClient.sync(transport).build();
|
||||
```
|
||||
|
||||
### STDIO Client
|
||||
```java
|
||||
var stdioParams = ServerParameters.builder("java")
|
||||
.args("-Dspring.ai.mcp.server.stdio=true",
|
||||
"-Dspring.main.web-application-type=none",
|
||||
"-Dspring.main.banner-mode=off",
|
||||
"-Dlogging.pattern.console=",
|
||||
"-jar",
|
||||
"target/mcp-weather-starter-webflux-server-0.0.1-SNAPSHOT.jar")
|
||||
.build();
|
||||
|
||||
var transport = new StdioClientTransport(stdioParams);
|
||||
var client = McpClient.sync(transport).build();
|
||||
```
|
||||
|
||||
### Claude Desktop Configuration
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"spring-ai-mcp-weather": {
|
||||
"command": "java",
|
||||
"args": [
|
||||
"-Dspring.ai.mcp.server.stdio=true",
|
||||
"-Dspring.main.web-application-type=none",
|
||||
"-Dspring.main.banner-mode=off",
|
||||
"-Dlogging.pattern.console=",
|
||||
"-jar",
|
||||
"<YOUR ABSOLUTE PATH TO>/mcp-weather-starter-webflux-server-0.0.1-SNAPSHOT.jar"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Available Tools
|
||||
|
||||
### Weather Forecast Tool
|
||||
@@ -180,7 +137,50 @@ public class WeatherService {
|
||||
}
|
||||
```
|
||||
|
||||
## Client Usage Example
|
||||
## Sample Clients
|
||||
|
||||
### WebFlux SSE Client
|
||||
```java
|
||||
var transport = new WebFluxSseClientTransport(WebClient.builder().baseUrl("http://localhost:8080"));
|
||||
var client = McpClient.sync(transport).build();
|
||||
```
|
||||
|
||||
### STDIO Client
|
||||
```java
|
||||
var stdioParams = ServerParameters.builder("java")
|
||||
.args("-Dspring.ai.mcp.server.stdio=true",
|
||||
"-Dspring.main.web-application-type=none",
|
||||
"-Dspring.main.banner-mode=off",
|
||||
"-Dlogging.pattern.console=",
|
||||
"-jar",
|
||||
"target/mcp-weather-starter-webflux-server-0.0.1-SNAPSHOT.jar")
|
||||
.build();
|
||||
|
||||
var transport = new StdioClientTransport(stdioParams);
|
||||
var client = McpClient.sync(transport).build();
|
||||
```
|
||||
|
||||
### Claude Desktop Configuration
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"spring-ai-mcp-weather": {
|
||||
"command": "java",
|
||||
"args": [
|
||||
"-Dspring.ai.mcp.server.stdio=true",
|
||||
"-Dspring.main.web-application-type=none",
|
||||
"-Dspring.main.banner-mode=off",
|
||||
"-Dlogging.pattern.console=",
|
||||
"-jar",
|
||||
"<YOUR ABSOLUTE PATH TO>/mcp-weather-starter-webflux-server-0.0.1-SNAPSHOT.jar"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Client Usage Example
|
||||
|
||||
```java
|
||||
// Initialize client
|
||||
|
||||
Reference in New Issue
Block a user