[Bug]: CLI MCP generator omits MCP-Protocol-Version after initialization
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 77/100
Research direction
Read cli/src/internal/mcp/generator.go, especially the subsequent request header construction near line 219 and initialization response handling near line 305. Follow how the negotiated protocol version and session ID move through the generator, then add coverage for a stateless endpoint that requires the header. Done means post-initialization requests send the negotiated version while caller-supplied authentication headers still work.
Written by the indexing model from the issue text.
Description
Description
ap gateway mcp generate in WSO2 API Platform CLI ap v0.9.1 proposes MCP protocol version 2025-06-18 during initialization but does not send the MCP-Protocol-Version HTTP header on subsequent requests.
A local stateless server that advertises that version and requires the version header rejects discovery. Supplying the same header manually with the CLI's --header option makes the identical discovery sequence succeed.
Steps to Reproduce
-
Download and extract the official CLI release
ap/v0.9.1. -
Download reproduce_mcp.py (Python standard library only).
-
Run:
python reproduce_mcp.py --binary /absolute/path/to/ap --case protocol_header --case protocol_header_controlOn Windows use
--binary "C:\tools\ap.exe"andpythonorpyas appropriate.
The first fixture returns a successful initialize result with protocolVersion: 2025-06-18, issues no session ID, and requires MCP-Protocol-Version: 2025-06-18 on later POSTs; otherwise it returns HTTP 400 with a JSON-RPC error. The control case uses the same fixture and only adds --header "MCP-Protocol-Version: 2025-06-18" to the CLI command.
Actual result
| Case | CLI exit | Echo tool in output | MCP-Protocol-Version sent |
|---|---|---|---|
protocol_header |
1 | No | Missing on every post-initialization request |
protocol_header_control |
0 | Yes | 2025-06-18 on every request |
Failing case stderr:
Error: tools/list request returned an error: Unsupported protocol version: missing MCP-Protocol-Version
The captured request log shows protocol_header: null for initialize, notifications/initialized, tools/list, prompts/list and resources/list in the failing case, and 2025-06-18 for all five in the control case.
Expected result
The CLI should retain the version negotiated during initialization and attach it to subsequent HTTP protocol requests automatically, while preserving any caller-supplied authentication headers. The MCP protocol-version header requirement applies to post-initialization requests; a stateless server cannot recover the version from a session ID.
Source evidence and suggested direction
- Subsequent request headers set content type, accept, an optional caller-supplied header and a session ID, but never the negotiated protocol version.
- Initialization response handling checks for an error but does not retain
result.protocolVersion.
Carry the negotiated version alongside the session ID and set the header for later protocol requests. Add coverage with a stateless endpoint that requires the header.
Environment Details
- Product/component: WSO2 API Platform CLI, official Linux amd64 release
ap/v0.9.1(ap version v0.9.1 (built at 2026-08-07T09:04:19Z)). - Test runtime: Linux 6.18.57 x86_64 with glibc 2.41, Python 3.12.14.
- Source reviewed: api-platform
mainat398d50772b5605ffe0d6d8693aa7b9ce7c84032e; inspected, not compiled or executed. - All fixtures advertise tools, prompts, resources and logging capabilities, so the separately reported optional-capability issue does not apply here.
- Evidence boundary: local mock server only; not tested against a WSO2-hosted product instance. No CVSS score is asserted.
Area / Aspect / Severity
Area: CLI. Aspect: Aspect/AI and Aspect/API. Severity: Severity/Major (provisional functional assessment for maintainer review).
Screenshot and attachments
- Dominant language
- Go
- Stars
- 85
- Forks
- 137
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 247
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from wso2/api-platform
-
Area/DeveloperPortal Aspect/UI Severity/Minor Type/Bug
Difficulty 1/5 Under an hour Newbie friendliness 88/100
wso2/api-platform#4369 ·
Maintainers usually reply within 1 day
-
[Bug]: host-rewrite policy documentation lists fewer allowed host characters than the policy acceptsOpenArea/Policies Aspect/Other Severity/Trivial Type/Bug
Difficulty 1/5 Under an hour Newbie friendliness 91/100
wso2/api-platform#4355 ·
Maintainers usually reply within 1 day
-
Area/Gateway Aspect/API Severity/Minor Type/Bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
wso2/api-platform#4348 ·
Maintainers usually reply within 1 day
-
Area/Policies Aspect/Configuration Severity/Minor Type/Bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
wso2/api-platform#4330 ·
Maintainers usually reply within 1 day
-
Area/Policies Aspect/API Aspect/Configuration Severity/Minor Type/Bug
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
wso2/api-platform#4329 ·
Maintainers usually reply within 1 day
All issues in wso2/api-platform
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
keyxmakerx/Chronicle#2285 ·
Maintainers usually reply within 1 day
-
vLLM metrics adapter tests start the adapter twice and race on its request countersPossibly taken @bhargavchintam claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
llm-d/llm-d-inference-sim#933 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
spellshift/realm#2509 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
lionsoul2014/ip2region#552 ·
Maintainers usually reply within 1 day