This is an automated email from the ASF dual-hosted git repository.

liuhongyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git


The following commit(s) were added to refs/heads/master by this push:
     new 24565161a5 [fix] the path truncation of get requests set by 
shenyuContext in MCP Server (#6209)
24565161a5 is described below

commit 24565161a50ab1250ae1a941893bbd16f71509f5
Author: MaMengzhen <[email protected]>
AuthorDate: Tue Oct 21 17:27:24 2025 +0800

    [fix] the path truncation of get requests set by shenyuContext in MCP 
Server (#6209)
    
    * fix: path truncation in mcp server
    
    * fix: path truncation in mcp server
    
    ---------
    
    Co-authored-by: aias00 <[email protected]>
---
 .../shenyu/plugin/mcp/server/callback/ShenyuToolCallback.java     | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git 
a/shenyu-plugin/shenyu-plugin-mcp-server/src/main/java/org/apache/shenyu/plugin/mcp/server/callback/ShenyuToolCallback.java
 
b/shenyu-plugin/shenyu-plugin-mcp-server/src/main/java/org/apache/shenyu/plugin/mcp/server/callback/ShenyuToolCallback.java
index aa48a569b9..e7db8c1515 100644
--- 
a/shenyu-plugin/shenyu-plugin-mcp-server/src/main/java/org/apache/shenyu/plugin/mcp/server/callback/ShenyuToolCallback.java
+++ 
b/shenyu-plugin/shenyu-plugin-mcp-server/src/main/java/org/apache/shenyu/plugin/mcp/server/callback/ShenyuToolCallback.java
@@ -574,7 +574,13 @@ public class ShenyuToolCallback implements ToolCallback {
                 decoratedExchange.getAttributes().put(Constants.META_DATA, 
metaData);
                 shenyuContext.setRpcType(metaData.getRpcType());
             }
-            shenyuContext.setPath(decoratedPath);
+            try {
+                URI uri = new URI(decoratedPath);
+                shenyuContext.setPath(uri.getRawPath());
+            } catch (URISyntaxException ignore) {
+                shenyuContext.setPath(decoratedPath);
+            }
+
             shenyuContext.setRealUrl(decoratedPath);
 
             LOG.debug("Configured RpcType to HTTP for tool call, session: {}", 
sessionId);

Reply via email to