Skip to content

feat: auth owns the auth: shorthand, extension activation errors, body-schema length cap, MCP tool errors and 2025-11-25 (#710, #714, #713, #716, #719) - #726

Merged
jimhoyd merged 6 commits into
mainfrom
claude/sleepy-shannon-xvazgl
Sep 25, 2026
Merged

jimhoyd merged 6 commits into
mainfrom
claude/sleepy-shannon-xvazgl

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

Problem and change

Five decided issues, one commit each.

  • Closes Make route policy shorthand extension-defined rather than auth-specific core schema #710: auth owns the auth: shorthand's policy shape. Authors write auth: exactly as before. Core only maps auth: X to policies.extensions.auth (true means {}). The auth field shapes are gone from RouteAuthConfig (packages/core/src/types.ts) and from schemas/urlcode.schema.json, whose routeAuth now defines only required.
    • Where validation happens: auth's own policySchema validates the value, through a shared checkExtensionPolicies().
    • Error location: errors still name the failing field at the key the author wrote, for example Invalid extension policy at route /api/items, auth.bearer.quota.requests (minimum): must be >= 1, with pointer /routes/~1api~1items/auth/bearer/quota/requests ([Bug]: invalid route auth short form reports 'must be true' instead of the bad field #702 behaviour kept).
    • validateProject: it now checks declared extensions' route policies, using a passed registration or the installed package's urlcode.json, so bad auth: values are still refused at validate time.
    • Checks script: the guidance check's closed-key rule reads auth's keys from packages/auth/urlcode.json.
  • Closes [Bug]: validate/test hide extension activation errors behind "Operation failed" #714: extension activation errors are visible. validate, test, dev and serve startup now print Extension "<name>" failed to activate: <message> (code extension-activation, with an extension detail) instead of "Operation failed".
  • Closes [Request]: allow a body-schema string maxLength above 8192 so MCP tools can take document-sized arguments #713: raise the body-schema string cap. A string maxLength without pattern may go up to maxRequestBodyBytes (1 MiB), the largest request body any route accepts. Strings with a pattern keep the 128-character regex-input cap.
    • bodySchemaSubset.limits.length publishes the new cap, and HTTP.md, SPECIFICATION.md and the RIM-HTTP-001 card are updated.
    • Parameter (path, query and header) limits are unchanged at 8192.
  • Closes [Request]: let an mcp tool handler return isError with a caller-facing message #716: McpToolError. A tool handler can throw McpToolError(message, {data?}) to return isError: true with its own caller-facing message.
    • Message cap: 4096 characters.
    • Structured data: data becomes structuredContent only when it conforms to the tool's outputSchema.
    • Observer: onToolCall reports the new outcome 'tool_error'.
    • Other errors: any other thrown error keeps the generic message.
  • Closes [Request]: support MCP protocol revision 2025-11-25 in @jimhoyd/urlcode-mcp #719: MCP 2025-11-25. It is now the preferred negotiated revision.
    • Spec source: I read the spec from its GitHub source, because modelcontextprotocol.io was blocked by the proxy.
    • Behaviour change (SEP-1303): under MCP-Protocol-Version: 2025-11-25, tools/call arguments that fail inputSchema return an isError tool result rather than -32602. Older revisions are unchanged.

Verification

Run on Node v26.10.0 on the combined branch:

Compatibility and security

🤖 Generated with Claude Code

https://claude.ai/code/session_014jmv9dMggduiprzSsNd7iP


Generated by Claude Code

… without a pattern (#713)

request.body.schema string minLength/maxLength were capped at 8192. They
now go up to maxRequestBodyBytes (1048576), the largest request body any
route admits (request.body.maxBytes defaults to and cannot exceed it), so
the subset stays target-independent. A string with a pattern keeps the
128-character maxPatternInputLength cap that bounds regex cost; item
bounds are unchanged. A route's smaller maxBytes is not compared with the
schema at load time (existing projects pair a small maxBytes with larger
lengths); it still answers 413 before validation.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014jmv9dMggduiprzSsNd7iP
…sult (#716)

A tool handler can throw the exported McpToolError to answer isError: true
with its own message (truncated to 4096 characters) instead of the fixed
generic failure text. Optional data is returned as structuredContent only
when the tool declares an outputSchema and the data conforms to it;
otherwise it is dropped and onToolError observes the mismatch. onToolCall
reports the new outcome 'tool_error'; onToolError is not called for an
McpToolError. Any other thrown error keeps the generic message. The error
is recognized by a Symbol.for brand as well as instanceof, so a second copy
of the package module still counts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014jmv9dMggduiprzSsNd7iP
Add 2025-11-25 as the preferred supported revision: initialize echoes it
when requested and offers it for an unrecognized one, and the
MCP-Protocol-Version header accepts it.

Reviewed against the 2025-11-25 changelog, the tools/transport/lifecycle/
basic/resources/prompts pages and schema.ts. One change touches the
implemented surface: SEP-1303 classifies input validation failures as tool
execution errors. Under a request whose MCP-Protocol-Version is 2025-11-25,
tools/call arguments failing the declared inputSchema now answer an
isError: true result listing the failed checks; earlier revisions keep the
-32602 protocol error. Unknown tools and malformed arguments stay protocol
errors. The other additions (icons, tasks, Implementation description,
elicitation and sampling changes, authorization discovery, SSE polling)
are optional and not implemented; advertised schemas carry no $schema and
are valid under the 2020-12 default dialect.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014jmv9dMggduiprzSsNd7iP
)

Authors still write `auth: true | {...}` exactly as before. Core now keeps
only the mapping to policies.extensions.auth (true -> {}, required: false
emits nothing) and no longer knows the auth policy vocabulary: RouteAuthConfig
and the schema's routeAuth def are reduced to `required` plus open keys.

The auth extension's policySchema validates the value through the shared
checkExtensionPolicies path, at startup and now also in validateProject
(supplied registrations, else the installed urlcode.json) and the static
`urlcode validate`. normalizeRouteAuth records which routes used the short
form (LoadedDocument.routeAuth), so errors still name the key the author
wrote, e.g. `route /api/items, auth.bearer.quota.requests (minimum)`, with
pointer /routes/~1api~1items/auth/bearer/quota/requests. Keys beside
required: false are still checked. The guidance-claims closed-key rule reads
auth's key set from packages/auth/urlcode.json.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014jmv9dMggduiprzSsNd7iP
… dev (#714)

An error thrown by an extension's activate(), or by core compiling its
registration schemas or credential headers, is now a ConfigError named
for the extension (Extension "<name>" failed to activate: <message>),
with code extension-activation/extension-registration and an extension
detail. The message is collapsed to one line and bounded; no stack.
It is wrapped in prepareExtensions, so validate, test, dev and serve
startup all print it. Request-time answers (AWS/Vercel lazy activation)
stay a fixed 500, and other non-ConfigError failures keep the generic
text.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014jmv9dMggduiprzSsNd7iP
@jimhoyd
jimhoyd merged commit 8f786b1 into main Sep 25, 2026
23 checks passed
@jimhoyd
jimhoyd deleted the claude/sleepy-shannon-xvazgl branch September 25, 2026 03:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment