BobSong-dev opened a new pull request, #7805: URL: https://github.com/apache/shenyu/pull/7805
## Background The Agent Gateway outbound adapter targets MCP 2025-06-18, but currently accepts any successful HTTP response to `notifications/initialized`. A wrong success status or a non-empty acknowledgement can therefore mark an invalid handshake ready. The [versioned HTTP transport contract](https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#sending-messages-to-the-server) requires an accepted notification to receive HTTP 202 with no response body. ## Changes - Require HTTP 202 and an empty body before completing the outbound handshake. - Add six regression cases: reject HTTP 200/201/204/206 and a non-empty HTTP 202; preserve the valid empty HTTP 202 path. - Verify cached handshake failure, no subsequent list/call traffic, pending-request release and cleanup of the allocated upstream session. This changes only the outbound client and its tests. It does not add inbound initialization, upgrade the SDK or extend protocol capabilities. ## Verification - Before the fix: six new cases, five failures and one pass; no errors or skips. - Windows/JDK 17, targeted 14-module `clean verify`: 173 tests across five suites; zero failures, errors or skips. Checkstyle and RAT passed in all 14 modules; Javadoc skipped. - Real OpenCode 2.0.18 and an authorized real model: JSON and SSE modes, two controlled MCP servers, four actual tool calls, results returned to subsequent model requests, and all owned sessions/catalog references drained. The harness uses direct rule-cache setup and a fixture identity resolver, not Admin synchronization or production authentication. - `git diff --check` passed. Existing legacy negative-case WARN logs and deprecation notices remain. Not run: full-project tests, a new RISC-V run or remote CI. Targeted command used: ```powershell .\mvnw.cmd -B -o -pl shenyu-plugin/shenyu-plugin-agent-gateway,shenyu-plugin/shenyu-plugin-mcp-server -am clean verify '-Dtest=AgentMcpRequestParserTest,AgentMcpHttpHandlerTest,RequestScopedMcpClientTest,ShenyuStreamableHttpServerTransportProviderTest,SseEventFormatterTest' '-Dsurefire.failIfNoSpecifiedTests=false' '-Dmaven.javadoc.skip=true' '-DskipRemoteResources=true' ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
