Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Model Context Protocol (MCP) with Next.js

Run an MCP server on Vercel with Next.js.

MCP

Example Next.js MCP Server

Uses@vercel/mcp-adapter

Usage

This sample app uses theVercel MCP Adapter that allows you to drop in an MCP server on a group of routes in any Next.js project.

Updateapp/[transport]/route.ts with your tools, prompts, and resources following theMCP TypeScript SDK documentation.

Notes for running on Vercel

  • To use the SSE transport, requires a Redis attached to the project underprocess.env.REDIS_URL
  • Make sure you haveFluid compute enabled for efficient execution
  • After enabling Fluid compute, openapp/route.ts and adjustmaxDuration to 800 if you using a Vercel Pro or Enterprise account
  • Deploy the Next.js MCP template

Sample Client

script/test-client.mjs contains a sample client to try invocations.

node scripts/test-client.mjs https://mcp-for-next-js.vercel.app
MCP

Model Context Protocol (MCP) with Next.js

Run an MCP server on Vercel with Next.js.

Example Next.js MCP Server

Uses@vercel/mcp-adapter

Usage

This sample app uses theVercel MCP Adapter that allows you to drop in an MCP server on a group of routes in any Next.js project.

Updateapp/[transport]/route.ts with your tools, prompts, and resources following theMCP TypeScript SDK documentation.

Notes for running on Vercel

  • To use the SSE transport, requires a Redis attached to the project underprocess.env.REDIS_URL
  • Make sure you haveFluid compute enabled for efficient execution
  • After enabling Fluid compute, openapp/route.ts and adjustmaxDuration to 800 if you using a Vercel Pro or Enterprise account
  • Deploy the Next.js MCP template

Sample Client

script/test-client.mjs contains a sample client to try invocations.

node scripts/test-client.mjs https://mcp-for-next-js.vercel.app

Related Templates

Unleash New Possibilities

Deploy your app on Vercel and unlock its full potential


[8]ページ先頭

©2009-2025 Movatter.jp