nextjs_index
Discover running Next.js dev servers and list their MCP tools for runtime diagnostics, route inspection, and component analysis.
Instructions
Discover all running Next.js development servers and list their available MCP tools.
WHEN TO USE THIS TOOL - Use proactively in these scenarios:
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.
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
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:
Ask the user which port their Next.js dev server is running on
Call this tool again with the 'port' parameter set to the user-provided port
If the MCP endpoint is not available:
Ensure you're running Next.js 16 or later (use the 'upgrade-nextjs-16' prompt to upgrade)
Verify the dev server is running (npm run dev)
Check that the dev server started successfully without errors
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| port | No |