Skip to content

feat(mcp): add MCP-Protocol-Version, Mcp-Method, and Mcp-Name HTTP headers#10808

Merged
chkuang-g merged 2 commits into
mainfrom
chkuang/mcp-http-headers-0728
Jul 16, 2026
Merged

feat(mcp): add MCP-Protocol-Version, Mcp-Method, and Mcp-Name HTTP headers#10808
chkuang-g merged 2 commits into
mainfrom
chkuang/mcp-http-headers-0728

Conversation

@chkuang-g

Copy link
Copy Markdown
Contributor

Description

Adds MCP-Protocol-Version, Mcp-Method, and Mcp-Name HTTP headers for proxy requests issued by OneMcpServer, adhering to the MCP 0728 standard release candidate specification and SEP-2243:

Scenarios Tested

  • Unit tests in src/mcp/onemcp/onemcp_server.spec.ts verifying listTools sends MCP-Protocol-Version and Mcp-Method.
  • Unit tests in src/mcp/onemcp/onemcp_server.spec.ts verifying callTool sends MCP-Protocol-Version, Mcp-Method, Mcp-Name, and x-goog-user-project headers.

Sample Commands

npx mocha --require ts-node/register src/mcp/onemcp/onemcp_server.spec.ts

…TTP headers to `OneMcpServer`

### Description
Adds `MCP-Protocol-Version`, `Mcp-Method`, and `Mcp-Name` HTTP headers for proxy requests issued by `OneMcpServer`, adhering to the MCP 0728 standard release candidate specification and SEP-2243:
- https://blog.modelcontextprotocol.io/posts/2026-07-28-release-candidate/
- https://modelcontextprotocol.io/seps/2243-http-standardization

### Scenarios Tested
- Unit tests in src/mcp/onemcp/onemcp_server.spec.ts verifying listTools sends `MCP-Protocol-Version` and `Mcp-Method`.
- Unit tests in src/mcp/onemcp/onemcp_server.spec.ts verifying callTool sends `MCP-Protocol-Version`, `Mcp-Method`, `Mcp-Name`, and `x-goog-user-project` headers.

### Sample Commands
npx mocha --require ts-node/register src/mcp/onemcp/onemcp_server.spec.ts
@chkuang-g
chkuang-g requested a review from joehan July 16, 2026 21:46

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates OneMcpServer to include MCP-Protocol-Version, Mcp-Method, and Mcp-Name HTTP headers in its requests, aligning with the MCP 0728 standard. The reviewer feedback consistently recommends changing the casing of MCP-Protocol-Version to Mcp-Protocol-Version in the source code, unit tests, and changelog to maintain consistency and adhere to standard casing.

Comment thread src/mcp/onemcp/onemcp_server.ts
Comment on lines +116 to +121
headers: {
"MCP-Protocol-Version": LATEST_PROTOCOL_VERSION,
"Mcp-Method": "tools/call",
"Mcp-Name": toolName,
...(ctx.projectId ? { "x-goog-user-project": ctx.projectId } : {}),
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency with other MCP headers like Mcp-Method and Mcp-Name, and to align with the standard casing defined in SEP-2243, use Mcp-Protocol-Version instead of MCP-Protocol-Version.

Suggested change
headers: {
"MCP-Protocol-Version": LATEST_PROTOCOL_VERSION,
"Mcp-Method": "tools/call",
"Mcp-Name": toolName,
...(ctx.projectId ? { "x-goog-user-project": ctx.projectId } : {}),
},
headers: {
"Mcp-Protocol-Version": LATEST_PROTOCOL_VERSION,
"Mcp-Method": "tools/call",
"Mcp-Name": toolName,
...(ctx.projectId ? { "x-goog-user-project": ctx.projectId } : {}),
},

Comment thread src/mcp/onemcp/onemcp_server.spec.ts
Comment on lines 122 to 127
expect(clientRequestStub.secondCall.args[0].headers).to.deep.include({
"MCP-Protocol-Version": LATEST_PROTOCOL_VERSION,
"Mcp-Method": "tools/call",
"Mcp-Name": "test_tool",
"x-goog-user-project": "test-project",
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Update the test assertion to use the consistent casing Mcp-Protocol-Version.

Suggested change
expect(clientRequestStub.secondCall.args[0].headers).to.deep.include({
"MCP-Protocol-Version": LATEST_PROTOCOL_VERSION,
"Mcp-Method": "tools/call",
"Mcp-Name": "test_tool",
"x-goog-user-project": "test-project",
});
expect(clientRequestStub.secondCall.args[0].headers).to.deep.include({
"Mcp-Protocol-Version": LATEST_PROTOCOL_VERSION,
"Mcp-Method": "tools/call",
"Mcp-Name": "test_tool",
"x-goog-user-project": "test-project",
});

Comment thread src/mcp/onemcp/onemcp_server.spec.ts
Comment thread CHANGELOG.md
@chkuang-g
chkuang-g enabled auto-merge (squash) July 16, 2026 21:55
@chkuang-g
chkuang-g merged commit ab31956 into main Jul 16, 2026
52 of 53 checks passed
@chkuang-g
chkuang-g deleted the chkuang/mcp-http-headers-0728 branch July 16, 2026 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants