Skip to content

MCP Server failed to transport large response to client #3050

Closed
@qsLI

Description

@qsLI

Bug description
Spring AI MCP client calls tool method to Spring AI MCP server,
If the response is large, we can only get partial result and end in tcp reset.
If the response is small, everything is normal

  • same tool with small response
Image Image
  • same tool with large response
Image Image

Environment
Please provide as many details as possible: Spring AI version, Java version, which vector store you use if any, etc

  • mcp client spring ai version: 1.0.0-M6
  • mcp server spring ai version: 1.0.0-M7

Steps to reproduce

    @Bean
    @Order(Ordered.HIGHEST_PRECEDENCE)
    public CommandLineRunner predefinedQuestions(ChatClient.Builder chatClientBuilder,
                                                 List<McpSyncClient> mcpClient, ConfigurableApplicationContext context) {

        return args -> {
            var chatClient = chatClientBuilder
                    .defaultTools(new SyncMcpToolCallbackProvider(mcpClient))
                    .defaultAdvisors(new SimpleLoggerAdvisor())
                    .build();

            System.out.println("Running predefined questions with AI model responses:\n");

            // Question 1
            String question1 = "查看com.Controller源码";
            System.out.println("QUESTION: " + question1);
            System.out.println("ASSISTANT: " + chatClient.prompt(question1).call().content());

            context.close();

        };
    }

config:

spring.ai.mcp.client.type=SYNC
spring.ai.mcp.client.enabled=true
spring.ai.mcp.client.name=grpc
spring.ai.mcp.client.sse.connections.grpc.url=http://xxx
spring.ai.mcp.client.request-timeout=600000

Expected behavior
A clear and concise description of what you expected to happen.

no rst

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions