Skip to content

feat(mcp): support protocol 2026-07-28 - #566

Merged
wesm merged 1 commit into
kenn-io:mainfrom
salmonumbrella:feat/mcp-2026-07-28
Aug 9, 2026
Merged

feat(mcp): support protocol 2026-07-28#566
wesm merged 1 commit into
kenn-io:mainfrom
salmonumbrella:feat/mcp-2026-07-28

Conversation

@salmonumbrella

@salmonumbrella salmonumbrella commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

What changed

  • Move msgvault MCP to the official Go SDK v1.7.0.
  • Give 2026-07-28 clients the initialize-free server/discover path. Streamable HTTP is sessionless and does not issue Mcp-Session-Id; older protocol versions remain a compatibility fallback and do not change the modern path.
  • Add strict JSON Schema 2020-12 input and output contracts, structured results with JSON text fallback, opaque attachment resources, cache metadata, trace propagation, and private internal-error isolation.
  • Harden HTTP with origin, protocol-header, request-size, rate, concurrency, and read-only-by-default controls.
  • Expand raw modern and legacy transport coverage across every advertised tool shape, and make the daemon-stop progress test deterministic.

Why

The previous server used a 2025-era stateful MCP stack. It could not give current agents sessionless discovery, per-request protocol metadata, structured output, resource caching, and the 2026-07-28 HTTP contract without msgvault owning a second protocol implementation. The official SDK now provides the modern path while keeping older clients usable.

Usage

Run msgvault mcp for stdio with the full local tool set. Run msgvault mcp --http 127.0.0.1:8080 for stateless Streamable HTTP; HTTP stays read-only by default. Add --http-allow-writes only for trusted clients that need export_attachment or stage_deletion.

@salmonumbrella
salmonumbrella requested a review from wesm as a code owner August 8, 2026 15:26
@roborev-ci

roborev-ci Bot commented Aug 8, 2026

Copy link
Copy Markdown

roborev: Combined Review (53ff2d1)

The migration is generally sound, but one medium-severity regression should be fixed before merging.

Medium

  • internal/mcp/handlers.go:1595get_stats now fails entirely when vector statistics collection partially fails, even though CollectStats returns usable partial data and archive/account statistics have already succeeded. Log the vector error and return the partial StatsView to preserve best-effort behavior.

Reviewers: 2 done | Synthesis: codex, 8s | Total: 11m0s

@salmonumbrella

Copy link
Copy Markdown
Contributor Author

Addressed the get_stats finding in a0c287e. Vector statistics remain best effort: partial StatsView data is returned with archive and account statistics, while the underlying vector error is logged privately. Added a regression test that failed on the prior behavior. Focused MCP tests, the full internal/mcp package, repo vet, and lint (0 issues) pass.

@roborev-ci

roborev-ci Bot commented Aug 8, 2026

Copy link
Copy Markdown

roborev: Combined Review (a0c287e)

Code is generally sound, but daemon-backed search errors need proper MCP translation.

Medium

  • internal/mcp/handlers.go:218bodySearchError recognizes only local query sentinels, so expected daemon errors such as invalid_query, body_search_unavailable, and body_search_index_unavailable become generic JSON-RPC internal errors. Similar remote input errors, including invalid account or pagination scope, also fall through dependencyError.
    • Fix: Safely whitelist and translate known daemon APIErrorCode() values into tool-error results with static messages, keep unknown codes isolated, and add coverage for daemon-backed adapters.

Reviewers: 2 done | Synthesis: codex, 10s | Total: 13m7s

@salmonumbrella

Copy link
Copy Markdown
Contributor Author

Addressed the daemon error-translation finding in a2ded20. MCP now converts only a fixed whitelist of known daemon request/search codes to static tool-error messages. Raw daemon messages never cross the wire; unknown codes still return generic -32603 and are logged privately. Regression coverage runs real daemonclient adapters for body, hybrid, and similar searches. Focused adapter tests, the full internal/mcp package, repo vet, and lint (0 issues) pass.

@roborev-ci

roborev-ci Bot commented Aug 8, 2026

Copy link
Copy Markdown

roborev: Combined Review (a2ded20)

The migration is generally sound, but one medium-severity resource-control gap remains.

Medium

  • internal/mcp/middleware.go:96 — The invocation limiter applies only to tools/call, allowing resources/read to bypass rate and concurrency limits while loading and base64-encoding attachments up to 50 MiB. Parallel reads could exhaust server memory. Apply equivalent rate and concurrency controls to resources/read, returning an appropriate JSON-RPC busy error when saturated.

Reviewers: 2 done | Synthesis: codex, 13s | Total: 11m25s

@salmonumbrella

Copy link
Copy Markdown
Contributor Author

Fixed the resource-read limiter gap in 90b51cbc. resources/read now shares the same process-wide rate and concurrency policy as tools/call. Saturated reads return a stable -32000 JSON-RPC busy error before the attachment reader runs. Added raw modern HTTP regression coverage for both token-burst exhaustion and concurrent reads. Focused tests, the full tagged internal/mcp package, repository-wide vet, and lint (0 issues) pass.

@roborev-ci

roborev-ci Bot commented Aug 8, 2026

Copy link
Copy Markdown

roborev: Combined Review (90b51cb)

No issues found.


Reviewers: 2 done | Synthesis: codex | Total: 11m57s

@salmonumbrella

Copy link
Copy Markdown
Contributor Author

Pushed final CI portability corrections in 7c8ea0d2. The raw stdio peer now uses portable bounded I/O instead of os.File.SetDeadline, which Windows anonymous pipes do not support. The Nix vendorHash is updated to the exact fixed-output hash reported after the official SDK dependency change. Focused stdio/resource tests, the full tagged internal/mcp package, repository-wide vet, and lint (0 issues) pass. Roborev found no issues on the prior head; this final head is ready for another review.

@roborev-ci

roborev-ci Bot commented Aug 8, 2026

Copy link
Copy Markdown

roborev: Combined Review (7c8ea0d)

No issues found.


Reviewers: 2 done | Synthesis: codex | Total: 12m12s

@wesm
wesm merged commit a3eb5bc into kenn-io:main Aug 9, 2026
20 checks passed
@wesm

wesm commented Aug 9, 2026

Copy link
Copy Markdown
Member

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants