test(integration): un-skip mcp-protocol (closes #3317)#3347
Merged
Conversation
…, real spec shapes (#3317) The MCP StreamableHTTP transport requires `Accept: text/event-stream` (a JSON-only Accept gets 406 Not Acceptable) and frames JSON-RPC responses as `event: message\ndata: {...}` even for unary calls — so plain response.body parsing in supertest never sees a body. callMcp now sets the right Accept and unwraps the SSE framing back into response.body. Three tests asserted JSON-RPC `error` envelopes for tool-execution failures (missing agent, unknown tool name). The MCP spec puts those in `result.isError` + content; the JSON-RPC `error` channel is reserved for protocol-layer failures. Realigned to the spec. Sequential calls were tripping the inline mcpRateLimiter (max: 10/min); mocked express-rate-limit to passthrough. Drive-bys flagged in code review: - toHaveLength(32) → length > 0 so the file doesn't break on tool count drift - server['app'] private-property access → server.app public getter - afterAll(() => server.stop()) closes the open HTTP handle Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #3317. Last item in the #3289 umbrella.
The triage agent's directional pick (Option B — force `Accept: application/json`) didn't survive contact: the MCP StreamableHTTP transport returns 406 Not Acceptable when the Accept header doesn't include `text/event-stream`. Switched to Option A (parse the SSE framing back into JSON), which is also more accurate to how real MCP clients negotiate.
Three tests had to move off JSON-RPC `error` envelopes too — the MCP spec carries tool-execution errors in `result.isError` + content, not in the `error` channel (which is reserved for protocol-layer failures like unknown methods). Realigned to the spec-correct shape.
What's in the PR
Test plan
Combined with PR #3326, #3327, #3328, #3333 (all merged or pending), this completes the #3289 umbrella.
🤖 Generated with Claude Code