Next.js DevTools MCP: Your Development Server Just Got Smarter

The Next.js DevTools MCP connects Claude and Cursor to your running dev server. I use it every day.

Trevor I. Lasn Trevor I. Lasn
· 2 min read
Building 0xinsider.com — see who's winning across prediction markets (Polymarket, Kalshi, and more) — and what they're trading right now.

The Next.js DevTools MCP solves a specific problem: coding assistants can read your files, but they can’t see if your app is actually running or what errors you’re getting.

Next.js 16+ includes a built-in MCP endpoint at /_next/mcp. The next-devtools-mcp package discovers this endpoint and exposes live build errors, runtime errors, TypeScript type errors, application routes, page metadata, Server Action definitions, dev server logs, and project configuration.

Installation

Claude Code:

Terminal window
claude mcp add next-devtools npx next-devtools-mcp@latest

OpenAI Codex:

Terminal window
codex mcp add next-devtools -- npx next-devtools-mcp@latest

Google Gemini:

Terminal window
gemini mcp add next-devtools npx next-devtools-mcp@latest

Other editors (.mcp.json in project root):

{
"mcpServers": {
"next-devtools": {
"command": "npx",
"args": ["-y", "next-devtools-mcp@latest"]
}
}
}

Restart your dev server. The package auto-discovers the /_next/mcp endpoint.

Live Error Access

Before:

Terminal window
Error: Cannot read property 'map' of undefined
at Page (app/posts/page.tsx:12)
# You copy/paste the error into Claude

After:

Terminal window
# Claude queries get_errors automatically and sees:
# - Full stack trace + error type
# - Your project structure (get_project_metadata)
# - The actual code in app/posts/page.tsx

Claude checks your project config, searches the docs, writes code, verifies no errors, tests it in the browser, and confirms it works.

The difference: Claude sees your running app instead of guessing from static files.

Available Tools

ToolWhat It Does
get_page_metadataReturns routes, components, and page structure
get_project_metadataExposes project configuration and dependencies
get_server_action_by_idQueries specific Server Actions
get_logsAccess to dev server logs
nextjs_docsSearches official Next.js docs for version-specific patterns
upgrade_nextjs_16Runs codemods for Next.js 16 upgrades
enable_cache_componentsConfigures Cache Components with pre-flight checks
browser_evalPlaywright integration for browser testing

Next.js 16+ gets full support (errors, state, logs). Next.js 15 and below get partial support (upgrades, docs, browser testing).


Trevor I. Lasn

Building 0xinsider.com — see who's winning across prediction markets (Polymarket, Kalshi, and more) — and what they're trading right now. Product engineer based in Tartu, Estonia, building and shipping for over a decade.


Found this article helpful? You might enjoy my free newsletter. I share dev tips and insights to help you grow your coding skills and advance your tech career.


Related Articles

Check out these related articles that might be useful for you. They cover similar topics and provide additional insights.


This article was originally published on https://www.trevorlasn.com/blog/next-js-devtools-mcp. It was written by a human and polished using grammar tools for clarity.