{"id":28285567,"url":"https://github.com/vercel/mcp-adapter","last_synced_at":"2025-06-16T11:31:46.685Z","repository":{"id":293500582,"uuid":"980866938","full_name":"vercel/mcp-adapter","owner":"vercel","description":"Easily spin up an MCP Server on Next.js, Nuxt, Svelte, and more","archived":false,"fork":false,"pushed_at":"2025-06-12T22:53:07.000Z","size":285,"stargazers_count":85,"open_issues_count":2,"forks_count":18,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-06-12T22:58:04.226Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@vercel/mcp-adapter","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vercel.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-09T21:19:44.000Z","updated_at":"2025-06-12T22:52:42.000Z","dependencies_parsed_at":"2025-05-15T17:38:38.653Z","dependency_job_id":null,"html_url":"https://github.com/vercel/mcp-adapter","commit_stats":null,"previous_names":["vercel/mcp-adapter"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vercel/mcp-adapter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vercel%2Fmcp-adapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vercel%2Fmcp-adapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vercel%2Fmcp-adapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vercel%2Fmcp-adapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vercel","download_url":"https://codeload.github.com/vercel/mcp-adapter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vercel%2Fmcp-adapter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260150540,"owners_count":22966334,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-21T19:17:14.498Z","updated_at":"2025-06-16T11:31:46.677Z","avatar_url":"https://github.com/vercel.png","language":"TypeScript","funding_links":[],"categories":["MCP Frameworks and libraries","Cloud Platforms","🌐 Web Development","ツール"],"sub_categories":["TypeScript","How to Submit","MCPサーバー \u0026 ツール"],"readme":"# @vercel/mcp-adapter\n\nA Vercel adapter for the Model Context Protocol (MCP), enabling real-time communication between your applications and AI models. Currently supports Next.js with more framework adapters coming soon.\n\n\n## Installation\n\n```bash\nnpm install @vercel/mcp-adapter @modelcontextprotocol/sdk\n# or\nyarn add @vercel/mcp-adapter @modelcontextprotocol/sdk\n# or\npnpm add @vercel/mcp-adapter @modelcontextprotocol/sdk\n# or\nbun add @vercel/mcp-adapter @modelcontextprotocol/sdk\n```\n\n## Next.js Usage\n\n```typescript\n// app/api/[transport]/route.ts\nimport { createMcpHandler } from \"@vercel/mcp-adapter\";\nconst handler = createMcpHandler(\n  (server) =\u003e {\n    server.tool(\n      \"roll_dice\",\n      \"Rolls an N-sided die\",\n      {\n        sides: z.number().int().min(2),\n      },\n      async ({ sides }) =\u003e {\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    // Optional server options\n  },\n  {\n    // Optional redis config\n    redisUrl: process.env.REDIS_URL,\n    basePath: \"/api\", // this needs to match where the [transport] is located.\n    maxDuration: 60,\n    verboseLogs: true,\n  }\n);\nexport { handler as GET, handler as POST };\n```\n\n## Connecting to your MCP server via stdio\n\nDepending on the version of your client application, remote MCP's may need to use\n[mcp-remote](https://www.npmjs.com/package/mcp-remote) to proxy Streamble HTTP into stdio.\n\nIf your client supports it, it's recommended to connect to the Streamable HTTP endpoint directly such as:\n\n```typescript\n\"remote-example\": {\n  \"url\": \"http://localhost:3000/api/mcp\",\n}\n```\n\nDue to client versions, and varying levels of support, you can list `mcp-remote` as the method for end users to connect to your MCP server.\n\nThe above set up snippet will then look like:\n\n```typescript\n\"remote-example\": {\n  \"command\": \"npx\",\n  \"args\": [\n    \"mcp-remote\",\n    \"-y\",\n    \"http://localhost:3000/api/mcp\" // this is your app/api/[transport]/route.ts\n  ]\n}\n```\n\n## Integrating into your client\n\nWhen you want to use it in your MCP client of choice:\n\nDepending on the version of your client application, remote MCP's may need to use\n[mcp-remote](https://www.npmjs.com/package/mcp-remote) to proxy Streamble HTTP into Stdio.\n\n### Claude Desktop\n\n[Official Docs](https://modelcontextprotocol.io/quickstart/user)\n\nIn order to add an MCP server to Claude Desktop you need to edit the configuration file located at:\n\n```typescript\n\"remote-example\": {\n  \"command\": \"npx\",\n  \"args\": [\n    \"mcp-remote\",\n    \"-y\",\n    \"http://localhost:3000/api/mcp\" // this is your app/api/[transport]/route.ts\n  ]\n}\n```\n\nmacOS: ~/Library/Application Support/Claude/claude_desktop_config.json\nWindows: %APPDATA%\\Claude\\claude_desktop_config.json\nIf it does not exist yet, you may need to enable it under Settings \u003e Developer.\n\nRestart Claude Desktop to pick up the changes in the configuration file. Upon restarting, you should see a hammer icon in the bottom right corner of the input box.\n\n### Cursor\n\n[Official Docs](https://docs.cursor.com/context/model-context-protocol)\n\nThe configuration file is located at ~/.cursor/mcp.json.\n\nAs of version 0.48.0, Cursor supports unauthed SSE servers directly. If your MCP server is using the official MCP OAuth authorization protocol, you still need to add a \"command\" server and call mcp-remote.\n\n### Windsurf\n\n[Official Docs](https://docs.codeium.com/windsurf/mcp)\n\nThe configuration file is located at ~/.codeium/windsurf/mcp_config.json.\n\n## Usage in your app\n\n1. Use the MCP client in your application:\n\n```typescript\n// app/components/YourComponent.tsx\nimport { McpClient } from \"@modelcontextprotocol/sdk/client\";\n\nconst client = new McpClient({\n  // When using basePath, the SSE endpoint will be automatically derived\n  transport: new SSEClientTransport(\"/api/mcp/mcp\"),\n});\n\n// Use the client to make requests\nconst result = await client.request(\"yourMethod\", { param: \"value\" });\n```\n\n## Configuration Options\n\nThe `initializeMcpApiHandler` function accepts the following configuration options:\n\n```typescript\ninterface Config {\n  redisUrl?: string; // Redis connection URL for pub/sub\n  basePath?: string; // string; // Base path for MCP endpoints\n  maxDuration?: number; // Maximum duration for SSE connections in seconds\n  verboseLogs?: boolean; // Log debugging information\n}\n```\n\n## Features\n\n- **Framework Support**: Currently supports Next.js with more framework adapters coming soon\n- **Multiple Transport Options**: Supports both Streamable HTTP and Server-Sent Events (SSE) transports\n- **Redis Integration**: For SSE transport resumability\n- **TypeScript Support**: Full TypeScript support with type definitions\n\n## Requirements\n\n- Next.js 13 or later (for Next.js adapter)\n- Node.js 18 or later\n- Redis (optional, for SSE transport)\n\n## License\n\nApache-2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvercel%2Fmcp-adapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvercel%2Fmcp-adapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvercel%2Fmcp-adapter/lists"}