Skip to content

Route and refuse MCP 2026-07-28 requests as the specification requires - #54

Open
JanGoebelsBot wants to merge 4 commits into
fix-streamed-call-error-dialogfrom
modern-request-routing
Open

JanGoebelsBot wants to merge 4 commits into
fix-streamed-call-error-dialogfrom
modern-request-routing

Conversation

@JanGoebelsBot

@JanGoebelsBot JanGoebelsBot commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Builds on #53 (fix-streamed-call-error-dialog); review and merge that one first. This description lists only the changes on top of it.

Summary

The official MCP conformance suite (@modelcontextprotocol/conformance, --requirements 2026-07-28) found the server routing and refusing some MCP 2026-07-28 requests wrongly. A request marked as 2026-07-28 only by its MCP-Protocol-Version header, but missing _meta, was handled as legacy; a 2026-07-28 initialize was answered; early refusals had no request id; and HTTP/1.1 clients got ECONNRESET because the server closed every connection without saying so.

Request Before After
2026-07-28 header, no _meta (or _meta without protocolVersion) legacy, 200, -32601 400, -32602, request id
2026-07-28 initialize 200, legacy result 404, -32601
legacy initialize 200 200 (unchanged)
unsupported MCP-Protocol-Version (also 401/403/405) error with "id": null error with the request id
2026-07-28 resources/read of an unknown uri -32602 -32602 with data.uri
every response no Connection header, server closes the socket Connection: close

Changes

  • Read MCP Request Metadata.vi — modified (regenerated, small generated VI). A request is 2026-07-28 when params._meta has the protocol version, or the MCP-Protocol-Version header is a 2026-07-28 version, or the method is server/discover. The initialize exception is gone. New input protocol version header.
  • Check Modern MCP Request.vi — modified (regenerated). New first check: missing _meta / protocol version → 400, -32602. A 2026-07-28 initialize now reaches the existing "method of no era" check → 404, -32601.
  • Handle MCP Request.vi, Prepare Request Dispatch.vi — modified in place: pass the header to Read MCP Request Metadata.vi.
  • Process HTTP Request.vi — modified in place: refusals made before the body is handled go through Restore Request ID.vi (request id instead of null); Set Header.vi adds Connection: close to every response, the SSE response included.
  • Remap Resource Not Found.vi, Complete Handler Result.vi — modified (regenerated): new input uri; the -32602 for an unknown resource carries data: {"uri": ...}. Complete Modern MCP Result.vi — modified in place: passes the uri.
  • Tests — new Tests 66–69 (test modern missing meta.vi, test modern initialize.vi, test unsupported version id.vi, test resource not found uri.vi), wired into Test_MCP_Server.vi.
  • Tests changed on purpose — test access allowed clients.vi (Test 61) and test access bearer token.vi (Test 62) asserted that the 403 and 401 bodies have id: null; they now expect the request id (611). MCP 2026-07-28 requires every error answer to carry the request id.
  • docs/technical-details.md — era rule, missing _meta, removed methods, ids on refusals, Connection: close.

Code summary

Orange numbered boxes match the numbered points. Click a picture for full size. Every changed spot and every case frame is in the detailed VI diff report. Grey "?" nodes are IG HTTP Server and JSONtext subVIs: the 32-bit LabVIEW that made the pictures does not have those packages installed.

VI Status Change in one line
Read MCP Request Metadata.vi modified a request is 2026-07-28 also by its header or by server/discover; initialize is no exception any more
Process HTTP Request.vi modified early refusals get the request id; every response says Connection: close
Check Modern MCP Request.vi modified new first check: missing _meta or protocol version gives 400, -32602
Handle MCP Request.vi, Prepare Request Dispatch.vi modified pass the MCP-Protocol-Version header to Read MCP Request Metadata.vi
Remap Resource Not Found.vi, Complete Handler Result.vi, Complete Modern MCP Result.vi modified the -32602 for an unknown resource carries data.uri
Tests 66-69; Tests 61, 62; Test_MCP_Server.vi added / modified new tests; 61 and 62 expect the request id on 403 and 401

Read MCP Request Metadata.vi — modified

Decides per request which MCP era it belongs to.

  1. New: the MCP-Protocol-Version header is looked up in the modern versions of Supported Protocol Versions.vi. A legacy version in the header never makes a request modern, so legacy clients are unaffected.
  2. New: "modern" is now _meta protocol version OR modern header OR method server/discover. The old "unless the method is initialize" is gone, so a 2026-07-28 initialize reaches the modern checks and is refused with 404.
  3. New: the comparison with server/discover feeds that OR, so a server/discover without _meta is refused with -32602 instead of being answered "method not found" by the legacy path.

Process HTTP Request.vi — modified

Answers one HTTP request; edited in place, the layout is otherwise untouched.

  1. New: Restore Request ID.vi gets the refusal payload (401, 403, 405, unsupported version 400) together with the request body, so the error carries the id the client sent instead of null.
  2. New: Set Header.vi writes Connection: close on the response that goes to Set Response.vi, the SSE response included. The IG HTTP Server closes the socket after every response; without the header HTTP/1.1 clients reused it and got ECONNRESET.

Other VIs

  • Check Modern MCP Request.vi: one more entry at the top of its table of refusals (see the detailed report; the diagram is table-driven).
  • Remap Resource Not Found.vi: sets error.data to the uri when it turns -32002 into -32602; Complete Handler Result.vi and Complete Modern MCP Result.vi pass the uri to it.

Test VIs

  • test modern missing meta.vi (66), test modern initialize.vi (67), test unsupported version id.vi (68), test resource not found uri.vi (69): one request shape each, as listed under Changes.
  • test access allowed clients.vi (61), test access bearer token.vi (62): expected id changed from null to 611.

Verified

Not verified

  • Not run in LabVIEW 2021–2025, not in a built application.
  • MRTR requestState (multi-round elicitation), completion/complete and the conformance fixture server follow in the next pull requests.

Known rough edges

  • Four small generated VIs were regenerated and laid out automatically; in Read MCP Request Metadata.vi the restored typedef constant shows expanded at the top right.
  • Restore Request ID.vi copies the raw id, so a refusal reads "id":301 , (space before the comma) — valid JSON, the same spacing as elsewhere.

🤖 Generated with Claude Code

JanGoebelsBot and others added 3 commits November 25, 2026 08:16
Measured with the official conformance suite
(@modelcontextprotocol/conformance, --requirements 2026-07-28):

- A request was treated as MCP 2026-07-28 only when params._meta
  carried the protocol version. A request with a 2026-07-28
  MCP-Protocol-Version header but without _meta was handled as legacy
  and answered -32601 with HTTP 200. Read MCP Request Metadata.vi now
  also decides by that header (a modern version only, so legacy clients
  are unaffected) and by the method server/discover. Check Modern MCP
  Request.vi refuses a missing _meta or protocol version first, with
  HTTP 400 and -32602, as the specification requires.
- initialize is not a method of the 2026-07-28 era: a modern initialize
  is answered 404 with -32601. A legacy initialize works as before.
- Refusals made before the body is handled (unsupported
  MCP-Protocol-Version 400/-32022, Origin 403, 401, 405) had id null.
  Process HTTP Request.vi passes them through Restore Request ID.vi, so
  they carry the request id.
- A 2026-07-28 resources/read of an unknown resource (-32602) now
  carries data.uri (Remap Resource Not Found.vi, Complete Handler
  Result.vi, Complete Modern MCP Result.vi).
- The IG HTTP Server closes the connection after every response
  without saying so, which made HTTP/1.1 clients reuse a closed socket
  (ECONNRESET in the conformance suite). Every response now carries
  Connection: close.

New inputs: protocol version header on Read MCP Request Metadata.vi,
uri on Remap Resource Not Found.vi and Complete Handler Result.vi.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The era is now also decided by the MCP-Protocol-Version header and by
server/discover; missing _meta fields, removed methods such as
initialize, request ids on refusals and Connection: close are described.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
New tests, wired into Test_MCP_Server.vi after Test 65:
- Test 66 (test modern missing meta.vi): a 2026-07-28 request without
  _meta or without its protocol version is refused with 400 and -32602
  and its id, also when only the header marks it as 2026-07-28.
- Test 67 (test modern initialize.vi): a 2026-07-28 initialize gets 404
  and -32601; a legacy initialize still works.
- Test 68 (test unsupported version id.vi): -32022 for an unsupported
  MCP-Protocol-Version carries the request id, number or string.
- Test 69 (test resource not found uri.vi): an unknown resource in the
  2026-07-28 era gives -32602 with data.uri, and the answer says
  Connection: close.

Tests 61 and 62 change on purpose: the 403 and 401 refusals now carry
the request id (611) instead of null, as MCP requires for every error
answer. Against the toolkit before this change Test 61 fails on exactly
that assertion.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JanGoebelsBot

JanGoebelsBot commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator Author

Tests

Suite not run on the merge commit itself; the same VIs passed on #53 (243 assertions) and on #55 (282).

VI changes

Open the full VI diff

VIs: 11 modified, 4 added, 0 deleted

VI Changes Changed spot, now
Check Modern MCP Request.vi
src/MCP Server
11
Complete Handler Result.vi
src/MCP Server
4
Complete Modern MCP Result.vi
src/MCP Server
2
Handle MCP Request.vi
src/MCP Server
2
Prepare Request Dispatch.vi
src/MCP Server
2
Process HTTP Request.vi
src/MCP Server
3
5 more modified VIs
VI Changes Changed spot, now
Read MCP Request Metadata.vi
src/MCP Server
6
Remap Resource Not Found.vi
src/MCP Server
4
Test_MCP_Server.vi
tests
1
test access allowed clients.vi
tests
3
test access bearer token.vi
tests
3
Added VIs (4)
VI Block diagram
test modern initialize.vi
tests
test modern missing meta.vi
tests
test resource not found uri.vi
tests
test unsupported version id.vi
tests

Produced locally (the pull request workflow has not run: the self-hosted runner is offline). VI comparison: LabVIEW 2026 32-bit. Report for commit 9b34dd0.

@JanGoebelsBot
JanGoebelsBot marked this pull request as ready for review November 26, 2026 11:20
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JanGoebelsBot

Copy link
Copy Markdown
Collaborator Author

Update: base branch merged

New commit: 9b34dd0, a merge of the review fixes of #53 (fix-streamed-call-error-dialog: automatic error handling is now also switched off in the subVIs of a tool VI, and Test 65 checks the setting itself). Nothing of this pull request's own changes was touched.

Tests: Suite not run on the merge commit itself; the same VIs passed on #53 (243 assertions) and on #55 (282).

Still open: nothing on this pull request.

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.

1 participant