@nuxtjs/mcp-toolkit 0.6.3 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -72,7 +72,7 @@ function generateDeeplinkUrl(baseUrl, route, ide, serverName) {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
const name = "@nuxtjs/mcp-toolkit";
|
|
75
|
-
const version = "0.
|
|
75
|
+
const version = "0.7.0";
|
|
76
76
|
|
|
77
77
|
const log = logger.withTag("@nuxtjs/mcp-toolkit");
|
|
78
78
|
const { resolve } = createResolver(import.meta.url);
|
|
@@ -113,7 +113,8 @@ const module$1 = defineNuxtModule({
|
|
|
113
113
|
let mcpSummary = null;
|
|
114
114
|
nuxt.hook("modules:done", async () => {
|
|
115
115
|
try {
|
|
116
|
-
|
|
116
|
+
const callCustomHook = nuxt.callHook;
|
|
117
|
+
await callCustomHook("mcp:definitions:paths", paths);
|
|
117
118
|
const result = await loadAllDefinitions(paths);
|
|
118
119
|
if (result.handlers && result.handlers.count > 0) {
|
|
119
120
|
addServerHandler({
|
|
@@ -1,9 +1,27 @@
|
|
|
1
1
|
import type { ZodRawShape } from 'zod';
|
|
2
|
-
import type { CallToolResult, ServerRequest, ServerNotification
|
|
2
|
+
import type { CallToolResult, ServerRequest, ServerNotification } from '@modelcontextprotocol/sdk/types.js';
|
|
3
3
|
import type { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol.js';
|
|
4
4
|
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
5
5
|
import type { ShapeOutput } from '@modelcontextprotocol/sdk/server/zod-compat.js';
|
|
6
6
|
import { type MsCacheDuration, type McpCacheOptions, type McpCache } from './cache.js';
|
|
7
|
+
/**
|
|
8
|
+
* Hints that describe tool behavior to MCP clients.
|
|
9
|
+
*
|
|
10
|
+
* Clients may use these to decide whether to prompt the user for confirmation (human-in-the-loop).
|
|
11
|
+
* All properties are optional hints — they are not guaranteed to be respected by every client.
|
|
12
|
+
*
|
|
13
|
+
* @see https://modelcontextprotocol.io/docs/concepts/tools#tool-annotations
|
|
14
|
+
*/
|
|
15
|
+
export interface McpToolAnnotations {
|
|
16
|
+
/** If `true`, the tool does not modify any state (e.g. a read/search/lookup). Defaults to `false`. */
|
|
17
|
+
readOnlyHint?: boolean;
|
|
18
|
+
/** If `true`, the tool may perform destructive operations like deleting data. Only meaningful when `readOnlyHint` is `false`. Defaults to `true`. */
|
|
19
|
+
destructiveHint?: boolean;
|
|
20
|
+
/** If `true`, calling the tool multiple times with the same arguments has no additional effect beyond the first call. Only meaningful when `readOnlyHint` is `false`. Defaults to `false`. */
|
|
21
|
+
idempotentHint?: boolean;
|
|
22
|
+
/** If `true`, the tool may interact with the outside world (e.g. external APIs, the internet). If `false`, the tool only operates on local/internal data. Defaults to `true`. */
|
|
23
|
+
openWorldHint?: boolean;
|
|
24
|
+
}
|
|
7
25
|
export type { MsCacheDuration };
|
|
8
26
|
export type McpToolCacheOptions<Args = unknown> = McpCacheOptions<Args>;
|
|
9
27
|
export type McpToolCache<Args = unknown> = McpCache<Args>;
|
|
@@ -21,7 +39,8 @@ export interface McpToolDefinition<InputSchema extends ZodRawShape | undefined =
|
|
|
21
39
|
description?: string;
|
|
22
40
|
inputSchema?: InputSchema;
|
|
23
41
|
outputSchema?: OutputSchema;
|
|
24
|
-
annotations?:
|
|
42
|
+
annotations?: McpToolAnnotations;
|
|
43
|
+
inputExamples?: InputSchema extends ZodRawShape ? Partial<ShapeOutput<InputSchema>>[] : never;
|
|
25
44
|
_meta?: Record<string, unknown>;
|
|
26
45
|
handler: McpToolCallback<InputSchema>;
|
|
27
46
|
/**
|
|
@@ -25,7 +25,10 @@ export function registerToolFromDefinition(server, tool) {
|
|
|
25
25
|
inputSchema: tool.inputSchema,
|
|
26
26
|
outputSchema: tool.outputSchema,
|
|
27
27
|
annotations: tool.annotations,
|
|
28
|
-
_meta:
|
|
28
|
+
_meta: {
|
|
29
|
+
...tool._meta,
|
|
30
|
+
...tool.inputExamples && { inputExamples: tool.inputExamples }
|
|
31
|
+
}
|
|
29
32
|
};
|
|
30
33
|
return server.registerTool(name, options, handler);
|
|
31
34
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { logger } from "@nuxt/kit";
|
|
2
|
-
import {
|
|
2
|
+
import { refreshCustomTabs } from "@nuxt/devtools-kit";
|
|
3
3
|
import { spawn } from "node:child_process";
|
|
4
4
|
const log = logger.withTag("@nuxtjs/mcp-toolkit");
|
|
5
5
|
const INSPECTOR_TIMEOUT = 15e3;
|
|
@@ -120,7 +120,14 @@ async function launchMcpInspector(nuxt, options) {
|
|
|
120
120
|
if (inspectorProcess) {
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
|
-
const
|
|
123
|
+
const devServerUrl = nuxt.options.devServer?.url;
|
|
124
|
+
let mcpServerUrl;
|
|
125
|
+
if (devServerUrl) {
|
|
126
|
+
mcpServerUrl = `${devServerUrl.replace(/\/$/, "")}${options.route || "/mcp"}`;
|
|
127
|
+
} else {
|
|
128
|
+
const protocol = nuxt.options.devServer?.https ? "https" : "http";
|
|
129
|
+
mcpServerUrl = `${protocol}://localhost:${nuxt.options.devServer?.port || 3e3}${options.route || "/mcp"}`;
|
|
130
|
+
}
|
|
124
131
|
const inspectorClientPort = getInspectorClientPort();
|
|
125
132
|
const inspectorServerPort = getInspectorServerPort();
|
|
126
133
|
const inspectorBaseUrl = buildInspectorBaseUrl(inspectorClientPort);
|
|
@@ -135,12 +142,13 @@ async function launchMcpInspector(nuxt, options) {
|
|
|
135
142
|
inspectorProcess = spawn("npx", [
|
|
136
143
|
"-y",
|
|
137
144
|
"@modelcontextprotocol/inspector",
|
|
138
|
-
"
|
|
145
|
+
"--transport",
|
|
146
|
+
"http",
|
|
147
|
+
"--server-url",
|
|
139
148
|
mcpServerUrl
|
|
140
149
|
], {
|
|
141
150
|
stdio: ["ignore", "pipe", "pipe"],
|
|
142
|
-
env
|
|
143
|
-
shell: true
|
|
151
|
+
env
|
|
144
152
|
});
|
|
145
153
|
const childProcess = inspectorProcess;
|
|
146
154
|
let stdoutBuffer = "";
|
|
@@ -304,38 +312,44 @@ export function addDevToolsCustomTabs(nuxt, options) {
|
|
|
304
312
|
if (!options.enabled) {
|
|
305
313
|
return;
|
|
306
314
|
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
315
|
+
const registerCustomHook = nuxt.hook;
|
|
316
|
+
registerCustomHook("devtools:customTabs", (tabsArg) => {
|
|
317
|
+
const tabs = tabsArg;
|
|
318
|
+
tabs.push({
|
|
319
|
+
category: "server",
|
|
320
|
+
name: "mcp-inspector",
|
|
321
|
+
title: "MCP Inspector",
|
|
322
|
+
icon: "i-lucide-circuit-board",
|
|
323
|
+
view: isReady && inspectorUrl ? {
|
|
324
|
+
type: "iframe",
|
|
325
|
+
src: inspectorUrl
|
|
326
|
+
} : {
|
|
327
|
+
type: "launch",
|
|
328
|
+
description: "Launch MCP Inspector to test/debug your MCP server",
|
|
329
|
+
actions: [
|
|
330
|
+
{
|
|
331
|
+
label: promise ? "Starting..." : "Launch Inspector",
|
|
332
|
+
pending: !!promise,
|
|
333
|
+
handle() {
|
|
334
|
+
promise = promise || launchMcpInspector(nuxt, options).then(() => {
|
|
335
|
+
refreshCustomTabs(nuxt);
|
|
336
|
+
}).finally(() => {
|
|
337
|
+
promise = null;
|
|
338
|
+
});
|
|
339
|
+
return promise;
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
...inspectorProcess ? [{
|
|
343
|
+
label: "Stop Inspector",
|
|
344
|
+
handle() {
|
|
345
|
+
stopMcpInspector();
|
|
324
346
|
promise = null;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
handle() {
|
|
332
|
-
stopMcpInspector();
|
|
333
|
-
promise = null;
|
|
334
|
-
}
|
|
335
|
-
}] : []
|
|
336
|
-
]
|
|
337
|
-
}
|
|
338
|
-
}), nuxt);
|
|
347
|
+
}
|
|
348
|
+
}] : []
|
|
349
|
+
]
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
});
|
|
339
353
|
nuxt.hook("close", () => {
|
|
340
354
|
stopMcpInspector();
|
|
341
355
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxtjs/mcp-toolkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Create MCP servers directly in your Nuxt application. Define tools, resources, and prompts with a simple and intuitive API.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -39,18 +39,18 @@
|
|
|
39
39
|
"dist"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
43
|
-
"@nuxt/kit": "^4.3.
|
|
42
|
+
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
43
|
+
"@nuxt/kit": "^4.3.1",
|
|
44
44
|
"defu": "^6.1.4",
|
|
45
45
|
"ms": "^2.1.3",
|
|
46
46
|
"pathe": "^2.0.3",
|
|
47
|
-
"satori": "^0.19.
|
|
47
|
+
"satori": "^0.19.2",
|
|
48
48
|
"scule": "^1.3.0",
|
|
49
49
|
"tinyglobby": "^0.2.15"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"zod": "^4.1.13",
|
|
53
|
-
"agents": ">=0.
|
|
53
|
+
"agents": ">=0.4.1"
|
|
54
54
|
},
|
|
55
55
|
"peerDependenciesMeta": {
|
|
56
56
|
"zod": {
|
|
@@ -61,15 +61,15 @@
|
|
|
61
61
|
}
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@nuxt/devtools": "^3.
|
|
65
|
-
"@nuxt/eslint-config": "^1.
|
|
64
|
+
"@nuxt/devtools": "^3.2.1",
|
|
65
|
+
"@nuxt/eslint-config": "^1.15.1",
|
|
66
66
|
"@nuxt/module-builder": "^1.0.2",
|
|
67
|
-
"@nuxt/schema": "^4.3.
|
|
68
|
-
"@nuxt/test-utils": "^
|
|
67
|
+
"@nuxt/schema": "^4.3.1",
|
|
68
|
+
"@nuxt/test-utils": "^4.0.0",
|
|
69
69
|
"@types/node": "latest",
|
|
70
70
|
"changelogen": "^0.6.2",
|
|
71
71
|
"eslint": "^9.39.2",
|
|
72
|
-
"nuxt": "^4.3.
|
|
72
|
+
"nuxt": "^4.3.1",
|
|
73
73
|
"typescript": "~5.9.3",
|
|
74
74
|
"vitest": "^4.0.18",
|
|
75
75
|
"vue-tsc": "^3.2.4"
|