Skip to content

Commit fa0722c

Browse files
committed
feat: Add Next.js Turbopack support, update READMEs, and fix prepublish script.
1 parent 78ef6e3 commit fa0722c

File tree

3 files changed

+63
-46
lines changed

3 files changed

+63
-46
lines changed

README.md

Lines changed: 44 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -27,38 +27,27 @@ Works with any MCP-compatible AI client. Supports ACP agents: **Claude Code**, *
2727

2828
## 🎬 Demo Video
2929

30-
[![Demo Video](https://media4.giphy.com/media/v1.Y2lkPTc5MGI3NjExbnVvb2Y4MmJqbGJyMGJkendvZjkzZHN5MG4zY21mMXhjemF6dWk4aSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/67nUJwE7Fb2TMhBjhy/giphy.gif)](https://www.youtube.com/shorts/TCt2oOtPS_k)
31-
3230
👉 **Watch the demo:** [https://www.youtube.com/shorts/TCt2oOtPS_k](https://www.youtube.com/shorts/TCt2oOtPS_k)
3331

3432
## 📢 Social Media
3533

3634
🐦 **Twittter/X Post:** [https://x.com/yaoandyan/status/1995082020431753600](https://x.com/yaoandyan/status/1995082020431753600?s=20)
3735

38-
## 👥 Team
39-
40-
- [yaonyan](https://huggingface.co/zpharnoex) - Project Creator
41-
42-
## 🤝 Sponsors & Integrations
43-
44-
This project uses the following sponsor APIs and platforms:
45-
46-
- **Anthropic** - Claude API for MCP integration testing and AI-powered debugging capabilities
47-
- **Gradio** - `@gradio/client` for connecting to Gradio-powered APIs in the demo app
48-
49-
---
5036

5137
![Demo: MCP-powered visual debugging in action](https://media.giphy.com/media/sGCk7b783GiGm5vZGl/giphy.gif)
5238

5339
## Key Features
5440

5541
### 🎯 Visual Context
42+
5643
Click any element to instantly send its source code location, computed styles, and DOM hierarchy to AI. No more explaining "it's the blue button in the header".
5744

5845
### 🛠️ Full DevTools Access
46+
5947
AI can access Chrome DevTools to analyze network requests, console logs, and performance metrics. It sees what you see.
6048

6149
### 🤖 Multi-Agent Workflow
50+
6251
Switch between agents (Claude Code, Goose) and track their debugging progress visually with step-by-step status updates.
6352

6453
## Quick Start
@@ -87,13 +76,15 @@ npx @mcpc-tech/unplugin-dev-inspector-mcp setup
8776
```
8877

8978
**Options:**
79+
9080
- `--dry-run` - Preview changes without applying them
9181
- `--config <path>` - Specify config file path (auto-detect by default)
9282
- `--bundler <type>` - Specify bundler type: vite, webpack, nextjs
9383
- `--no-backup` - Skip creating backup files
9484
- `--help` - Show help message
9585

9686
**Examples:**
87+
9788
```bash
9889
# Preview changes before applying
9990
npx @mcpc-tech/unplugin-dev-inspector-mcp setup --dry-run
@@ -106,6 +97,7 @@ npx @mcpc-tech/unplugin-dev-inspector-mcp setup --bundler vite
10697
```
10798

10899
This will:
100+
109101
- Detect your bundler configuration
110102
- Add the necessary import
111103
- Add the plugin to your configuration
@@ -237,6 +229,7 @@ export default function RootLayout({ children }) {
237229
```
238230

239231
**Running modes:**
232+
240233
- **Webpack mode:** `next dev` (uses webpack configuration)
241234
- **Turbopack mode:** `next dev --turbopack` (uses turbopack configuration, Next.js 16+ default)
242235

@@ -255,8 +248,6 @@ export default function RootLayout({ children }) {
255248

256249
- **Angular** - Support coming soon
257250

258-
259-
260251
## Configuration
261252

262253
### Auto-Update MCP Config
@@ -270,13 +261,13 @@ The plugin automatically updates MCP configuration files for detected editors wh
270261
DevInspector.vite({
271262
// Auto-detect and update (default: true)
272263
updateConfig: true,
273-
264+
274265
// Or specify editors manually
275266
updateConfig: ['cursor', 'vscode'],
276-
267+
277268
// Or disable
278269
updateConfig: false,
279-
270+
280271
// Server name in MCP config (default: 'dev-inspector')
281272
updateConfigServerName: 'my-app-inspector',
282273
})
@@ -301,13 +292,12 @@ DevInspector.vite({
301292

302293
### Custom Agents
303294

304-
This plugin uses the [Agent Client Protocol (ACP)](https://agentclientprotocol.com) to connect with AI agents.
295+
This plugin uses the [Agent Client Protocol (ACP)](https://agentclientprotocol.com) to connect with AI agents.
305296

306297
⏱️ **Note:** Initial connection may be slow as agents are launched via `npx` (downloads packages on first run).
307298

308299
Default agents: [View configuration →](https://github.com/mcpc-tech/dev-inspector-mcp/blob/main/packages/unplugin-dev-inspector/client/constants/agents.ts)
309300

310-
311301
You can customize available AI agents and set a default agent:
312302

313303
```typescript
@@ -339,11 +329,11 @@ export default {
339329
```
340330

341331
**Key Features:**
332+
342333
- Custom agents with the **same name** as [default agents](https://agentclientprotocol.com/overview/agents) automatically inherit missing properties (icons, env)
343334
- You can override just the command/args while keeping default icons
344335
- If no custom agents provided, defaults are: Claude Code, Codex CLI, Gemini CLI, Kimi CLI, Goose, OpenCode
345336

346-
347337
## What It Does
348338

349339
**Click element → Describe issue → AI analyzes → Get fix**
@@ -354,68 +344,81 @@ export default {
354344
4. Get intelligent solutions through natural conversation
355345

356346
**Examples:**
347+
357348
- "Why is this button not clickable?" → AI checks `pointer-events`, z-index, overlays
358349
- "This API call is failing" → AI analyzes network requests, timing, responses
359350
- "Where is this component?" → Jump to source file and line number
360351

361352
## Two Workflow Modes
362-
363-
DevInspector offers two ways to interact with your AI, depending on your preference:
364-
365-
### 1. Editor Mode
366-
**Best for:** Code-heavy tasks, refactoring, and maintaining flow.
367-
368-
- **How it works:** You use your IDE's AI assistant (Cursor, Windsurf, Copilot).
369-
- **The Flow:** Click an element in the browser -> The context (source, props, styles) is sent to your Editor via MCP -> You ask your Editor to fix it.
370-
- **Why:** Keeps you in your coding environment.
371-
372-
### 2. Inspector Bar Mode (Recommended)
373-
**Best for:** Quick fixes, visual tweaks, or if you don't use an AI editor.
374-
375-
- **How it works:** You use the floating "Inspector Bar" directly in the browser.
376-
- **The Flow:** Click "Ask AI" in the browser -> Select an agent (e.g., Claude Code, Custom Script) -> The agent runs in your terminal but interacts with the browser overlay.
377-
- **Why:** No context switching. Great for "what is this?" questions or network debugging.
378-
379-
## MCP Tools
353+
354+
DevInspector offers two ways to interact with your AI, depending on your preference:
355+
356+
### 1. Editor Mode
357+
358+
**Best for:** Code-heavy tasks, refactoring, and maintaining flow.
359+
360+
- **How it works:** You use your IDE's AI assistant (Cursor, Windsurf, Copilot).
361+
- **The Flow:** Click an element in the browser -> The context (source, props, styles) is sent to your Editor via MCP -> You ask your Editor to fix it.
362+
- **Why:** Keeps you in your coding environment.
363+
364+
### 2. Inspector Bar Mode (Recommended)
365+
366+
**Best for:** Quick fixes, visual tweaks, or if you don't use an AI editor.
367+
368+
- **How it works:** You use the floating "Inspector Bar" directly in the browser.
369+
- **The Flow:** Click "Ask AI" in the browser -> Select an agent (e.g., Claude Code, Custom Script) -> The agent runs in your terminal but interacts with the browser overlay.
370+
- **Why:** No context switching. Great for "what is this?" questions or network debugging.
371+
372+
## MCP Tools
380373

381374
### `capture_element_context`
375+
382376
Activates visual selector. Returns source location, DOM hierarchy, styles, dimensions, and user notes.
383377

384378
### `list_inspections`
379+
385380
Shows all inspections with ID, element details, notes, and status (pending/in-progress/completed/failed).
386381

387382
### `update_inspection_status`
383+
388384
Updates inspection status with optional progress steps.
389385

390386
**Parameters:** `status`, `message` (required for completed/failed), `progress`, `inspectionId` (optional)
391387

392388
### `execute_page_script`
389+
393390
Executes JavaScript in browser context. Access to window, document, React/Vue instances, localStorage.
394391

395392
### `chrome_devtools`
393+
396394
Agentic tool for Chrome DevTools access. Provides network inspection, console logs, performance metrics, element interaction, and more.
397395

398396
## MCP Prompts
399397

400398
### `capture_element`
399+
401400
Capture and analyze UI element context.
402401

403402
### `view_inspections`
403+
404404
View all pending, in-progress, and completed inspections.
405405

406406
### `launch_chrome_devtools`
407+
407408
Opens Chrome with DevTools API. Unlocks network analysis, console logs, performance metrics.
408409

409410
**Parameter:** `url` (defaults to dev server)
410411

411412
💡 Optional if Chrome is already open. Use when you need to launch a new Chrome instance.
412413

413414
### `get_network_requests`
415+
414416
List network requests or get details of a specific one. Always refreshes the list first.
415417

416418
**Parameter:** `reqid` (optional) - If provided, get details for that request. If omitted, just list all requests.
417419

418420
### `get_console_messages`
421+
419422
List console messages or get details of a specific one. Always refreshes the list first.
420423

421424
**Parameter:** `msgid` (optional) - If provided, get details for that message. If omitted, just list all messages.
@@ -425,6 +428,7 @@ List console messages or get details of a specific one. Always refreshes the lis
425428
For a deep dive into how the MCP context, CMCP library, and Puppet binding mechanism work together, see the [Architecture Documentation](./docs/architecture/mcp-cmcp-puppet-architecture.md).
426429

427430
**Key concepts:**
431+
428432
- **Hub-and-spoke model**: Vite dev server acts as central hub managing multiple client connections
429433
- **CMCP bidirectional execution**: Server defines tool schemas, browser client provides implementations
430434
- **Puppet binding**: Enables Chrome DevTools ↔ Inspector message passthrough

packages/unplugin-dev-inspector/README.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<p align="center">
2-
<img src="./assets/logo.svg" alt="DevInspector Logo" width="200" height="200" />
2+
<img src="./assets/logo.svg" alt="DevInspector Logo" width="50" height="50" />
33
</p>
44

55
# @mcpc-tech/unplugin-dev-inspector-mcp
@@ -196,11 +196,14 @@ module.exports = {
196196

197197
### Next.js
198198

199+
Next.js supports **both Webpack and Turbopack** modes:
200+
199201
```diff
200202
// next.config.ts
201-
+import DevInspector from '@mcpc-tech/unplugin-dev-inspector-mcp';
203+
+import DevInspector, { turbopackDevInspector } from '@mcpc-tech/unplugin-dev-inspector-mcp';
202204

203205
const nextConfig: NextConfig = {
206+
+ // Webpack configuration (default mode: `next dev`)
204207
+ webpack: (config) => {
205208
+ config.plugins.push(
206209
+ DevInspector.webpack({
@@ -209,6 +212,13 @@ const nextConfig: NextConfig = {
209212
+ );
210213
+ return config;
211214
+ },
215+
+
216+
+ // Turbopack configuration (`next dev --turbopack`)
217+
+ turbopack: {
218+
+ rules: turbopackDevInspector({
219+
+ enabled: true,
220+
+ }),
221+
+ },
212222
};
213223

214224
export default nextConfig;
@@ -232,7 +242,10 @@ export default function RootLayout({ children }) {
232242
}
233243
```
234244

235-
> 💡 **Note:** Webpack and Next.js use a standalone server on port 8888. Run `next dev --webpack` for Webpack mode (Next.js 16+ defaults to Turbopack).
245+
**Running modes:**
246+
247+
- **Webpack mode:** `next dev` (uses webpack configuration)
248+
- **Turbopack mode:** `next dev --turbopack` (uses turbopack configuration, Next.js 16+ default)
236249

237250
## Framework Support
238251

@@ -243,7 +256,7 @@ export default function RootLayout({ children }) {
243256
- **Svelte** - `.svelte` components (Vite, Webpack)
244257
- **SolidJS** - `.jsx` and `.tsx` files (Vite, Webpack)
245258
- **Preact** - `.jsx` and `.tsx` files (Vite, Webpack)
246-
- **Next.js** - React with Webpack mode
259+
- **Next.js** - React with Webpack and Turbopack modes
247260

248261
### 🚧 In Progress
249262

packages/unplugin-dev-inspector/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mcpc-tech/unplugin-dev-inspector-mcp",
3-
"version": "0.0.20",
3+
"version": "0.0.21",
44
"description": "Universal dev inspector plugin for React/Vue - inspect component sources and API calls in any bundler",
55
"type": "module",
66
"license": "MIT",
@@ -85,7 +85,7 @@
8585
"lint:fix": "oxlint --fix .",
8686
"format": "oxfmt .",
8787
"format:check": "oxfmt --check .",
88-
"prepublishOnly": "cp ../../README.md . && pnpm build"
88+
"prepublishOnly": "cp ./README.md ../../ && pnpm build"
8989
},
9090
"peerDependencies": {
9191
"esbuild": ">=0.17.0",

0 commit comments

Comments
 (0)