|
| 1 | +# Next.js DevTools MCP |
| 2 | + |
| 3 | +`next-devtools-mcp` is a Model Context Protocol (MCP) server that provides Next.js development tools and utilities for AI coding assistants like Claude and Cursor. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- **Next.js Documentation**: Access Next.js documentation and best practices |
| 8 | +- **Browser Testing**: Integrate with Playwright for browser automation and testing |
| 9 | +- **Chrome DevTools**: Access Chrome DevTools functionality for debugging |
| 10 | +- **Development Prompts**: Pre-configured prompts for common Next.js development tasks |
| 11 | + |
| 12 | +## Requirements |
| 13 | + |
| 14 | +- [Node.js](https://nodejs.org/) v20.19 or a newer [latest maintenance LTS](https://github.com/nodejs/Release#release-schedule) version |
| 15 | +- [npm](https://www.npmjs.com/) or [pnpm](https://pnpm.io/) |
| 16 | + |
| 17 | +## Getting Started |
| 18 | + |
| 19 | +Add the following config to your MCP client: |
| 20 | + |
| 21 | +```json |
| 22 | +{ |
| 23 | + "mcpServers": { |
| 24 | + "next-devtools": { |
| 25 | + "command": "npx", |
| 26 | + "args": ["-y", "next-devtools-mcp@latest"] |
| 27 | + } |
| 28 | + } |
| 29 | +} |
| 30 | +``` |
| 31 | + |
| 32 | +> [!NOTE] |
| 33 | +> Using `next-devtools-mcp@latest` ensures that your MCP client will always use the latest version of the Next.js DevTools MCP server. |
| 34 | +
|
| 35 | +### MCP Client Configuration |
| 36 | + |
| 37 | +<details> |
| 38 | +<summary>Claude Code</summary> |
| 39 | + |
| 40 | +Use the Claude Code CLI to add the Next.js DevTools MCP server: |
| 41 | + |
| 42 | +```bash |
| 43 | +claude mcp add next-devtools npx next-devtools-mcp@latest |
| 44 | +``` |
| 45 | + |
| 46 | +Alternatively, manually configure Claude by editing your MCP settings file and adding the configuration shown above. |
| 47 | + |
| 48 | +</details> |
| 49 | + |
| 50 | +<details> |
| 51 | +<summary>Cursor</summary> |
| 52 | + |
| 53 | +**Click the button to install:** |
| 54 | + |
| 55 | +[Install in Cursor](https://cursor.com/en/install-mcp?name=next-devtools&config=eyJjb21tYW5kIjoibnB4IC15IG5leHQtZGV2dG9vbHMtbWNwQGxhdGVzdCJ9) |
| 56 | + |
| 57 | +**Or install manually:** |
| 58 | + |
| 59 | +Go to `Cursor Settings` → `MCP` → `New MCP Server`. Use the config provided above. |
| 60 | + |
| 61 | +</details> |
| 62 | + |
| 63 | +### Your First Prompt |
| 64 | + |
| 65 | +Enter the following prompt in your MCP client to check if everything is working: |
| 66 | + |
| 67 | +``` |
| 68 | +Help me upgrade my Next.js app to version 16 |
| 69 | +``` |
| 70 | + |
| 71 | +Your MCP client should provide guidance and tools for upgrading your Next.js application. |
| 72 | + |
| 73 | +## Prompts |
| 74 | + |
| 75 | +Pre-configured prompts to help with common Next.js development tasks: |
| 76 | + |
| 77 | +- **`upgrade-nextjs-16`** - Guide for upgrading to Next.js 16 |
| 78 | +- **`enable-cache-components`** - Enable caching for React components |
| 79 | +- **`preload-nextjs-16-knowledge`** - Load Next.js 16 documentation and best practices |
| 80 | + |
| 81 | +## Development |
| 82 | + |
| 83 | +To run the MCP server locally for development: |
| 84 | + |
| 85 | +1. Clone the repository |
| 86 | +2. Install dependencies: |
| 87 | + ```bash |
| 88 | + pnpm install |
| 89 | + ``` |
| 90 | +3. Build the project: |
| 91 | + ```bash |
| 92 | + pnpm build |
| 93 | + ``` |
| 94 | +4. Configure your MCP client to use the local version: |
| 95 | + ```json |
| 96 | + { |
| 97 | + "mcpServers": { |
| 98 | + "next-devtools": { |
| 99 | + "command": "node", |
| 100 | + "args": ["/path/to/next-devtools-mcp/dist/index.js"] |
| 101 | + } |
| 102 | + } |
| 103 | + } |
| 104 | + ``` |
| 105 | + |
| 106 | +## License |
| 107 | + |
| 108 | +See LICENSE file for details. |
| 109 | + |
0 commit comments