You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current implementation of McpAsyncServer and McpAsyncClient mixes blocking and non-blocking operations, which violates reactive programming principles. Specifically:
It would be great if there was a complete distinction between standard implementation and reactive implementation, so to make it possible for non-reactive applications not to have any reactive dependency, and rely on Java own features for the async behaviour (using virtual threads). And then have the reactive implementation fully Reactor-based. Similar to other Spring projects (Spring Data, Spring Security, Spring Web...).
- 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.
- 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.
Problem
The current implementation of McpAsyncServer and McpAsyncClient mixes blocking and non-blocking operations, which violates reactive programming principles. Specifically:
List<ToolRegistration> tools
,Map<String, ResourceRegistration> resources
,List<McpSchema.ResourceTemplate> resourceTemplates
,Map<String, PromptRegistration> prompts
,List<Consumer<List<McpSchema.Root>>> rootsChangeConsumers
.Map<String, Root> roots
,List<Consumer<List<McpSchema.Tool>>> toolsChangeConsumers
,List<Consumer<List<McpSchema.Resource>>> resourcesChangeConsumers
,List<Consumer<List<McpSchema.Prompt>>> promptsChangeConsumers
,List<Consumer<McpSchema.LoggingMessageNotification>> loggingConsumers
,Function<CreateMessageRequest, CreateMessageResult> samplingHandler
Proposed Solution
subscribeOn(boundedElastic)
for user-provided blocking codepublishOn(boundedElastic)
for consuming reactive streams in blocking mannerImplementation Details
The text was updated successfully, but these errors were encountered: