GitShow/vercel/mcp-handler
vercel

mcp-handler

Easily spin up an MCP Server on Next.js, Nuxt, Svelte, and more

by vercel
Star on GitHubForkWebsitenpm

TypeScript

643 stars88 forks24 contributorsActive · 1w agoSince 2025v2.1.0

Meet the team

See all 24 on GitHub →
quuu
quuu54 contributions
vercel-release-bot
vercel-release-bot26 contributions
allenzhou101
allenzhou10122 contributions
github-actions[bot]Bot
github-actions[bot]5 contributions
blurrah
blurrah3 contributions
dclark27
dclark273 contributions
markandrus
markandrus3 contributions
joelhooks
joelhooks2 contributions

Languages

View on GitHub →
TypeScript90.7%
JavaScript9.3%

Commit activity

Last 12 weeks · 8 commits

Full graph →

Community health

1 of 6 standards met

Community profile →
50
✓README○License○Contributing○Code of Conduct○Issue Template○PR Template

Recent PRs & issues

Active · Last activity 1w ago
See all on GitHub →
anshusaurav
fix(auth): check token expiry before scopes in withMcpAuthOpenPR

Summary Expired tokens that also lack a required scope now correctly return instead of Moves the check above the check in so expiry is always evaluated first, per RFC 6750 §3.1 Adds regression tests for expiry-vs-scope ordering, live+unscoped, live+scoped, expired-no-scopes-required, and missing-auth paths Fixes #181 Why it matters tells an MCP client its token is no longer valid — the client should refresh or re-authenticate. tells the client it has the wrong permissions — the client will not refresh and may surface a misleading "insufficient permissions" error. When both conditions are true, RFC 6750 requires the expiry to win. Test plan [x] New test: expired + missing scope → 401 (was 403 before fix) [x] New test: live + missing scope → 403 (unchanged) [x] New test: live + matching scope → 200 (unchanged) [x] New test: expired + no required scopes → 401 (unchanged) [x] New test: no auth + required → 401 (unchanged) [x] Full suite passes 29/29 ()

anshusaurav · 4d ago
anshusaurav
withMcpAuth returns 403 instead of 401 for expired tokens that also lack scopesOpenIssue

Bug When is configured with , an expired token that also lacks a required scope receives instead of . Per RFC 6750 §3.1, an expired token is regardless of what other checks fail. The distinction matters because: tells the client its token is no longer valid → the client should refresh or re-authenticate tells the client it has the wrong permissions → the client will not attempt a refresh and may surface a misleading "insufficient permissions" error to the user Reproduction Cause In , the scope check runs before the expiry check. An expired-and-unscoped token hits the scope gate first and never reaches the expiry gate. Fix Move the expiry check above the scope check so that expired tokens are always rejected as (401) before scopes are evaluated.

anshusaurav · 6d ago
quuu
test: harden MCP v2 upgrade boundariesOpenPR

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.

quuu · 1w ago

Recent fixes

View closed PRs →
jalpp
deps: update 1.29.0MergedPR

my project relies on mcp-handler it uses @modelcontextprotocol/ext-apps which needs latest 1.29.0 version of @modelcontextprotocol/sdk@1.29.0, but mcp-handler is pinned to 1.26.0 so having hard time to update deps. Can mcp-handler be updated to use this? I like to stay up to date with latest mcp sdk thanks

jalpp · 1w ago
blurrah
feat: merge createMcpHandler options into a single objectMergedPR
blurrah · 1w ago
quuu
refactor: simplify and harden framework-mounted MCP routesMergedPR

Summary describe mcp-handler as a framework-agnostic Web Request/Response adapter mount one static Streamable HTTP route instead of generating a dynamic transport route remove internal endpoint derivation and legacy SSE/message response handling keep removed 1.x config keys as ignored 2.x type compatibility shims preserve explicit auth handoff without request-global async context reject unexpected browser Origins and support an explicit allowedOriginHostnames list preserve Allow: POST on stateless 405 responses and isolate sync/async event-hook failures make the CLI support src/app, --no-install, and safe refusal to overwrite existing routes fix the CommonJS type declaration export and ship documentation linked from the npm README Validation pnpm test: 44 tests across 6 files SDK 1.26 client connect, discovery, and tool call SDK 2 client in legacy and pinned 2026-07-28 modes concurrent auth isolation plus required, scope, expiry, and verifier failure paths raw HTTP media type, malformed JSON, Origin, method, route, and event failure boundaries generated CLI route and packed CJS/ESM artifact smoke tests pnpm build pnpm exec tsc --noEmit --noUnusedLocals --noUnusedParameters git diff --check linked package in the mcp-for-next.js template: production build and type check pass MCP Inspector CLI: tools/list, valid and invalid tools/call, and a dynamic custom mount path pass Release Includes a patch changeset for mcp-handler.

quuu · 1w ago
Structured data for AI agents

Repository: vercel/mcp-handler. Description: Easily spin up an MCP Server on Next.js, Nuxt, Svelte, and more Stars: 643, Forks: 88. Primary language: TypeScript. Languages: TypeScript (90.7%), JavaScript (9.3%). Homepage: https://www.npmjs.com/package/mcp-handler Latest release: v2.1.0 (1w ago). Open PRs: 15, open issues: 20. Last activity: 1w ago. Community health: 50%. Top contributors: quuu, vercel-release-bot, allenzhou101, github-actions[bot], blurrah, dclark27, markandrus, joelhooks, dvoytenko, patricksevat and others.

·@ofershap

Replace github.com with gitshow.dev