{"_id":"@bensenescu/mcp-handler","name":"@bensenescu/mcp-handler","dist-tags":{"latest":"1.1.0"},"versions":{"1.1.0":{"name":"@bensenescu/mcp-handler","version":"1.1.0","description":"MCP adapter for Next.js, Nuxt, TanStack Start, and other frameworks","main":"dist/index.js","types":"dist/index.d.ts","type":"commonjs","bin":{"create-mcp-route":"dist/cli/index.js","mcp-handler":"dist/cli/index.js"},"exports":{".":{"types":{"import":"./dist/index.d.mts","require":"./dist/index.d.cjs"},"import":"./dist/index.mjs","require":"./dist/index.js"},"./next":{"types":{"import":"./dist/index.d.mts","require":"./dist/index.d.cjs"},"import":"./dist/index.mjs","require":"./dist/index.js"},"./tanstack":{"types":{"import":"./dist/tanstack/index.d.mts","require":"./dist/tanstack/index.d.ts"},"import":"./dist/tanstack/index.mjs","require":"./dist/tanstack/index.js"}},"repository":{"type":"git","url":"git+https://github.com/bensenescu/mcp-handler.git"},"homepage":"https://github.com/bensenescu/mcp-handler#readme","bugs":{"url":"https://github.com/bensenescu/mcp-handler/issues"},"scripts":{"build":"tsup","dev":"tsup --watch","prepack":"pnpm build","test":"vitest run","test:watch":"vitest watch","version-packages":"changeset version","changeset":"changeset","release":"pnpm build && changeset publish"},"keywords":["mcp","vercel","next.js","ai"],"author":{"name":"bensenescu"},"license":"Apache-2.0","dependencies":{"chalk":"^5.3.0","commander":"^11.1.0","redis":"^4.6.0"},"devDependencies":{"@changesets/cli":"^2.27.12","@types/node":"^22.15.8","tsup":"^8.0.0","typescript":"^5.0.0","vitest":"^3.2.1","zod":"^3.25.50"},"peerDependencies":{"@modelcontextprotocol/sdk":"1.26.0","next":">=13.0.0"},"peerDependenciesMeta":{"@modelcontextprotocol/sdk":{"optional":false},"next":{"optional":true}},"packageManager":"pnpm@9.4.0","publishConfig":{"access":"public"},"_id":"@bensenescu/mcp-handler@1.1.0","_nodeVersion":"23.5.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-xtBYsVjbxWT6z2QFrxzJk5ejHGBvvGCo8mF+IsUI3lFFhlXWer719ii/yUCD5mCfa1JBH1MIKDcvTM14EvNcxg==","shasum":"0ab382064353accc12f4a50857eb94e64baeb31a","tarball":"https://registry.npmjs.org/@bensenescu/mcp-handler/-/mcp-handler-1.1.0.tgz","fileCount":33,"unpackedSize":268321,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDurL1GHjjTrhYaS0p1wIvBXwCCRQYLFTH1TWhlLMm5LgIhAJ3XVW1INRqLzl3CN8owjRymH3kSC93FAIdLASnCe0YY"}]},"_npmUser":{"name":"bensenescu","email":"bensenescu@gmail.com"},"directories":{},"maintainers":[{"name":"bensenescu","email":"bensenescu@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mcp-handler_1.1.0_1778285609785_0.09417713243789083"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-09T00:13:29.688Z","1.1.0":"2026-05-09T00:13:29.955Z","modified":"2026-05-09T00:13:30.156Z"},"maintainers":[{"name":"bensenescu","email":"bensenescu@gmail.com"}],"description":"MCP adapter for Next.js, Nuxt, TanStack Start, and other frameworks","homepage":"https://github.com/bensenescu/mcp-handler#readme","keywords":["mcp","vercel","next.js","ai"],"repository":{"type":"git","url":"git+https://github.com/bensenescu/mcp-handler.git"},"author":{"name":"bensenescu"},"bugs":{"url":"https://github.com/bensenescu/mcp-handler/issues"},"license":"Apache-2.0","readme":"# @bensenescu/mcp-handler\n\nAn adapter for the Model Context Protocol (MCP), enabling real-time communication between your applications and AI models. Supports Next.js, Nuxt, and TanStack Start.\n\n## Installation\n\n```bash\nnpm install @bensenescu/mcp-handler @modelcontextprotocol/sdk@1.26.0 zod@^3\n```\n\n> **Note**: Versions of `@modelcontextprotocol/sdk` prior to 1.26.0 have a security vulnerability. Use version 1.26.0 or later.\n\n## Quick Start (Next.js)\n\n```typescript\n// app/api/[transport]/route.ts\nimport { createMcpHandler } from \"@bensenescu/mcp-handler\";\nimport { z } from \"zod\";\n\nconst handler = createMcpHandler(\n  (server) => {\n    server.registerTool(\n      \"roll_dice\",\n      {\n        title: \"Roll Dice\",\n        description: \"Roll a dice with a specified number of sides.\",\n        inputSchema: {\n          sides: z.number().int().min(2),\n        },\n      },\n      async ({ sides }) => {\n        const value = 1 + Math.floor(Math.random() * sides);\n        return {\n          content: [{ type: \"text\", text: `🎲 You rolled a ${value}!` }],\n        };\n      }\n    );\n  },\n  {},\n  {\n    basePath: \"/api\", // must match where [transport] is located\n    maxDuration: 60,\n    verboseLogs: true,\n  }\n);\n\nexport { handler as GET, handler as POST };\n```\n\n## Connecting Clients\n\nIf your client supports Streamable HTTP, connect directly:\n\n```json\n{\n  \"remote-example\": {\n    \"url\": \"http://localhost:3000/api/mcp\"\n  }\n}\n```\n\nFor stdio-only clients, use [mcp-remote](https://www.npmjs.com/package/mcp-remote):\n\n```json\n{\n  \"remote-example\": {\n    \"command\": \"npx\",\n    \"args\": [\"-y\", \"mcp-remote\", \"http://localhost:3000/api/mcp\"]\n  }\n}\n```\n\n## Documentation\n\n- [Client Integration](docs/CLIENTS.md) - Claude Desktop, Cursor, Windsurf setup\n- [Authorization](docs/AUTHORIZATION.md) - OAuth and token verification\n- [Advanced Usage](docs/ADVANCED.md) - Dynamic routing, Nuxt, configuration options\n- [TanStack Start](docs/TANSTACK_START.md) - TanStack Start route setup\n\n## Features\n\n- **Framework Support**: Next.js, Nuxt, and TanStack Start\n- **Multiple Transports**: Streamable HTTP and Server-Sent Events (SSE)\n- **Redis Integration**: Optional, for SSE transport resumability\n- **TypeScript Support**: Full type definitions included\n\n## Requirements\n\n- Next.js 13+, Nuxt 3+, or TanStack Start\n- Node.js 18+\n- Redis (optional, for SSE)\n\n## License\n\nApache-2.0\n","readmeFilename":"README.md","_rev":"1-40776175b02dc444e76b0d2a2530c1e1"}