Skip to content

feat(mcp): resources/prompts, outputSchema, and list pagination (#626) - #654

Merged
jimhoyd merged 3 commits into
mainfrom
claude/mcp-spec-parity-626
Sep 24, 2026
Merged

jimhoyd merged 3 commits into
mainfrom
claude/mcp-spec-parity-626

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

Implements the highest-value, clearest-spec-requirement portion of #626 ("full MCP transport/spec parity for @jimhoyd/urlcode-mcp"). Per the issue's own prioritization guidance ("prioritize based on real client needs... pagination and outputSchema are lower effort"), this PR covers:

  • tools/list/resources/list/prompts/list cursor pagination — a stable 20-entries-per-page slice (sorted by name) with an opaque cursor/nextCursor, and -32602 for an invalid cursor.
  • Tool outputSchema / structuredContent — validated with the same bounded request.body.schema subset as inputSchema; a non-conforming handler result is treated as a server-side contract violation (same isError: true shape a thrown handler produces, observed via onToolError).
  • The resources MCP primitive — resources/list, resources/read, each resource a fixed uri backed by a trusted project handler (text or {text|blob, mimeType}), -32002 for an unknown uri.
  • The prompts MCP primitive — prompts/list, prompts/get, with string arguments validated against a schema built from the declared arguments list (reusing bodySchemaIssues, not a second validator), and a convenience message shape ({role, text}[] or a bare string) alongside the full MCP {role, content} shape.
  • JSON-RPC batching re-confirmed, not just deferred: re-checked against the current (2025-06-18) MCP revision, which removed batching from the spec entirely; this extension continues to refuse a batch array for every protocol revision it negotiates, documented as a scope decision rather than a gap.
  • initialize now advertises resources/prompts capabilities only when a server declares at least one of that primitive.

onToolError's info object gained a kind: 'tool' | 'resource' | 'prompt' field (additive, non-breaking) so the operator can tell which primitive failed.

Deliberately still deferred — #626 stays open, not closed by this PR

The Streamable HTTP transport's optional GET/SSE stream for server-initiated messages and Mcp-Session-Id session resumption are not implemented here. This isn't an oversight: HandlerResult (the generic extension response type every runtime target — Node, AWS, Vercel — implements) carries a single buffered body, not a stream, so serving SSE would need a new core capability this extension contract doesn't have yet. That's a bigger, core-level change than fits this package-scoped PR. I searched for an existing follow-up issue and didn't find one; rather than file a near-duplicate of #626 for the one piece left in it, I'm leaving #626 open, now scoped down to exactly this remainder (SSE/streaming + session resumption).

What changed

  • packages/mcp/src/mcp.ts — pagination, outputSchema/structuredContent, resources/prompts config schema + dispatch, capability negotiation.
  • packages/mcp/test/mcp.test.ts — 5 new real-HTTP-round-trip tests (pagination across a 25-tool set, outputSchema success/violation, resources list+read+not-found+handler-failure, prompts list+get+missing-arg+unknown+handler-failure, capability advertising), plus a kind assertion added to the existing thrown-handler-error test. 16/16 pass.
  • packages/mcp/README.md, packages/mcp/AGENTS.md, packages/mcp/llms.txt, docs/EXTENSIONS.md — document the new surface and move batching from "gap" to "confirmed decision".

Test plan

  • npm run typecheck / npm test in packages/mcp (16/16 passing)
  • npm run verify (full pipeline: lint, typecheck, build, root+workspace tests including ui/auth/admin/store/forms/mcp, package audit, workspace-integration) — exit code 0

Closes: none (see "deliberately still deferred" above). References #626.

Co-Authored-By: Claude Sonnet 5 [email protected]

jimhoyd and others added 3 commits September 24, 2026 08:16
…626)

Extends @jimhoyd/urlcode-mcp's bounded MCP surface with the highest-value,
clearest-spec-requirement gaps from #626: cursor pagination on tools/list
(now also resources/list and prompts/list), tool outputSchema/structuredContent,
and the resources (resources/list, resources/read) and prompts (prompts/list,
prompts/get) primitives, each backed by a trusted project handler and reusing
the existing bounded body-schema validator and hook-loading machinery. Also
re-confirms the JSON-RPC batching refusal against the current MCP revision.

SSE/streaming transport and Mcp-Session-Id resumption remain out of scope:
HandlerResult has no streaming body, so serving them needs a core capability
this extension doesn't have yet. #626 stays open, scoped to that remainder.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Co-Authored-By: Claude Sonnet 5 <[email protected]>
@jimhoyd
jimhoyd merged commit 7ee1209 into main Sep 24, 2026
23 checks passed
@jimhoyd
jimhoyd deleted the claude/mcp-spec-parity-626 branch September 24, 2026 13:34
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