Skip to content

Conversation

@ljluestc
Copy link

@ljluestc ljluestc commented Nov 8, 2025

Ⅰ. Describe what this PR did

  • mcp-router: Support both “server___tool” and “server/tool” prefixes when routing tools/call, ensuring correct backend selection regardless of client/tooling prefix style.
  • Nacos MCP watcher: Add consistent-hash (source IP) load balancing for Streamable HTTP transport (in addition to SSE) to improve backend affinity and prevent intermittent tool denial.
  • Add unit tests:
    • mcp-router: prefix parsing for both separators.
    • nacos watcher: DestinationRule affinity for SSE and Streamable.

Ⅱ. Does this pull request fix one issue?

Ⅲ. Why don't you add test cases (unit test/integration test)?

  • Added unit tests:
    • plugins/wasm-go/mcp-filters/mcp-router/main_test.go: validates parsing for “server___tool” and “server/tool”.
    • registry/nacos/mcpserver/watcher_test.go: asserts consistent-hash policy for SSE and Streamable protocols.

Ⅳ. Describe how to verify it

  • Functional:
    • Register an MCP server via Nacos with SSE or Streamable HTTP transport.
    • Connect SSE at /mcp/{mcp-server-name}/sse (or streamable endpoint).
    • Invoke tools using both name styles:
      • params.name: "{server}___{tool}"
      • params.name: "{server}/{tool}"
    • Expect no -32602 Tool not allowed; tool should be accepted consistently.
  • Observability:
    • Confirm DestinationRule for the generated service uses ConsistentHash for SSE and Streamable.
    • With jsonrpc-converter enabled, verify headers x-envoy-mcp-tool-name and x-envoy-jsonrpc-method reflect the tool routed without the server prefix.
  • Regression:
    • Requests without a prefix remain untouched and route as before.

Ⅴ. Special notes for reviews

  • Backward compatible: legacy “server___tool” continues to work; “server/tool” newly supported.
  • Affinity note: Source-IP hashing is best-effort behind shared NAT; if stronger stickiness is needed, consider header-based consistent hash (e.g., x-mcp-session-id) in a follow-up change.
  • Scope-limited to MCP filters and Nacos MCP watcher; no changes to unrelated paths.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants