MCP Boilerplate Next.js
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Boilerplate Next.jsshow me how to add a custom tool to the MCP route"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP + Next.js production starter
This is a reusable base for a public MCP server with a React widget rendered
inside ChatGPT. It is intentionally not a submission-ready product: the
only capability is show_greeting, a read-only technical demonstration. Replace
that tool, public-policy content, and submission tests with the real use case
before publishing.
Architecture
app/mcp/route.tsexposes the public stateless MCP endpoint usingmcp-handlerv2 and@modelcontextprotocol/serverv2.web/holds the independent React widget. Vite plusvite-plugin-singlefileproduces one fully inline HTML file atweb/dist/index.htmlbefore the Next.js build.src/mcp/server.tsdeclares the versioned UI resourceui://mcp-nextjs-starter/greeting/v1.html, the tool output schema, read-only annotations, no-auth compatibility metadata, UI metadata, and CSP.The public Next.js pages are a diagnostic and policy site only. They are not self-fetched and they contain no iframe/history/fetch patches.
Related MCP server: ChatGPT Apps SDK Next.js Starter
Requirements
Node.js 22 LTS (
.nvmrc)Corepack and pnpm 10.29.3
The repository uses pnpm's strict dependency build policy. Only reviewed
native builds (sharp and unrs-resolver) are allowed in
pnpm-workspace.yaml; a newly introduced lifecycle script fails installation
until explicitly reviewed.
Configure and run
corepack enable
pnpm install --frozen-lockfile
pnpm devCopy .env.example to a local .env.local when testing a tunnel or production
deployment. PLUGIN_ORIGIN must be an HTTPS origin with no path, query,
fragment, or credentials. Production builds deliberately fail without it:
PLUGIN_ORIGIN=https://plugin.example.com pnpm build
pnpm startIn PowerShell, set it for the current shell instead:
$env:PLUGIN_ORIGIN = "https://plugin.example.com"
pnpm build
pnpm startThe public routes are:
POST /mcp— MCP endpoint.GETandDELETEcurrently return405because this deployment is stateless and does not expose session streaming or termination routes.GET /healthz— no-store health response.GET /.well-known/openai-apps-challenge— returns only the configured domain verification token; otherwise 404./support,/privacy,/terms— starter content that must be replaced for a real product.
Quality gate
pnpm check
PLUGIN_ORIGIN=https://plugin.example.test pnpm build
pnpm audit --prod --audit-level=highpnpm test exercises the MCP initialize/list/read/call flows as well as valid,
invalid, and unknown-tool requests. It also checks the single-file widget,
resource MIME type, output schema, annotations, CSP/domain metadata, and the
absence of https://undefined.
For manual protocol debugging run pnpm inspect, connect it to
http://localhost:3000/mcp, then repeat against the HTTPS preview deployment.
For the final host check, connect the stable HTTPS endpoint in ChatGPT Developer
Mode and exercise the UI bridge, themes, locale, responsiveness, invalid input,
retries, and out-of-scope prompts.
Deploy to Vercel
Set PLUGIN_ORIGIN for every production build to the stable origin: either the
project's fixed *.vercel.app domain or a custom domain. Do not use a Vercel
preview URL as the permanent widget domain. The
Next configuration includes web/dist/** in the /mcp function trace so the
widget file exists at runtime.
Provider-side security, alerting, and rollback tasks are documented in
docs/operations.md. In particular, configure Vercel WAF
and rate limiting for /mcp, alert on initialization/tool failures, and retain
the previous deployment for immediate promotion-based rollback.
OpenAI submission
Follow the current OpenAI MCP, ChatGPT UI, reference, and submission guidance.
Do not create or submit chatgpt-app-submission.json for this generic demo.
Once the real product replaces show_greeting, add exactly five positive and
three negative evaluation cases, justify every annotation, verify the domain,
and ensure support/privacy/terms accurately reflect the deployed service.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Build, deploy, and host full-stack web apps from any MCP client. DB, auth, storage, cron included.
MCP server connecting AI agents to 100+ apps (Gmail, Slack, Notion, GitHub) via one-click OAuth.
Model Context Protocol server for the Apideck Unified API. Connect any MCP-compatible agent framework to 100+ accounting systems, HRIS platforms, file storage providers, and more through one integration. More information https://www.apideck.com/mcp-server
Hosted MCP endpoint with realistic fake data for prototyping agents. 12 tools, no setup.
Related MCP Servers
- -licenseNot gradedqualityNot gradedmaintenanceA template for building MCP servers in Next.js applications using the Vercel MCP Adapter. Provides a foundation for adding custom tools, prompts, and resources to any Next.js project with deployment support on Vercel.
- FlicenseNot gradedqualityDmaintenanceA minimal MCP server demonstrating how to build ChatGPT-compatible applications using Next.js with widget rendering capabilities. Provides a starter template for integrating Next.js applications with the ChatGPT Apps SDK through the Model Context Protocol.
- AlicenseNot gradedqualityDmaintenanceA template for deploying Model Context Protocol servers as Next.js routes using the mcp-handler adapter, enabling easy integration of MCP tools, prompts, and resources into any Next.js application.MIT
- FlicenseNot gradedqualityNot gradedmaintenanceA minimal starter for building OpenAI Apps SDK compatible MCP servers that support native widget rendering within ChatGPT. It demonstrates how to integrate Next.js tools and resources into the ChatGPT interface using the Model Context Protocol.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/BenPDev/mcp-boilerplate-nextjs'
If you have feedback or need assistance with the MCP directory API, please join our Discord server