You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+43-33Lines changed: 43 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -182,7 +182,7 @@ Next Devtools, show me the structure of my routes
182
182
Next Devtools, what's in the development server logs?
183
183
```
184
184
185
-
Your coding agent will use the `nextjs_runtime` tool to query your running application's actual state.
185
+
Your coding agent will use the `nextjs_index` and `nextjs_call` tools to query your running application's actual state.
186
186
187
187
### For All Next.js Projects
188
188
@@ -355,7 +355,7 @@ Automate and test web applications using Playwright browser automation.
355
355
- Detecting runtime errors, hydration issues, and client-side problems
356
356
- Capturing browser console errors and warnings
357
357
358
-
**Important:** For Next.js projects, prioritize using the `nextjs_runtime` tool instead of browser console log forwarding. Only use browser_eval's `console_messages` action as a fallback when `nextjs_runtime` tools are not available.
358
+
**Important:** For Next.js projects, prioritize using the `nextjs_index` and `nextjs_call` tools instead of browser console log forwarding. Only use browser_eval's `console_messages` action as a fallback when these tools are not available.
359
359
360
360
**Available actions:**
361
361
-`start` - Start browser automation (automatically installs if needed)
@@ -383,21 +383,17 @@ Automate and test web applications using Playwright browser automation.
383
383
</details>
384
384
385
385
<details>
386
-
<summary><code>nextjs_runtime</code></summary>
386
+
<summary><code>nextjs_index</code></summary>
387
387
388
-
Connect to your running Next.js dev server's built-in MCP endpoint to access live application state, runtime diagnostics, and internal information.
388
+
Discover all running Next.js dev servers and list their available MCP tools.
389
389
390
390
**What this tool does:**
391
391
392
-
This tool acts as a bridge between your coding agent and Next.js 16's built-in MCP endpoint at `/_next/mcp`. It provides three key actions:
392
+
Automatically discovers all running Next.js 16+ dev servers on your machine and lists the runtime diagnostic tools available from each server's built-in MCP endpoint at `/_next/mcp`.
393
393
394
-
1.**`discover_servers`**: Find all running Next.js dev servers on your machine
395
-
2.**`list_tools`**: See what runtime diagnostic tools are available from Next.js
396
-
3.**`call_tool`**: Execute a specific Next.js runtime tool (e.g., get errors, query routes, fetch logs)
394
+
**No parameters required** - Just call the tool and it will scan for servers.
397
395
398
-
**Available Next.js Runtime Tools** (accessed via `call_tool`):
399
-
400
-
Once connected to a Next.js 16+ dev server, you can access these built-in tools:
396
+
**Available Next.js Runtime Tools** (varies by Next.js version):
401
397
-`get_errors` - Get current build, runtime, and type errors
402
398
-`get_logs` - Get path to development log file (browser console + server output)
403
399
-`get_page_metadata` - Query application routes, pages, and component metadata
@@ -408,38 +404,52 @@ Once connected to a Next.js 16+ dev server, you can access these built-in tools:
408
404
- Next.js 16+ (MCP enabled by default)
409
405
- Running dev server (`npm run dev`)
410
406
407
+
**Output:**
408
+
- JSON with list of discovered servers, each containing:
409
+
- Port, PID, URL
410
+
- Available tools with descriptions and input schemas
411
+
412
+
**Example prompts:**
413
+
- "Next Devtools, what servers are running?"
414
+
- "Next Devtools, show me available diagnostic tools"
415
+
416
+
</details>
417
+
418
+
<details>
419
+
<summary><code>nextjs_call</code></summary>
420
+
421
+
Execute a specific MCP tool on a running Next.js dev server.
422
+
423
+
**What this tool does:**
424
+
425
+
Calls a specific runtime diagnostic tool on a Next.js 16+ dev server's built-in MCP endpoint at `/_next/mcp`.
426
+
427
+
**Input Parameters:**
428
+
-`port` (required) - Dev server port (use `nextjs_index` first to discover)
429
+
-`toolName` (required) - Name of the Next.js tool to invoke
430
+
-`args` (optional) - Arguments object for the tool (only if required by that tool)
431
+
432
+
**Requirements:**
433
+
- Next.js 16+ (MCP enabled by default)
434
+
- Running dev server (`npm run dev`)
435
+
- Use `nextjs_index` first to discover available servers and tools
436
+
411
437
**Typical workflow:**
412
438
413
439
```javascript
414
-
// Step 1: Discover running servers (optional - auto-discovery works in most cases)
415
-
{
416
-
"action":"discover_servers"
417
-
}
440
+
// Step 1: Discover servers and tools
441
+
// (call nextjs_index first)
418
442
419
-
// Step 2: List available runtime tools
443
+
// Step 2: Call a specific tool
420
444
{
421
-
"action":"list_tools",
422
-
"port":3000// optional if only one server is running
423
-
}
424
-
425
-
// Step 3: Call a specific tool
426
-
{
427
-
"action":"call_tool",
428
445
"port":3000,
429
446
"toolName":"get_errors"
430
447
// args is optional and only needed if the tool requires parameters
431
448
}
432
449
```
433
450
434
-
**Input Parameters:**
435
-
-`action` (required) - `discover_servers`, `list_tools`, or `call_tool`
436
-
-`port` (optional) - Dev server port (auto-discovers if not provided)
437
-
-`toolName` (required for `call_tool`) - Name of the Next.js tool to invoke
438
-
-`args` (optional) - Arguments object for the tool (only if required by that tool)
439
-
-`includeUnverified` (optional) - For `discover_servers`: include servers even if MCP verification fails
440
-
441
451
**Output:**
442
-
- JSON with discovered servers, available tools list, or tool execution results
452
+
- JSON with tool execution results
443
453
444
454
**Example prompts that use this tool:**
445
455
- "Next Devtools, what errors are in my Next.js app?"
@@ -515,7 +525,7 @@ With other agents or programmatically:
515
525
516
526
`next-devtools-mcp` collects anonymous usage telemetry to help improve the tool. The following data is collected:
517
527
518
-
-**Tool usage**: Which MCP tools are invoked (e.g., `nextjs_runtime`, `browser_eval`, `upgrade_nextjs_16`)
528
+
-**Tool usage**: Which MCP tools are invoked (e.g., `nextjs_index`, `nextjs_call`, `browser_eval`, `upgrade_nextjs_16`)
519
529
-**Error events**: Anonymous error messages when tools fail
520
530
-**Session metadata**: Session ID, timestamps, and basic environment info (OS, Node.js version)
521
531
@@ -616,7 +626,7 @@ Coding Agent
616
626
617
627
2.**For all Next.js projects**: Provides development automation tools (upgrades, Cache Components setup), documentation access, and browser testing capabilities that work independently of the runtime connection.
618
628
619
-
3.**Auto-discovery**: The `nextjs_runtime` tool scans common ports (3000, 3001, etc.) to find running Next.js servers, so you don't need to manually specify ports in most cases.
629
+
3.**Simple workflow**: Call `nextjs_index` to see all servers and available tools, then call `nextjs_call` with the specific port and tool name you want to execute.
0 commit comments