From 14b9df710b850bb4fa091bafa32ae918aec44ed3 Mon Sep 17 00:00:00 2001 From: yeaury Date: Fri, 26 Dec 2025 11:44:57 +0800 Subject: [PATCH] arthas mcp server default STREAMABLE protocol --- .../mcp/server/protocol/config/McpServerProperties.java | 2 +- .../server/protocol/server/handler/McpHttpRequestHandler.java | 2 +- core/src/main/java/arthas.properties | 2 +- .../main/java/com/taobao/arthas/core/mcp/ArthasMcpServer.java | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arthas-mcp-server/src/main/java/com/taobao/arthas/mcp/server/protocol/config/McpServerProperties.java b/arthas-mcp-server/src/main/java/com/taobao/arthas/mcp/server/protocol/config/McpServerProperties.java index 293ac7ab7b..030cce8c90 100644 --- a/arthas-mcp-server/src/main/java/com/taobao/arthas/mcp/server/protocol/config/McpServerProperties.java +++ b/arthas-mcp-server/src/main/java/com/taobao/arthas/mcp/server/protocol/config/McpServerProperties.java @@ -193,7 +193,7 @@ public static class Builder { private Duration requestTimeout = Duration.ofSeconds(10); private Duration initializationTimeout = Duration.ofSeconds(30); private ObjectMapper objectMapper; - private ServerProtocol protocol = ServerProtocol.STATELESS; + private ServerProtocol protocol = ServerProtocol.STREAMABLE; public Builder() { // Private constructor to prevent direct instantiation diff --git a/arthas-mcp-server/src/main/java/com/taobao/arthas/mcp/server/protocol/server/handler/McpHttpRequestHandler.java b/arthas-mcp-server/src/main/java/com/taobao/arthas/mcp/server/protocol/server/handler/McpHttpRequestHandler.java index f7e73dce8b..62aa71127e 100644 --- a/arthas-mcp-server/src/main/java/com/taobao/arthas/mcp/server/protocol/server/handler/McpHttpRequestHandler.java +++ b/arthas-mcp-server/src/main/java/com/taobao/arthas/mcp/server/protocol/server/handler/McpHttpRequestHandler.java @@ -193,7 +193,7 @@ public McpHttpRequestHandler build() { Assert.notNull(this.mcpEndpoint, "MCP endpoint must be set"); if (this.protocol == null) { - this.protocol = ServerProtocol.STATELESS; + this.protocol = ServerProtocol.STREAMABLE; } McpHttpRequestHandler handler = new McpHttpRequestHandler(this.mcpEndpoint, this.objectMapper, this.contextExtractor); diff --git a/core/src/main/java/arthas.properties b/core/src/main/java/arthas.properties index f463da21d8..f0d74be0ef 100644 --- a/core/src/main/java/arthas.properties +++ b/core/src/main/java/arthas.properties @@ -25,4 +25,4 @@ arthas.localConnectionNonAuth=true # MCP (Model Context Protocol) configuration arthas.mcpEndpoint=/mcp -arthas.mcpProtocol=STATELESS +arthas.mcpProtocol=STREAMABLE diff --git a/core/src/main/java/com/taobao/arthas/core/mcp/ArthasMcpServer.java b/core/src/main/java/com/taobao/arthas/core/mcp/ArthasMcpServer.java index 36a129b69f..63ac0b67f6 100644 --- a/core/src/main/java/com/taobao/arthas/core/mcp/ArthasMcpServer.java +++ b/core/src/main/java/com/taobao/arthas/core/mcp/ArthasMcpServer.java @@ -58,12 +58,12 @@ public ArthasMcpServer(String mcpEndpoint, CommandExecutor commandExecutor, Stri this.mcpEndpoint = mcpEndpoint != null ? mcpEndpoint : DEFAULT_MCP_ENDPOINT; this.commandExecutor = commandExecutor; - ServerProtocol resolvedProtocol = ServerProtocol.STATELESS; + ServerProtocol resolvedProtocol = ServerProtocol.STREAMABLE; if (protocol != null && !protocol.trim().isEmpty()) { try { resolvedProtocol = ServerProtocol.valueOf(protocol.toUpperCase()); } catch (IllegalArgumentException e) { - logger.warn("Invalid MCP protocol: {}. Using default: STATELESS", protocol); + logger.warn("Invalid MCP protocol: {}. Using default: STREAMABLE", protocol); } } this.protocol = resolvedProtocol;