next-devtools-guide
Provides guidance on using the next-devtools MCP server. Use when working with Next.js projects that have the MCP server configured, when the user encounters connection issues, or when needing help with error detection, route inspection, Server Action tracing, or Cache Components migration.
What this skill does
# Next.js DevTools MCP **Requirements**: Node.js v20.19+, npm or pnpm, Next.js 16+ for runtime diagnostics. **Total capabilities**: 7 Tools + 2 Prompts + 17 Resources = 26 available features. **Tool naming**: All tools follow `mcp__plugin_next-devtools_next-devtools__<tool-name>`. This file uses abbreviated names for brevity. See `references/tools-reference.md` for the complete tools table and `nextjs_call` tool names. ## Tools (7) | Tool | Purpose | |------|---------| | `init` | Initialize MCP context with documentation-first behavior | | `nextjs_index` | Discover running Next.js dev servers and available MCP tools | | `nextjs_call` | Call a specific MCP tool on a running Next.js dev server | | `nextjs_docs` | Fetch Next.js official documentation by path | | `browser_eval` | Playwright browser automation for testing | | `enable_cache_components` | Migrate to Next.js 16 Cache Components mode | | `upgrade_nextjs_16` | Guide through upgrade to Next.js 16 | ## Prompts (2) | Prompt | Purpose | |--------|---------| | `upgrade-nextjs-16` | Complete upgrade guide including codemod execution and manual fixes | | `enable-cache-components` | Complete Cache Components setup with automated error fixing | ## Resources (17) **Cache Components (13):** - `cache-components://overview` - Critical errors AI agents make, quick reference - `cache-components://core-mechanics` - Fundamental paradigm shift and cacheComponents behavior - `cache-components://public-caches` - Public cache mechanics using 'use cache' - `cache-components://private-caches` - Private cache mechanics using 'use cache: private' - `cache-components://runtime-prefetching` - Prefetch configuration and stale time rules - `cache-components://request-apis` - Async params, searchParams, cookies(), headers() patterns - `cache-components://cache-invalidation` - updateTag(), revalidateTag() patterns and strategies - `cache-components://advanced-patterns` - cacheLife(), cacheTag(), draft mode - `cache-components://build-behavior` - Prerendering, static shells, build-time behavior - `cache-components://error-patterns` - Common errors and solutions - `cache-components://test-patterns` - Real test-driven patterns from 125+ fixtures - `cache-components://reference` - Mental models, API reference, checklists - `cache-components://route-handlers` - Using 'use cache' in Route Handlers (API Routes) **Other (4):** - `nextjs-fundamentals://use-client` - Learn when and why to use 'use client' in Server Components - `nextjs16://migration/beta-to-stable` - Complete guide for migrating from Next.js 16 beta to stable - `nextjs16://migration/examples` - Real-world examples of migrating to Next.js 16 - `nextjs-docs://llms-index` - Complete Next.js documentation index ## Session Initialization Call `init` at the start of every session to establish documentation-first behavior and tool usage guidance. ## Quick Start **Next.js 16+ (runtime diagnostics):** 1. Start the dev server: `npm run dev` (or `pnpm dev`) 2. Call `init` to initialize MCP context 3. Call `nextjs_index` to discover the running server and available tools 4. Call `nextjs_call` with the desired `toolName` to execute tools on the dev server **All Next.js versions (automation and docs):** After `init`, use `upgrade_nextjs_16`, `enable_cache_components`, `nextjs_docs`, or `browser_eval` as needed. ## Common Workflows **Before implementing changes**: Call `nextjs_index` to understand current application state, then `nextjs_call` with the appropriate tool. **Error detection**: Call `nextjs_index`, then `nextjs_call` with `toolName="get_errors"`. **Route inspection**: Call `nextjs_index`, then `nextjs_call` with `toolName="get_routes"`. **Server Action tracing**: Call `nextjs_call` with `toolName="get_server_action_by_id"` and appropriate args. **Documentation search**: Read the `nextjs-docs://llms-index` MCP resource to get the correct path, then call `nextjs_docs` with that path. **Important**: The `args` parameter for `nextjs_call` MUST be an object. Omit `args` entirely if the tool takes no arguments. ## Troubleshooting **MCP server not connecting:** - Verify Next.js v16+ - Confirm `next-devtools-mcp` is configured in `.mcp.json` - Start or restart the dev server (`npm run dev`) - If `nextjs_index` auto-discovery fails, ask the user which port their dev server is running on and pass it as the `port` parameter **"No server info found"**: Dev server must be running. Use the `upgrade_nextjs_16` tool if on Next.js 15 or earlier. **Module not found**: Clear the npx cache and restart the MCP client. ## Best Practices - Call `init` at session start before using other tools - Start the dev server before using `nextjs_index` or `nextjs_call` - Prefer `nextjs_index`/`nextjs_call` over `browser_eval` for error detection and diagnostics - Use `browser_eval` only for tasks requiring actual page rendering or JavaScript execution - Read `nextjs-docs://llms-index` resource first before calling `nextjs_docs`
Related in Web Dev
generating-lwc-components
IncludedLightning Web Components with PICKLES methodology and 165-point scoring. Use this skill when the user creates or edits LWC components, builds wire service patterns, or writes Jest tests for LWC. TRIGGER when: user creates/edits LWC components, touches lwc/**/*.js, .html, .css, .js-meta.xml files, or asks about wire service, SLDS, or Jest LWC tests. DO NOT TRIGGER when: Apex classes (use generating-apex), Aura components, or Visualforce.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Set up queries with useQuery, mutations with useMutation, configure QueryClient caching strategies, implement optimistic updates, and handle infinite scroll with useInfiniteQuery. Use when: setting up data fetching in React projects, migrating from v4 to v5, or fixing object syntax required errors, query callbacks removed issues, cacheTime renamed to gcTime, isPending vs isLoading confusion, keepPreviousData removed problems.
document-processor-api
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
nutrient-document-processing
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Covers useMutationState, simplified optimistic updates, throwOnError, network mode (offline/PWA), and infiniteQueryOptions. Use when setting up data fetching, fixing v4→v5 migration errors (object syntax, gcTime, isPending, keepPreviousData), or debugging SSR/hydration issues with streaming server components.
accelint-nextjs-best-practices
IncludedNext.js performance optimization and best practices. Use when writing Next.js code (App Router or Pages Router); implementing Server Components, Server Actions, or API routes; optimizing RSC serialization, data fetching, or server-side rendering; reviewing Next.js code for performance issues; fixing authentication in Server Actions; or implementing Suspense boundaries, parallel data fetching, or request deduplication.