@nuxtjs/mcp-toolkit 0.6.4 → 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
|
}
|
|
@@ -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);
|
|
@@ -305,7 +312,9 @@ export function addDevToolsCustomTabs(nuxt, options) {
|
|
|
305
312
|
if (!options.enabled) {
|
|
306
313
|
return;
|
|
307
314
|
}
|
|
308
|
-
nuxt.hook
|
|
315
|
+
const registerCustomHook = nuxt.hook;
|
|
316
|
+
registerCustomHook("devtools:customTabs", (tabsArg) => {
|
|
317
|
+
const tabs = tabsArg;
|
|
309
318
|
tabs.push({
|
|
310
319
|
category: "server",
|
|
311
320
|
name: "mcp-inspector",
|
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",
|
|
@@ -44,13 +44,13 @@
|
|
|
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.4.
|
|
53
|
+
"agents": ">=0.4.1"
|
|
54
54
|
},
|
|
55
55
|
"peerDependenciesMeta": {
|
|
56
56
|
"zod": {
|
|
@@ -61,11 +61,11 @@
|
|
|
61
61
|
}
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@nuxt/devtools": "^3.
|
|
64
|
+
"@nuxt/devtools": "^3.2.1",
|
|
65
65
|
"@nuxt/eslint-config": "^1.15.1",
|
|
66
66
|
"@nuxt/module-builder": "^1.0.2",
|
|
67
67
|
"@nuxt/schema": "^4.3.1",
|
|
68
|
-
"@nuxt/test-utils": "^
|
|
68
|
+
"@nuxt/test-utils": "^4.0.0",
|
|
69
69
|
"@types/node": "latest",
|
|
70
70
|
"changelogen": "^0.6.2",
|
|
71
71
|
"eslint": "^9.39.2",
|