Draft: Harden MCP transport and registry contracts#51
Merged
Trailgenic merged 1 commit intoJul 14, 2026
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Motivation
/datasets/indexcatalog rather than a smaller duplicate object.Description
Originbefore the/mcpOPTIONSearly-return, route all MCP early-error/OPTIONS responses through an origin-awareapplyOriginCorsthat echoes allowed Origins and setsVary: Origin, and document the transport 400/403/405/406/415 responses in the OpenAPI paths. (file:tool-registry/worker.js)Cache-Control: no-cache, leave dataset caching unchanged, and mark capabilities asnot_checkedin/health. (file:tool-registry/worker.js)trailgenic://datasets/indexnow returns the canonicaldatasetCatalog()object (removed the smaller constructed index). (file:lib/resources.js)descriptionand uses strict-object semantics (additionalProperties: false-> Zod.strict()), sotools/listemits schemas that match registry properties, required sets, enums, descriptions, and strictness. (file:lib/mcp-server.js)maximum: 9007199254740991for integer fields lacking an explicit registry maximum; tests normalize this adapter artifact rather than silently drop or alter registry constraints. (explained in PR body and tests)tools/listschema parity, successful representative call for every tool, invalid/extra argument rejection, gear-category corrective errors, full resource parity against REST endpoints (all 35), Origin/CORS preflight/early-error assertions, generated-documentno-cacheverification, and reverse parity between tool definitions and handlers; added live-acceptance checks for deep-equality of the dataset-index resource, disallowed-Origin POST rejection in production, cache-busted root discovery build-version parity, and rootCache-Control: no-cache. (files:tests/worker.vitest.mjs,scripts/live-acceptance.mjs,scripts/validate-registry.mjs,tests/registry.test.mjs)1.4.0to1.4.1while preserving dataset publication dates andlast_updatedvalues. (files:lib/registry.js,package.json,package-lock.json)tool-registry/worker.js,lib/resources.js,lib/mcp-server.js,lib/registry.js,tests/worker.vitest.mjs,tests/registry.test.mjs,scripts/live-acceptance.mjs,scripts/validate-registry.mjs,package.json,package-lock.json.Testing
npm cithennpm run lintandnpm testsuccessfully; unit validationnode --test tests/registry.test.mjspassed after updates.npm run test:workers(Vitest) executed the expanded suite and all tests passed locally after normalizing the SDK integer-maximum artifact.npm run validate:jsonandnpm run validate:registryboth passed and reportedRegistry validation passed: 35 resources(resource inventory = 35).npm run wrangler:dry-runsucceeded (dry-run) with no bindings found.Codex Task