Skip to content

test: harden MCP v2 upgrade boundaries - #178

Open
quuu wants to merge 1 commit into
mainfrom
mcp-v2-hardening-tests
Open

test: harden MCP v2 upgrade boundaries#178
quuu wants to merge 1 commit into
mainfrom
mcp-v2-hardening-tests

Conversation

@quuu

@quuu quuu commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #176 after exercising the SDK v2 upgrade at raw HTTP, client, framework, CLI, and published-package boundaries.

  • reject unexpected browser Origins and add an explicit allowedOriginHostnames list
  • preserve Allow: POST on stateless 405 responses
  • prevent synchronous and asynchronous onEvent failures from breaking requests or becoming unhandled rejections
  • verify SDK 1.26 clients, SDK 2 legacy mode, and pinned 2026-07-28 mode against the same handler
  • verify auth policies and concurrent auth isolation
  • make the CLI support src/app, --no-install, and safe refusal to overwrite existing routes
  • test the packed artifact, correct its CommonJS type declaration target, and ship the docs linked from the npm README

Defects found by the new tests

  1. Cross-origin browser requests were accepted instead of returning 403.
  2. Stateless GET and DELETE responses returned 405 without Allow: POST.
  3. A throwing onEvent callback failed the MCP request; an async rejection became unhandled.
  4. The CLI overwrote an existing route and could not be integration-tested without installing dependencies.
  5. The published CommonJS types condition referenced the nonexistent dist/index.d.cjs file.
  6. Documentation linked from the npm README was omitted from the tarball.

Validation

  • pnpm test: 44 tests across 6 files
  • pnpm exec tsc --noEmit --noUnusedLocals --noUnusedParameters
  • git diff --check
  • linked package in mcp-for-next.js: type check and production build pass
  • MCP Inspector CLI against the linked Next.js app:
    • tools/list
    • valid tools/call with structured output
    • invalid tools/call returning isError
    • tools/call on a dynamic custom mount path

Release

Includes a patch changeset for mcp-handler 2.0.1.

@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​@​modelcontextprotocol/​sdk@​1.26.09910010096100

View full report

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