Skip to main content
Glama
Next.js DevTools MCP

Next.js DevTools MCP

Official
by vercel

nextjs_index

Discovers running Next.js dev servers and lists available MCP tools to inspect routes, errors, and runtime state before modifying your app.

Instructions

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

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "nextjs_index"
  }
}

Input Schema

NameRequiredDescriptionDefault
portNoOptional port number to probe directly; null is treated as omitted. Use this when auto-discovery fails - ask the user which port their Next.js dev server is running on.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.4.2
    • addedInput schema / $schema
      Added value: +"http://json-schema.org/draft-07/schema#"
    • addedInput schema / properties / port / description
      Added value: +"Optional port number to probe directly; null is treated as omitted. Use this when auto-discovery fails - ask the user which port their Next.js dev server is running on."
    • changedInput schema / properties / port / type
      Previous value: -"string"New value: +[
      +  "string",
      +  "number",
      +  "null"
      +]
  2. First observedv0.3.10

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations supplied, the description carries the full burden and does well: it discloses the Next.js 16+ requirement, that MCP is auto-enabled at /_next/mcp, what the return payload contains (port, PID, URL, tool list with schemas), and how to recover from a failed discovery. It does not state side-effect/read-only guarantees or latency, which is the remaining gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose and key principle are front-loaded and the structure is scannable, but the tool is over-long: the upgrade command 'npx @next/codemod@latest upgrade latest' is repeated in two places, the ~7 example phrasings under scenario 1 are redundant, and the MCP-endpoint explanation spans several sentences that could be condensed.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a discovery tool with one optional parameter and no output schema, the description covers everything needed: prerequisites, default endpoint behavior, returned fields, the follow-up sibling to call, and explicit recovery steps for both empty discovery and missing MCP endpoint.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% and the single 'port' parameter is already documented, so the baseline is 3; the description earns an extra point by adding actionable semantics — use it only when auto-discovery fails and derive the value by asking the user which port their dev server uses.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource — 'Discover all running Next.js development servers and list their available MCP tools' — and makes clear that this is discovery rather than execution by directing the agent to nextjs_call for that. An agent can tell this apart from nextjs_call and nextjs_docs immediately.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It provides explicit when-to-use scenarios (before app changes, for diagnostics, as first choice for codebase search) plus named alternatives and the sequencing rule ('query the runtime FIRST', then use nextjs_call). It also gives failure handling instructions when auto-discovery returns nothing.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools