有官方的 Next.js MCP 服务器吗?
有。Next.js 16+ 在 `/_next/mcp` 内置了 MCP 端点,Vercel 发布了 `next-devtools-mcp` 用于把编码智能体连接到该端点。两者都在 Next.js 官方文档中有说明。
@vercel
基本信息
Vercel 官方的 Next.js MCP 服务器,把编码智能体连接到你正在运行的 Next.js 16+ 开发服务器,获取实时的错误、路由和日志。
使用下面的配置,将此服务器添加到你的 MCP 客户端。
{
"mcpServers": {
"next-devtools": {
"command": "npx",
"args": [
"-y",
"next-devtools-mcp@latest"
]
}
}
}Set up and use browser automation for this project via the agent-browser CLI. This tool does NOT drive the browser itself. It points you at `agent-browser` — a fast, native browser-automation CLI built for agents (https://github.com/vercel-labs/agent-browser) — and tells you how to install it (if needed) and where to start. You then run its commands directly (you have shell access), which is faster and more capable than proxying automation through MCP. Call this when you need to open pages, click, type, screenshot, or capture console errors in a real browser.
Find the version-accurate Next.js documentation for THIS project. This tool does NOT fetch documentation. Next.js 16+ ships its full docs inside the installed package at `node_modules/next/dist/docs/` (markdown), kept in sync with the exact version you have installed. This tool tells you where those docs are and how to read them — so you read the docs that match this project, not a generic or outdated copy. Call this before answering Next.js questions or writing Next.js code. Then read the relevant guide from the path it returns. If the project is on an older Next.js, it will tell you how to upgrade.
Discover all running Next.js development servers and list their available MCP tools. WHEN TO USE THIS TOOL - Use proactively in these scenarios: 1. **Before implementing ANY changes to the app**: When asked to add, modify, or fix anything in the application: - "Add a loading state" → Check current component structure and routes first - "Fix the navigation" → Inspect existing routes and components - "Update the API endpoint" → Query current routes and data flows - "Add error handling" → Check runtime errors and component hierarchy - "Refactor the auth logic" → Inspect current auth implementation and routes - "Optimize performance" → Check runtime diagnostics and component tree Use this to understand where changes should be made and what currently exists. 2. **For diagnostic and investigation questions**: - "What's happening?" / "What's going on?" / "Why isn't this working?" - "Check the errors" / "See what's wrong" - "What routes are available?" / "Show me the routes" - "Clear the cache" / "Reset everything" - Questions about build status, compilation errors, or runtime diagnostics 3. **For agentic codebase search**: Use this as FIRST CHOICE for searching the currently running app. If not found, fallback to static codebase search tools. KEY PRINCIPLE: If the request involves the running Next.js application (whether to investigate OR modify it), query the runtime FIRST to understand current state before proceeding. REQUIREMENTS: - Next.js 16 or later (MCP support was added in v16) - If you're on Next.js 15 or earlier, upgrade first by running 'npx @next/codemod@latest upgrade latest' Next.js 16+ exposes an MCP (Model Context Protocol) endpoint at /_next/mcp automatically when the dev server starts. No configuration needed - MCP is enabled by default in Next.js 16 and later. This tool discovers all running Next.js servers and returns: - Server port, PID, and URL - Complete list of available MCP tools for each server - Tool descriptions and input schemas After calling this tool, use 'nextjs_call' to execute specific tools. [IMPORTANT] If auto-discovery returns no servers: 1. Ask the user which port their Next.js dev server is running on 2. Call this tool again with the 'port' parameter set to the user-provided port If the MCP endpoint is not available: 1. Ensure you're running Next.js 16 or later (upgrade with 'npx @next/codemod@latest upgrade latest') 2. Verify the dev server is running (npm run dev) 3. Check that the dev server started successfully without errors
Call a specific MCP tool on a running Next.js development server. REQUIREMENTS: - Port number of the target Next.js dev server - Tool name to execute - Optional arguments object (if the tool requires parameters) Use 'nextjs_index' first to discover available servers, tools, and their input schemas. If 'nextjs_index' auto-discovery fails, ask the user for the port and call 'nextjs_index' again with the 'port' parameter. IMPORTANT: When calling tools: - The 'args' parameter MUST be an object (e.g., {key: "value"}), NOT a string - If a tool doesn't require arguments, OMIT the 'args' parameter entirely - do NOT pass {} or "{}" - Check the tool's inputSchema from 'nextjs_index' to see what arguments are required Common Next.js MCP tools include: - Error diagnostics (get compilation/runtime errors) - Route information (list all routes) - Build status (check compilation state) - Cache management (clear caches) - And more (varies by Next.js version) Example usage: 1. Call 'nextjs_index' to see servers and tools 2. Call 'nextjs_call' with port=3000, toolName="get_errors" to get errors from server on port 3000
官方的 Next.js MCP 服务器是 Vercel 的 next-devtools-mcp,它把 Claude、Cursor 等编码智能体连接到你正在运行的 Next.js 开发服务器,让它们读取实时的错误、路由、日志和编译问题。
从 Next.js 16 开始,开发服务器本身就在 /_next/mcp 提供了内置的 MCP 端点。next-devtools-mcp 是一个轻量连接器:它发现你本机上正在运行的 Next.js 16+ 开发服务器,并把它们的端点代理给智能体。它还提供两个网关工具,分别把智能体引导到 node_modules/next/dist/docs/ 中与版本匹配的文档,以及 agent-browser CLI。项目位于 vercel/next-devtools-mcp,采用 MIT 许可证,免费使用,无需 API key。
前置条件:
nextjs_index 和 nextjs_call 需要)最快的安装方式会为本机检测到的所有编码智能体完成配置:
npx add-mcp next-devtools-mcp@latest
加上 -y 可跳过确认,加上 -g 可全局安装。也可以把它添加到项目根目录的 .mcp.json(或客户端的 MCP 配置)中:
{
"mcpServers": {
"next-devtools": {
"command": "npx",
"args": ["-y", "next-devtools-mcp@latest"]
}
}
}
然后用 npm run dev 启动应用。Next.js 16+ 默认在 http://localhost:3000/_next/mcp 启用该端点,next-devtools-mcp 会自动发现它,无需额外配置。请在浏览器中打开你正在开发的页面,因为 get_errors、get_page_metadata 等工具会读取活动的浏览器会话。
claude mcp add next-devtools npx next-devtools-mcp@latest
使用 README 中的 “Install in Cursor” 链接,或者进入 Cursor Settings → MCP → New MCP Server,粘贴上面的配置。
code --add-mcp '{"name":"next-devtools","command":"npx","args":["-y","next-devtools-mcp@latest"]}'
codex mcp add next-devtools -- npx next-devtools-mcp@latest
在 Windows 11 上,需要在 .codex/config.toml 的服务器条目中添加 env = { SystemRoot="C:\\Windows", PROGRAMFILES="C:\\Program Files" } 和 startup_timeout_ms = 20_000。
README 还介绍了 Amp、Gemini CLI、Google Antigravity 和 Warp 的配置方法。
示例提示词:“Next Devtools, what errors are in my Next.js application?” 或 “Next Devtools, show me the structure of my routes.”
next build 的编译检查:Turbopack 项目可以直接从开发服务器按路由返回编译问题。nextjs_docs 把智能体引导到你所安装的 Next.js 版本自带的文档。browser_eval 告诉智能体如何安装和运行 agent-browser CLI。NEXT_TELEMETRY_DISABLED=1 关闭。服务器本身提供四个工具:
nextjs_index 发现正在运行的开发服务器,并列出每个服务器暴露的运行时工具。nextjs_call 在已发现的服务器上调用一个运行时工具,参数为 port、toolName 和可选的 args。nextjs_docs 是网关工具,返回内置文档的路径(在 Next.js 16 以下版本会建议升级)。browser_eval 是网关工具,返回 agent-browser 的安装步骤;它本身并不驱动浏览器。通过 nextjs_call,智能体可以访问 Next.js 在 /_next/mcp 提供的运行时工具(具体集合随版本变化):get_errors、get_logs、get_page_metadata、get_project_metadata、get_routes 和 get_server_action_by_id,以及仅限 Turbopack 的 get_compilation_issues 和 compile_route,还有需要开启 experimental.requestInsights 的 get_request_insights。
get_errors 并提出修复方案,例如针对 hydration 不匹配的问题。/blog/[slug] 运行 compile_route,而不是执行完整的 next build。get_server_action_by_id 把错误中的 action ID 定位回源文件。/_next/mcp 端点是官方方案的核心。next-dev-loop 等智能体 skills 会直接调用它,因此无需 next-devtools-mcp 也能工作;而 MCP 包为智能体在不同项目和版本之间提供一套统一的工具。[error] No server info found:nextjs_index 和 nextjs_call 需要一个正在运行的 Next.js 16+ 开发服务器。用 npm run dev 启动,确认版本为 16 或更高,并检查启动过程没有报错。nextjs_docs 和 browser_eval 不需要开发服务器。next.config 中没有把 experimental.mcpServer 设为 false,重启开发服务器,并确认客户端已加载 MCP 配置。next-devtools-mcp/dist 的 ERR_MODULE_NOT_FOUND:清理 npx 缓存并重启 MCP 客户端。init、upgrade_nextjs_16 和 enable_cache_components 已在 0.4.0 中移除;升级和 Cache Components 工作流现在以智能体 skills 的形式提供。有。Next.js 16+ 在 `/_next/mcp` 内置了 MCP 端点,Vercel 发布了 `next-devtools-mcp` 用于把编码智能体连接到该端点。两者都在 Next.js 官方文档中有说明。
运行时工具需要 Next.js 16 或更高版本。在旧版本上,`nextjs_docs` 会建议使用 `npx @next/codemod@latest upgrade latest` 升级。
免费。它以 MIT 许可证开源,不需要账号或 API key。
可以。README 提供了 Claude Code、Cursor、VS Code/Copilot、Codex、Gemini CLI、Amp、Antigravity 和 Warp 的配置步骤。
不需要。Next.js 16+ 默认启用它。如需关闭,在 `next.config` 中把 `experimental.mcpServer` 设为 `false`。
本地。服务器通过 npx 以 stdio 方式运行,与你本机上的开发服务器通信;它不会连接到生产部署。
匿名的工具使用情况、错误事件和基本的会话元数据,但不会收集你的代码、文件路径或工具参数。可以用 `export NEXT_TELEMETRY_DISABLED=1` 关闭,并用 `rm -rf ~/.next-devtools-mcp` 删除本地数据。
现在不能了。升级工具已在 0.4.0 中移除,升级工作流改为以智能体 skills 的形式分发。
Modelglass turns "which model should I use?" into a lookup instead of a guess. Seven tools give your agent live pricing across image, language, video, and audio models. Sourced and versioned, not scraped once and forgott

Official Porkbun MCP server, maintained by Porkbun. Check domain availability and pricing, register, renew and transfer domains, and manage DNS records, nameservers, URL forwarding, glue records, DNSSEC and domain contac

AI-native payments for tools and APIs. Discover, pay for, execute, and publish monetized APIs directly from your agent, settled per call in USDC over x402, through the Model Context Protocol. payments · finance · x402 ·

The elmah.io MCP server allows AI assistants to interact directly with your error logs, deployments, and organization statistics. Debug production issues faster than ever before.

SSH MCP server for AI agents: remote commands, file transfer, log search and server audits through OpenSSH.
评论