Skip to content

Commit 5fd9b49

Browse files
authored
fix: update inspector cli args and fix tab refresh (#124)
1 parent b996443 commit 5fd9b49

File tree

2 files changed

+44
-40
lines changed

2 files changed

+44
-40
lines changed

packages/nuxt-mcp-toolkit/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nuxtjs/mcp-toolkit",
3-
"version": "0.6.3",
3+
"version": "0.6.4",
44
"description": "Create MCP servers directly in your Nuxt application. Define tools, resources, and prompts with a simple and intuitive API.",
55
"repository": {
66
"type": "git",

packages/nuxt-mcp-toolkit/src/runtime/server/mcp/devtools/index.ts

Lines changed: 43 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { logger } from '@nuxt/kit'
2-
import { addCustomTab } from '@nuxt/devtools-kit'
2+
import { refreshCustomTabs } from '@nuxt/devtools-kit'
33
import type { Nuxt } from 'nuxt/schema'
44
import type { ModuleOptions } from '../../../../module'
55
import { spawn } from 'node:child_process'
@@ -171,12 +171,11 @@ async function launchMcpInspector(nuxt: Nuxt, options: ModuleOptions): Promise<v
171171
inspectorProcess = spawn('npx', [
172172
'-y',
173173
'@modelcontextprotocol/inspector',
174-
'streamable-http',
175-
mcpServerUrl,
174+
'--transport', 'http',
175+
'--server-url', mcpServerUrl,
176176
], {
177177
stdio: ['ignore', 'pipe', 'pipe'],
178178
env,
179-
shell: true,
180179
})
181180

182181
const childProcess = inspectorProcess
@@ -368,42 +367,47 @@ export function addDevToolsCustomTabs(nuxt: Nuxt, options: ModuleOptions) {
368367
return
369368
}
370369

371-
addCustomTab(() => ({
372-
category: 'server',
373-
name: 'mcp-inspector',
374-
title: 'MCP Inspector',
375-
icon: 'i-lucide-circuit-board',
376-
view: isReady && inspectorUrl
377-
? {
378-
type: 'iframe',
379-
src: inspectorUrl,
380-
}
381-
: {
382-
type: 'launch',
383-
description: 'Launch MCP Inspector to test/debug your MCP server',
384-
actions: [
385-
{
386-
label: promise ? 'Starting...' : 'Launch Inspector',
387-
pending: !!promise,
388-
handle() {
389-
promise = promise || launchMcpInspector(nuxt, options).finally(() => {
390-
promise = null
391-
})
392-
return promise
393-
},
394-
},
395-
...(inspectorProcess
396-
? [{
397-
label: 'Stop Inspector',
398-
handle() {
399-
stopMcpInspector()
370+
// @ts-ignore devtools:customTabs hook is provided by @nuxt/devtools-kit
371+
nuxt.hook('devtools:customTabs', (tabs) => {
372+
tabs.push({
373+
category: 'server',
374+
name: 'mcp-inspector',
375+
title: 'MCP Inspector',
376+
icon: 'i-lucide-circuit-board',
377+
view: isReady && inspectorUrl
378+
? {
379+
type: 'iframe',
380+
src: inspectorUrl,
381+
}
382+
: {
383+
type: 'launch',
384+
description: 'Launch MCP Inspector to test/debug your MCP server',
385+
actions: [
386+
{
387+
label: promise ? 'Starting...' : 'Launch Inspector',
388+
pending: !!promise,
389+
handle() {
390+
promise = promise || launchMcpInspector(nuxt, options).then(() => {
391+
refreshCustomTabs(nuxt)
392+
}).finally(() => {
400393
promise = null
401-
},
402-
}]
403-
: []),
404-
],
405-
},
406-
}), nuxt)
394+
})
395+
return promise
396+
},
397+
},
398+
...(inspectorProcess
399+
? [{
400+
label: 'Stop Inspector',
401+
handle() {
402+
stopMcpInspector()
403+
promise = null
404+
},
405+
}]
406+
: []),
407+
],
408+
},
409+
})
410+
})
407411

408412
nuxt.hook('close', () => {
409413
stopMcpInspector()

0 commit comments

Comments
 (0)