Skip to content

fix(mcp): use negotiated protocol version in transport request headers#15128

Merged
aayush-kapoor merged 3 commits into
mainfrom
aayush/mcp-protocol-v
May 11, 2026
Merged

fix(mcp): use negotiated protocol version in transport request headers#15128
aayush-kapoor merged 3 commits into
mainfrom
aayush/mcp-protocol-v

Conversation

@aayush-kapoor
Copy link
Copy Markdown
Collaborator

Background

#14413

after a successful initialize handshake, HttpMCPTransport and SseMCPTransport were sending mcp-protocol-version: 2025-11-25 (LATEST_PROTOCOL_VERSION) in every subsequent request header, ignoring the version the server actually negotiated down to

Summary

added optional protocolVersion?: string field to the transports so the client can inject the negotiated version into any transport after init

Manual Verification

na

Checklist

  • All commits are signed (PRs with unsigned commits cannot be merged)
  • Tests have been added / updated (for bug fixes / features)
  • Documentation has been added / updated (for bug fixes / features)
  • A patch changeset for relevant packages has been added (for bug fixes / features - run pnpm changeset in the project root)
  • I have reviewed this pull request (self-review)

Related Issues

fixes #14413

@aayush-kapoor aayush-kapoor added the backport Admins only: add this label to a pull request in order to backport it to the prior version label May 11, 2026
@aayush-kapoor aayush-kapoor merged commit 2655da8 into main May 11, 2026
21 checks passed
@aayush-kapoor aayush-kapoor deleted the aayush/mcp-protocol-v branch May 11, 2026 13:52
github-actions Bot added a commit that referenced this pull request May 11, 2026
@aayush-kapoor aayush-kapoor removed the backport Admins only: add this label to a pull request in order to backport it to the prior version label May 11, 2026
aayush-kapoor added a commit that referenced this pull request May 11, 2026
…est headers (#15164)

This is an automated backport of #15128 to the release-v6.0 branch. FYI
@aayush-kapoor
This backport has conflicts that need to be resolved manually.

### `git cherry-pick` output

```
Auto-merging packages/mcp/src/tool/mcp-client.test.ts
Auto-merging packages/mcp/src/tool/mcp-client.ts
CONFLICT (content): Merge conflict in packages/mcp/src/tool/mcp-client.ts
Auto-merging packages/mcp/src/tool/mcp-http-transport.test.ts
Auto-merging packages/mcp/src/tool/mcp-http-transport.ts
Auto-merging packages/mcp/src/tool/mcp-sse-transport.test.ts
Auto-merging packages/mcp/src/tool/mcp-sse-transport.ts
Auto-merging packages/mcp/src/tool/mcp-transport.ts
Auto-merging packages/mcp/src/tool/mock-mcp-transport.ts
error: could not apply 2655da8... fix(mcp): use negotiated protocol version in transport request headers (#15128)
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
```

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Aayush Kapoor <aayushkapoor34@gmail.com>
@github-actions
Copy link
Copy Markdown
Contributor

🚀 Published in:

Package Version
ai 7.0.0-canary.131
@ai-sdk/alibaba 2.0.0-canary.47
@ai-sdk/amazon-bedrock 5.0.0-canary.57
@ai-sdk/angular 3.0.0-canary.131
@ai-sdk/anthropic 4.0.0-canary.51
@ai-sdk/assemblyai 3.0.0-canary.40
@ai-sdk/azure 4.0.0-canary.55
@ai-sdk/baseten 2.0.0-canary.45
@ai-sdk/black-forest-labs 2.0.0-canary.39
@ai-sdk/bytedance 2.0.0-canary.40
@ai-sdk/cerebras 3.0.0-canary.45
@ai-sdk/cohere 4.0.0-canary.41
@ai-sdk/deepgram 3.0.0-canary.39
@ai-sdk/deepinfra 3.0.0-canary.45
@ai-sdk/deepseek 3.0.0-canary.42
@ai-sdk/elevenlabs 3.0.0-canary.39
@ai-sdk/fal 3.0.0-canary.39
@ai-sdk/fireworks 3.0.0-canary.45
@ai-sdk/gateway 4.0.0-canary.77
@ai-sdk/gladia 3.0.0-canary.39
@ai-sdk/google 4.0.0-canary.59
@ai-sdk/google-vertex 5.0.0-canary.78
@ai-sdk/groq 4.0.0-canary.42
@ai-sdk/huggingface 2.0.0-canary.45
@ai-sdk/hume 3.0.0-canary.39
@ai-sdk/klingai 4.0.0-canary.40
@ai-sdk/langchain 3.0.0-canary.131
@ai-sdk/llamaindex 3.0.0-canary.131
@ai-sdk/lmnt 3.0.0-canary.39
@ai-sdk/luma 3.0.0-canary.39
@ai-sdk/mcp 2.0.0-canary.47
@ai-sdk/mistral 4.0.0-canary.43
@ai-sdk/moonshotai 3.0.0-canary.45
@ai-sdk/open-responses 2.0.0-canary.41
@ai-sdk/openai 4.0.0-canary.55
@ai-sdk/openai-compatible 3.0.0-canary.45
@ai-sdk/otel 1.0.0-canary.77
@ai-sdk/perplexity 4.0.0-canary.42
@ai-sdk/prodia 2.0.0-canary.42
@ai-sdk/provider-utils 5.0.0-canary.38
@ai-sdk/react 4.0.0-canary.132
@ai-sdk/replicate 3.0.0-canary.40
@ai-sdk/revai 3.0.0-canary.40
@ai-sdk/rsc 3.0.0-canary.132
@ai-sdk/svelte 5.0.0-canary.131
@ai-sdk/togetherai 3.0.0-canary.45
@ai-sdk/valibot 3.0.0-canary.38
@ai-sdk/vercel 3.0.0-canary.45
@ai-sdk/voyage 2.0.0-canary.13
@ai-sdk/vue 4.0.0-canary.131
@ai-sdk/workflow 1.0.0-canary.47
@ai-sdk/xai 4.0.0-canary.58

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