feat(McpAsyncServer): Add non-blocking execution for tools and resources

- Execute tool calls, resource reads and prompt handling in a non-blocking
  manner using Schedulers.boundedElastic(). This prevents blocking operations
  from impacting server responsiveness.
- Added integration tests to verify non-blocking behavior with tools that
  make HTTP calls to external services.

Related to #48
This is  a temp patch until #48 is resolved properly.
This commit is contained in:
Christian Tzolov 2025-01-04 17:49:39 +01:00 • committed by Christian Tzolov
commit 580f95526f

View file

@ -28,7 +28,7 @@ The server can be started in two transport modes, controlled by the `transport.m
### Stdio Mode (Default)
```bash
java -Dtransport.mode=stdio -jar target/spring-ai-mcp-sample-0.4.0-SNAPSHOT.jar
java -Dtransport.mode=stdio -jar target/spring-ai-mcp-sample-0.5.0-SNAPSHOT.jar
```
The Stdio mode server is automatically started by the client - no explicit server startup is needed.
@ -38,7 +38,7 @@ In Stdio mode the server must not emit any messages/logs to the console (e.g. st
### SSE Mode
```bash
java -Dtransport.mode=sse -jar target/spring-ai-mcp-sample-0.4.0-SNAPSHOT.jar
java -Dtransport.mode=sse -jar target/spring-ai-mcp-sample-0.5.0-SNAPSHOT.jar
```
## Sample Clients
@ -49,7 +49,7 @@ The project includes example clients for both transport modes:
```java
var stdioParams = ServerParameters.builder("java")
.args("-Dtransport.mode=stdio", "-jar",
"target/spring-ai-mcp-sample-0.4.0-SNAPSHOT.jar")
"target/spring-ai-mcp-sample-0.5.0-SNAPSHOT.jar")
.build();
var transport = new StdioClientTransport(stdioParams);