Repository navigation
feat(mcp): resources/prompts, outputSchema, and list pagination (#626) - #654
Merged
Merged
Conversation
…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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 andoutputSchemaare lower effort"), this PR covers:tools/list/resources/list/prompts/listcursor pagination — a stable 20-entries-per-page slice (sorted by name) with an opaquecursor/nextCursor, and-32602for an invalid cursor.outputSchema/structuredContent— validated with the same boundedrequest.body.schemasubset asinputSchema; a non-conforming handler result is treated as a server-side contract violation (sameisError: trueshape a thrown handler produces, observed viaonToolError).resourcesMCP primitive —resources/list,resources/read, each resource a fixeduribacked by a trusted project handler (text or{text|blob, mimeType}),-32002for an unknownuri.promptsMCP primitive —prompts/list,prompts/get, with string arguments validated against a schema built from the declaredargumentslist (reusingbodySchemaIssues, not a second validator), and a convenience message shape ({role, text}[]or a bare string) alongside the full MCP{role, content}shape.initializenow advertisesresources/promptscapabilities only when a server declares at least one of that primitive.onToolError's info object gained akind: 'tool' | 'resource' | 'prompt'field (additive, non-breaking) so the operator can tell which primitive failed.Deliberately still deferred —
#626stays open, not closed by this PRThe Streamable HTTP transport's optional
GET/SSE stream for server-initiated messages andMcp-Session-Idsession 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/promptsconfig schema + dispatch, capability negotiation.packages/mcp/test/mcp.test.ts— 5 new real-HTTP-round-trip tests (pagination across a 25-tool set,outputSchemasuccess/violation, resources list+read+not-found+handler-failure, prompts list+get+missing-arg+unknown+handler-failure, capability advertising), plus akindassertion 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 testinpackages/mcp(16/16 passing)npm run verify(full pipeline: lint, typecheck, build, root+workspace tests includingui/auth/admin/store/forms/mcp, package audit, workspace-integration) — exit code 0Closes: none (see "deliberately still deferred" above). References #626.
Co-Authored-By: Claude Sonnet 5 [email protected]