NextJS
OfficialProvides Next.js development tools and utilities for AI coding assistants, including runtime diagnostics, automated upgrades, and access to official documentation.
Supercharge your Next.js workflow with powerful, AI-ready development tools. next-devtools-mcp gives coding agents like Claude and Cursor real-time access to runtime diagnostics, automated upgrade utilities, and curated Next.js knowledge for faster, smarter project development. Instantly surface errors, explore app routes, enable new features, and leverage official documentation, all from your preferred coding assistant. Enjoy seamless support for Next.js 16+ projects as well as robust automation and browser testing for any Next.js version. Boost productivity and code quality with guided prompts, on-demand tools, and focused resources for every phase of Next.js development.
What it does
- Search and retrieve Next.js official documentation
- Upgrade Next.js projects to version 16
- Automate browser testing with Playwright integration
- Discover running Next.js development servers
- Enable Cache Components mode for Next.js 16
- Call MCP tools on running dev servers
Best for
About NextJS
NextJS is an official MCP server published by vercel that provides AI assistants with tools and capabilities via the Model Context Protocol. Supercharge your NextJS projects with AI-powered tools for diagnostics, upgrades, and docs. Accelerate development and b It is categorized under developer tools. This server exposes 7 tools that AI clients can invoke during conversations and coding sessions.
How to install
You can install NextJS in your AI client of choice. Use the install panel on this page to get one-click setup for Cursor, Claude Desktop, VS Code, and other MCP-compatible clients. This server runs locally on your machine via the stdio transport.
License
NextJS is released under the MIT license. This is a permissive open-source license, meaning you can freely use, modify, and distribute the software.
Tools (7)
Automate and test web applications using Playwright browser automation. This tool connects to playwright-mcp server and provides access to all Playwright capabilities. CRITICAL FOR PAGE VERIFICATION: When verifying pages in Next.js projects (especially during upgrades or testing), you MUST use browser automation to load pages in a real browser instead of curl or simple HTTP requests. This is because: - Browser automation actually renders the page and executes JavaScript (curl only fetches HTML) - Detects runtime errors, hydration issues, and client-side problems that curl cannot catch - Verifies the full user experience, not just HTTP status codes - Captures browser console errors and warnings via console_messages action IMPORTANT FOR NEXT.JS PROJECTS: If working with a Next.js application, PRIORITIZE using the 'nextjs_index' and 'nextjs_call' tools instead of browser console log forwarding. Next.js has built-in MCP integration that provides superior error reporting, build diagnostics, and runtime information directly from the Next.js dev server. Only use browser_eval's console_messages action as a fallback when these Next.js tools are not available or when you specifically need to test client-side browser behavior that Next.js runtime cannot capture. Available actions: - start: Start browser automation (automatically installs if needed). Verbose logging is always enabled. - navigate: Navigate to a URL - click: Click on an element - type: Type text into an element - fill_form: Fill multiple form fields at once - evaluate: Execute JavaScript in browser context - screenshot: Take a screenshot of the page - console_messages: Get browser console messages (for Next.js, prefer nextjs_index/nextjs_call tools instead) - close: Close the browser - drag: Perform drag and drop - upload_file: Upload files - list_tools: List all available browser automation tools from the server Note: The playwright-mcp server will be automatically installed if not present.
Migrate Next.js applications to Cache Components mode and complete setup for Next.js 16. Use this tool when you need to: - Migrate to Cache Components mode - Migrate to cache components - Enable Cache Components - Set up Cache Components - Convert to Cache Components This tool handles ALL steps for migrating and enabling Cache Components: - Configuration: Updates cacheComponents flag (experimental in 16.0.0, stable in canary > 16), removes incompatible flags - Dev Server: Starts dev server (MCP is enabled by default in Next.js 16+) - Error Detection: Loads all routes via browser automation, collects errors using Next.js MCP - Automated Fixing: Adds Suspense boundaries, "use cache" directives, generateStaticParams, cacheLife profiles, cache tags - Verification: Validates all routes work with zero errors Key Features: - One-time dev server start (no restarts needed) - Automated error detection using Next.js MCP tools - Browser-based testing with browser automation - Fast Refresh applies fixes instantly - Comprehensive fix strategies for all error types - Support for "use cache", "use cache: private", Suspense boundaries - Cache invalidation with cacheTag() and cacheLife() configuration Requires: - Next.js 16.0.0+ (stable or canary only - beta versions are NOT supported) - Clean working directory preferred - Browser automation installed (auto-installed if needed) This tool embeds complete knowledge base for: - Cache Components mechanics - Error patterns and solutions - Caching strategies (static vs dynamic) - Advanced patterns (cacheLife, cacheTag, draft mode) - Build behavior and prefetching - Test-driven patterns from 125+ fixtures
⚠️ CALL THIS FIRST - Initialize Next.js DevTools MCP context and establish MANDATORY documentation requirements. **IMPORTANT: This tool MUST be called at the START of every Next.js development session.** This tool fetches the latest Next.js documentation and establishes ABSOLUTE requirements for using the nextjs_docs tool for ALL Next.js-related queries. Key Points: - Fetches latest Next.js LLM documentation from nextjs.org - Establishes MANDATORY requirement to use nextjs_docs for ALL Next.js concepts - Instructs AI to forget any prior Next.js knowledge and always query docs - Documents all available MCP tools (nextjs_docs, nextjs_index, nextjs_call, browser_eval, upgrade_nextjs_16, enable_cache_components) Use this tool at the beginning of a Next.js session to: - Reset AI's Next.js knowledge baseline - Ensure 100% documentation-first approach with no exceptions - Understand available tools and their use cases - Follow best practices for Next.js development
Search and retrieve Next.js official documentation. Three actions: 1) 'get' - Fetch full docs with a path (preferred after init). 2) 'search' - Find docs by keyword (redirects to use llms.txt index if init was called). 3) 'force-search' - Bypass init check and force API search (escape hatch only). After calling init, prefer using 'get' directly with paths from the llms.txt index.
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, use the 'upgrade-nextjs-16' MCP prompt to upgrade first 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 (use the 'upgrade-nextjs-16' prompt to upgrade) 2. Verify the dev server is running (npm run dev) 3. Check that the dev server started successfully without errors
Next.js DevTools MCP
next-devtools-mcp is a Model Context Protocol (MCP) server that provides Next.js development tools and utilities for coding agents like Claude and Cursor.
Getting Started
Requirements
- Node.js v20.19 or a newer latest maintenance LTS version
- npm or pnpm
Install with add-mcp
Install the MCP server for all your coding agents:
npx add-mcp next-devtools-mcp@latest
Add -y to skip the confirmation prompt and install to all detected agents already in use in the project directory. Add -g to install globally across all projects.
Manual installation
Add the following config to your MCP client:
{
"mcpServers": {
"next-devtools": {
"command": "npx",
"args": ["-y", "next-devtools-mcp@latest"]
}
}
}
[!NOTE] Using
next-devtools-mcp@latestensures that your MCP client will always use the latest version of the Next.js DevTools MCP server.
MCP Client Configuration
Amp
Using Amp CLI:
amp mcp add next-devtools -- npx next-devtools-mcp@latest
Or configure manually:
Follow Amp's MCP documentation and apply the standard configuration shown above.
Claude Code
Use the Claude Code CLI to add the Next.js DevTools MCP server:
claude mcp add next-devtools npx next-devtools-mcp@latest
Alternatively, manually configure Claude by editing your MCP settings file and adding the configuration shown above.
Codex
Using Codex CLI:
codex mcp add next-devtools -- npx next-devtools-mcp@latest
Or configure manually:
Follow the MCP setup guide with the standard configuration format:
- Command:
npx - Arguments:
-y, next-devtools-mcp@latest
Windows 11 Special Configuration:
Update .codex/config.toml with environment variables and increased startup timeout:
env = { SystemRoot="C:\\Windows", PROGRAMFILES="C:\\Program Files" }
startup_timeout_ms = 20_000
Cursor
Click the button to install:
Or install manually:
Go to Cursor Settings → MCP → New MCP Server. Use the config provided above.
Gemini
Using Gemini CLI:
Project-wide installation:
gemini mcp add next-devtools npx next-devtools-mcp@latest
Global installation:
gemini mcp add -s user next-devtools npx next-devtools-mcp@latest
Or configure manually:
Follow the MCP setup guide with these parameters:
- Command:
npx - Arguments:
-y, next-devtools-mcp@latest
Google Antigravity
Configure in MCP config file:
Add this to your Antigravity MCP config file: .gemini/antigravity/mcp_config.json
{
"mcpServers": {
"next-devtools": {
"command": "npx",
"args": ["-y", "next-devtools-mcp@latest"]
}
}
}
See Antigravity MCP docs for more info.
VS Code / Copilot
Using VS Code CLI:
code --add-mcp '{"name":"next-devtools","command":"npx","args":["-y","next-devtools-mcp@latest"]}'
Or configure manually:
Follow the official VS Code MCP server setup guide and add the Next.js DevTools server through VS Code settings.
Warp
Using Warp UI:
Navigate to Settings | AI | Manage MCP Servers and select + Add to register a new MCP server with the following configuration:
- Name:
next-devtools - Command:
npx - Arguments:
-y, next-devtools-mcp@latest
Quick Start
For Next.js 16+ Projects (Recommended)
To unlock the full power of runtime diagnostics, start your Next.js dev server:
npm run dev
Next.js 16+ has MCP enabled by default at http://localhost:3000/_next/mcp (or whichever port your dev server uses). The next-devtools-mcp server will automatically discover and connect to it.
⚠️ IMPORTANT: Start every Next.js session by calling the init tool to set up proper context:
Use the init tool to set up Next.js DevTools context
This initializes the MCP context and ensures the AI assistant uses official Next.js documentation for all queries.
After initialization, try these prompts to explore runtime diagnostics:
Next Devtools, what errors are in my Next.js application?
Next Devtools, show me the structure of my routes
Next Devtools, what's in the development server logs?
Your coding agent will use the nextjs_index and nextjs_call tools to query your running application's actual state.
For All Next.js Projects
You can use the development automation and documentation tools regardless of Next.js version:
Next Devtools, help me upgrade my Next.js app to version 16
Next Devtools, enable Cache Components in my Next.js app
Next Devtools, search Next.js docs for generateMetadata
💡 Pro Tip: Auto-Initialize on Every Session
To make your AI assistant automatically call the init tool at the start of every Next.js session without being asked, add this instruction to your agent's configuration file:
Claude Code / Claude Desktop
Add to ~/.claude/CLAUDE.md (global) or ./.claude/CLAUDE.md (project-specific):
**When starting work on a Next.js project, ALWAYS call the `init` tool from
next-devtools-mcp FIRST to set up proper context and establish documentation
requirements. Do this automatically without being asked.**
Cursor
Add to .cursorrules in your project root or global Cursor settings:
When working with Next.js, always call the init tool from next-devtools-mcp
at the start of the session to establish proper context and documentation requirements.
Codex / Other AI Coding Assistants
Add to your agent's configuration file (e.g., .codex/instructions.md, agent.md, or similar):
**Next.js Initialization**: When starting work on a Next.js project, automatically
call the `init` tool from the next-devtools-mcp server FIRST. This establishes
proper context and ensures all Next.js queries use official documentation.
Why this matters:
- ✅ Ensures consistent context across all Next.js work
- ✅ Automatically establishes the documentation-first requirement
- ✅ No need to manually call init every time
- ✅ Works across all your Next.js projects
MCP Resources
The knowledge base resources are automatically available to your coding agent and are split into focused sections for efficient context management. Current resource URIs:
📚 Available Knowledge Base Resources (click to expand)
-
Cache Components (12 sections):
cache-components://overviewcache-components://core-mechanicscache-components://public-cachescache-components://private-cachescache-components://runtime-prefetchingcache-components://request-apiscache-components://cache-invalidationcache-components://advanced-patternscache-components://build-behaviorcache-components://error-patternscache-components://test-patternscache-components://reference
-
Next.js 16 migration:
nextjs16://migration/beta-to-stablenextjs16://migration/examples
-
Next.js fundamentals:
nextjs-fundamentals://use-client
Resources are loaded on-demand by your coding agent, providing targeted knowledge without overwhelming the context window.
MCP Prompts
Pre-configured prompts to help with common Next.js development tasks:
💡 Available Prompts (click to expand)
upgrade-nextjs-16- Guide for upgrading to Next.js 16enable-cache-components- Migrate and enable Cache Components mode for Next.js 16
MCP Tools
init
Initialize Next.js DevTools MCP context and establish documentation requirements.
Capabilities:
- Sets up proper context for AI assistants working with Next.js
- Establishes requirement to use
nextjs_docsfor ALL Next.js-related queries - Documents all available MCP tools and their use cases
- Provides best practices for Next.js development with MCP
- Includes example workflows and quick start checklist
When to use:
- At the beginning of a Next.js development session
- To understand available tools and establish proper context
- To ensure documentation-first approach for Next.js development
Input:
project_path(optional) - Path to Next.js project (defaults to current directory)
Output:
- Comprehensive initialization context and guidance for Next.js development with MCP tools
nextjs_docs
Search and retrieve Next.js official documentation and knowledge base.
Capabilities:
- Two-step process: 1) Search for docs by keyword to get paths, 2) Fetch full markdown content by path
- Uses official Next.js documentation search API
- Provides access to comprehensive Next.js guides, API references, and best practices
- Supports filtering by router type (App Router, Pages Router, or both)
Input:
action(required) - Action to perform:searchto find docs,getto fetch full contentquery(optional) - Required forsearch. Keyword search query (e.g., 'metadata',
README truncated. View full README on GitHub.
Alternatives
Related Skills
Browse all skillsExpert Next.js developer mastering Next.js 14+ with App Router and full-stack features. Specializes in server components, server actions, performance optimization, and production deployment with focus on building fast, SEO-friendly applications.
UI design system toolkit for Senior UI Designer including design token generation, component documentation, responsive design calculations, and developer handoff tools. Use for creating design systems, maintaining visual consistency, and facilitating design-dev collaboration.
Answer questions about the AI SDK and help build AI-powered features. Use when developers: (1) Ask about AI SDK functions like generateText, streamText, ToolLoopAgent, embed, or tools, (2) Want to build AI agents, chatbots, RAG systems, or text generation features, (3) Have questions about AI providers (OpenAI, Anthropic, Google, etc.), streaming, tool calling, structured output, or embeddings, (4) Use React hooks like useChat or useCompletion. Triggers on: "AI SDK", "Vercel AI SDK", "generateText", "streamText", "add AI to my app", "build an agent", "tool calling", "structured output", "useChat".
Master API documentation with OpenAPI 3.1, AI-powered tools, and modern developer experience practices. Create interactive docs, generate SDKs, and build comprehensive developer portals. Use PROACTIVELY for API documentation or developer portal creation.
Use when working with the OpenAI API (Responses API) or OpenAI platform features (tools, streaming, Realtime API, auth, models, rate limits, MCP) and you need authoritative, up-to-date documentation (schemas, examples, limits, edge cases). Prefer the OpenAI Developer Documentation MCP server tools when available; otherwise guide the user to enable `openaiDeveloperDocs`.
Guide for building TypeScript CLIs with Bun. Use when creating command-line tools, adding subcommands to existing CLIs, or building developer tooling. Covers argument parsing, subcommand patterns, output formatting, and distribution.