Skip to content

Fix MCP HTTP protocol fallback race - #1861

Merged
Aaronontheweb merged 2 commits into
devfrom
fix/mcp-protocol-version-race
Aug 10, 2026
Merged

Fix MCP HTTP protocol fallback race#1861
Aaronontheweb merged 2 commits into
devfrom
fix/mcp-protocol-version-race

Conversation

@Aaronontheweb

Copy link
Copy Markdown
Collaborator

Summary

  • remove a stale MCP protocol-version header only from initialize requests
  • use the same process-life HTTP client for daemon connections and CLI probes
  • disable ambient cookies so MCP profiles cannot share cookie state
  • add a controlled SDK fallback test with no delays or retries

Cause

MCP SDK 2.0 can complete a 2026-07-28 discovery response at the same time that its five-second probe wait is cancelled. The client then starts a 2025-11-25 initialize fallback, but the HTTP transport can keep the earlier version and attach it as a header. A conforming server rejects that mixed request.

Validation

  • dotnet build Netclaw.slnx -c Release --no-restore
  • dotnet test Netclaw.slnx -c Release --no-build --no-restore
  • 3 focused HTTP factory tests
  • 1 controlled SDK fallback test
  • 4 real HTTP MCP smoke tests
  • dotnet slopwatch analyze --fail-on warning
  • pwsh ./scripts/Add-FileHeaders.ps1 -Verify
  • openspec validate --all --strict
  • targeted dotnet format --verify-no-changes
  • adversarial concurrency and security review: pass

Behavioral evals do not apply because this change does not alter prompts, tools, or model behavior.

@Aaronontheweb
Aaronontheweb enabled auto-merge (squash) August 10, 2026 22:03
? Assert.Single(versions)
: null,
request.Headers.Authorization?.ToString());
return Task.FromResult(new HttpResponseMessage(HttpStatusCode.Accepted));
@Aaronontheweb Aaronontheweb added mcp Model context protocol server / client issues. reliability Retries, resilience, graceful degradation bug Something isn't working labels Aug 10, 2026
@Aaronontheweb
Aaronontheweb merged commit 05804ab into dev Aug 10, 2026
21 checks passed
@Aaronontheweb
Aaronontheweb deleted the fix/mcp-protocol-version-race branch August 10, 2026 22:47
@Aaronontheweb Aaronontheweb mentioned this pull request Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working mcp Model context protocol server / client issues. reliability Retries, resilience, graceful degradation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant