Skip to main content
Glama

nextjs_index

Discover all active Next.js development servers and list their available MCP tools to inspect current state before making changes.

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, 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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
portNo
Behavior5/5

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

With no annotations, the description fully discloses behavior: what it returns (server port, PID, URL, list of tools), requirements (Next.js 16+), troubleshooting steps, and the auto-discovery vs manual port mechanism. No contradictions.

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

Conciseness5/5

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

Well-structured with sections, bullet points, and bold headings. The length is justified given the complexity and importance. Front-loads purpose and usage. Every sentence adds value.

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?

Given no output schema, the description thoroughly explains return values and error scenarios. It covers all necessary context for an AI agent to use the tool effectively, including links to related tools.

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 has one optional 'port' parameter with no description (0% coverage). The description compensates by explaining its use in manual specification when auto-discovery fails. It adds meaning beyond the schema, though it could specify format constraints.

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 clearly states the tool's purpose: 'Discover all running Next.js development servers and list their available MCP tools.' It uses specific verbs and resources, and distinguishes from sibling tools like nextjs_call and upgrade_nextjs_16.

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?

Provides extensive guidance on when to use, including three detailed scenarios (before implementing changes, for diagnostics, for agentic codebase search), a key principle, and fallback instructions. Also explains what to do if no servers are found.

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

Install Server

Other Tools

Latest Blog Posts

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/DaJo-Code/midnight-nextjs-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server