@nuxtjs/mcp-toolkit 0.0.0 → 0.0.1

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.
Files changed (46) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +133 -0
  3. package/dist/module.d.mts +42 -0
  4. package/dist/module.json +11 -0
  5. package/dist/module.mjs +116 -0
  6. package/dist/runtime/server/mcp/config.d.ts +10 -0
  7. package/dist/runtime/server/mcp/config.js +12 -0
  8. package/dist/runtime/server/mcp/constants.d.ts +22 -0
  9. package/dist/runtime/server/mcp/constants.js +10 -0
  10. package/dist/runtime/server/mcp/definitions/handlers.d.ts +18 -0
  11. package/dist/runtime/server/mcp/definitions/handlers.js +3 -0
  12. package/dist/runtime/server/mcp/definitions/index.d.ts +4 -0
  13. package/dist/runtime/server/mcp/definitions/index.js +4 -0
  14. package/dist/runtime/server/mcp/definitions/prompts.d.ts +79 -0
  15. package/dist/runtime/server/mcp/definitions/prompts.js +32 -0
  16. package/dist/runtime/server/mcp/definitions/resources.d.ts +130 -0
  17. package/dist/runtime/server/mcp/definitions/resources.js +94 -0
  18. package/dist/runtime/server/mcp/definitions/tools.d.ts +64 -0
  19. package/dist/runtime/server/mcp/definitions/tools.js +38 -0
  20. package/dist/runtime/server/mcp/definitions/utils.d.ts +14 -0
  21. package/dist/runtime/server/mcp/definitions/utils.js +23 -0
  22. package/dist/runtime/server/mcp/devtools/index.d.ts +3 -0
  23. package/dist/runtime/server/mcp/devtools/index.js +342 -0
  24. package/dist/runtime/server/mcp/handler.d.ts +2 -0
  25. package/dist/runtime/server/mcp/handler.js +37 -0
  26. package/dist/runtime/server/mcp/loaders/index.d.ts +28 -0
  27. package/dist/runtime/server/mcp/loaders/index.js +119 -0
  28. package/dist/runtime/server/mcp/loaders/utils.d.ts +13 -0
  29. package/dist/runtime/server/mcp/loaders/utils.js +139 -0
  30. package/dist/runtime/server/mcp/utils.d.ts +18 -0
  31. package/dist/runtime/server/mcp/utils.js +42 -0
  32. package/dist/runtime/server/mcp/validators/index.d.ts +4 -0
  33. package/dist/runtime/server/mcp/validators/index.js +3 -0
  34. package/dist/runtime/server/mcp/validators/prompts.d.ts +14 -0
  35. package/dist/runtime/server/mcp/validators/prompts.js +36 -0
  36. package/dist/runtime/server/mcp/validators/resources.d.ts +14 -0
  37. package/dist/runtime/server/mcp/validators/resources.js +43 -0
  38. package/dist/runtime/server/mcp/validators/tools.d.ts +14 -0
  39. package/dist/runtime/server/mcp/validators/tools.js +47 -0
  40. package/dist/runtime/server/types/hooks.d.ts +16 -0
  41. package/dist/runtime/server/types/index.d.ts +1 -0
  42. package/dist/runtime/server/types/index.js +1 -0
  43. package/dist/runtime/server/types.server.d.ts +14 -0
  44. package/dist/types.d.mts +5 -0
  45. package/package.json +74 -2
  46. /package/dist/{.gitkeep → runtime/server/types/hooks.js} +0 -0
@@ -0,0 +1,119 @@
1
+ import { addServerTemplate, logger } from "@nuxt/kit";
2
+ import {
3
+ createExcludePatterns,
4
+ createTemplateContent,
5
+ loadDefinitionFiles,
6
+ toIdentifier
7
+ } from "./utils.js";
8
+ const log = logger.withTag("@nuxtjs/mcp-toolkit");
9
+ async function loadMcpDefinitions(type, templateFilename, paths) {
10
+ try {
11
+ const result = await loadDefinitionFiles(paths);
12
+ addServerTemplate({
13
+ filename: templateFilename,
14
+ getContents: () => {
15
+ if (result.count === 0) {
16
+ return `export const ${type} = []
17
+ `;
18
+ }
19
+ const entries = result.files.map((file) => {
20
+ const filename = file.split("/").pop();
21
+ const identifier = toIdentifier(filename);
22
+ return [identifier, file];
23
+ });
24
+ return createTemplateContent(type, entries);
25
+ }
26
+ });
27
+ return result;
28
+ } catch (error) {
29
+ const errorMessage = error instanceof Error ? error.message : String(error);
30
+ log.error(`Failed to load ${type} definitions from paths: ${paths.join(", ")}`);
31
+ log.error(`Error: ${errorMessage}`);
32
+ throw new Error(`Failed to load MCP ${type} definitions. Check that the paths exist and contain valid definition files.`);
33
+ }
34
+ }
35
+ async function loadHandlers(paths = []) {
36
+ try {
37
+ if (paths.length === 0) {
38
+ addServerTemplate({
39
+ filename: "#nuxt-mcp/handlers.mjs",
40
+ getContents: () => `export const handlers = []
41
+ `
42
+ });
43
+ return { count: 0, files: [], overriddenCount: 0 };
44
+ }
45
+ const excludePatterns = createExcludePatterns(paths, ["tools", "resources", "prompts"]);
46
+ const result = await loadDefinitionFiles(paths, {
47
+ excludePatterns,
48
+ filter: (filePath) => {
49
+ const relativePath = filePath.replace(/.*\/server\//, "");
50
+ return !relativePath.includes("/tools/") && !relativePath.includes("/resources/") && !relativePath.includes("/prompts/");
51
+ }
52
+ });
53
+ addServerTemplate({
54
+ filename: "#nuxt-mcp/handlers.mjs",
55
+ getContents: () => {
56
+ if (result.count === 0) {
57
+ return `export const handlers = []
58
+ `;
59
+ }
60
+ const entries = result.files.map((file) => {
61
+ const filename = file.split("/").pop();
62
+ const identifier = toIdentifier(filename);
63
+ return [identifier, file];
64
+ });
65
+ return createTemplateContent("handlers", entries);
66
+ }
67
+ });
68
+ return result;
69
+ } catch (error) {
70
+ const errorMessage = error instanceof Error ? error.message : String(error);
71
+ log.error(`Failed to load handler definitions from paths: ${paths.join(", ")}`);
72
+ log.error(`Error: ${errorMessage}`);
73
+ throw new Error(`Failed to load MCP handler definitions. Check that the paths exist and contain valid handler files.`);
74
+ }
75
+ }
76
+ export async function loadTools(paths) {
77
+ return loadMcpDefinitions("tools", "#nuxt-mcp/tools.mjs", paths);
78
+ }
79
+ export async function loadResources(paths) {
80
+ return loadMcpDefinitions("resources", "#nuxt-mcp/resources.mjs", paths);
81
+ }
82
+ export async function loadPrompts(paths) {
83
+ return loadMcpDefinitions("prompts", "#nuxt-mcp/prompts.mjs", paths);
84
+ }
85
+ export { loadHandlers };
86
+ export async function loadAllDefinitions(paths) {
87
+ try {
88
+ const [tools, resources, prompts, handlers] = await Promise.all([
89
+ loadTools(paths.tools),
90
+ loadResources(paths.resources),
91
+ loadPrompts(paths.prompts),
92
+ loadHandlers(paths.handlers ?? [])
93
+ ]);
94
+ const results = {
95
+ tools,
96
+ resources,
97
+ prompts,
98
+ handlers
99
+ };
100
+ return {
101
+ ...results,
102
+ total: tools.count + resources.count + prompts.count + handlers.count
103
+ };
104
+ } catch (error) {
105
+ const errorMessage = error instanceof Error ? error.message : String(error);
106
+ log.error("Failed to load MCP definitions");
107
+ log.error(`Error: ${errorMessage}`);
108
+ throw new Error("Failed to load MCP definitions. Please check your configuration and ensure definition files are valid.");
109
+ }
110
+ }
111
+ export async function getHandlerRoutes() {
112
+ try {
113
+ const handlersModule = await import("#nuxt-mcp/handlers.mjs");
114
+ const handlers = handlersModule.handlers;
115
+ return handlers.map((h) => ({ name: h.name, route: h.route }));
116
+ } catch {
117
+ return [];
118
+ }
119
+ }
@@ -0,0 +1,13 @@
1
+ export interface LoadResult {
2
+ count: number;
3
+ files: string[];
4
+ overriddenCount: number;
5
+ }
6
+ export declare function createFilePatterns(paths: string[], extensions?: string[]): string[];
7
+ export declare function createExcludePatterns(paths: string[], subdirs: string[]): string[];
8
+ export declare function toIdentifier(filename: string): string;
9
+ export declare function createTemplateContent(type: string, entries: Array<[string, string]>): string;
10
+ export declare function loadDefinitionFiles(paths: string[], options?: {
11
+ excludePatterns?: string[];
12
+ filter?: (filePath: string) => boolean;
13
+ }): Promise<LoadResult>;
@@ -0,0 +1,139 @@
1
+ import { getLayerDirectories } from "@nuxt/kit";
2
+ import { resolve as resolvePath } from "pathe";
3
+ import { glob } from "tinyglobby";
4
+ const RESERVED_KEYWORDS = /* @__PURE__ */ new Set([
5
+ "break",
6
+ "case",
7
+ "catch",
8
+ "class",
9
+ "const",
10
+ "continue",
11
+ "debugger",
12
+ "default",
13
+ "delete",
14
+ "do",
15
+ "else",
16
+ "export",
17
+ "extends",
18
+ "finally",
19
+ "for",
20
+ "function",
21
+ "if",
22
+ "import",
23
+ "in",
24
+ "instanceof",
25
+ "new",
26
+ "return",
27
+ "super",
28
+ "switch",
29
+ "this",
30
+ "throw",
31
+ "try",
32
+ "typeof",
33
+ "var",
34
+ "void",
35
+ "while",
36
+ "with",
37
+ "yield",
38
+ "enum",
39
+ "implements",
40
+ "interface",
41
+ "let",
42
+ "package",
43
+ "private",
44
+ "protected",
45
+ "public",
46
+ "static",
47
+ "await",
48
+ "abstract",
49
+ "boolean",
50
+ "byte",
51
+ "char",
52
+ "double",
53
+ "final",
54
+ "float",
55
+ "goto",
56
+ "int",
57
+ "long",
58
+ "native",
59
+ "short",
60
+ "synchronized",
61
+ "transient",
62
+ "volatile"
63
+ ]);
64
+ export function createFilePatterns(paths, extensions = ["ts", "js", "mts", "mjs"]) {
65
+ const layerDirectories = getLayerDirectories();
66
+ return layerDirectories.flatMap(
67
+ (layer) => paths.flatMap(
68
+ (pathPattern) => extensions.map((ext) => resolvePath(layer.server, `${pathPattern}/*.${ext}`))
69
+ )
70
+ );
71
+ }
72
+ export function createExcludePatterns(paths, subdirs) {
73
+ const layerDirectories = getLayerDirectories();
74
+ return layerDirectories.flatMap(
75
+ (layer) => paths.flatMap(
76
+ (pathPattern) => subdirs.map((subdir) => resolvePath(layer.server, `${pathPattern}/${subdir}/**`))
77
+ )
78
+ );
79
+ }
80
+ export function toIdentifier(filename) {
81
+ const id = filename.replace(/\.(ts|js|mts|mjs)$/, "").replace(/\W/g, "_");
82
+ if (RESERVED_KEYWORDS.has(id)) {
83
+ return `_${id}`;
84
+ }
85
+ return id;
86
+ }
87
+ export function createTemplateContent(type, entries) {
88
+ const imports = entries.map(
89
+ ([name, path]) => `import ${name.replace(/-/g, "_")} from '${path}'`
90
+ ).join("\n");
91
+ const enrichedExports = entries.map(([name, path]) => {
92
+ const identifier = name.replace(/-/g, "_");
93
+ const filename = path.split("/").pop();
94
+ return `(function() {
95
+ const def = ${identifier}
96
+ return {
97
+ ...def,
98
+ _meta: {
99
+ ...def._meta,
100
+ filename: ${JSON.stringify(filename)}
101
+ }
102
+ }
103
+ })()`;
104
+ }).join(",\n ");
105
+ return `${imports}
106
+
107
+ export const ${type} = [
108
+ ${enrichedExports}
109
+ ]
110
+ `;
111
+ }
112
+ export async function loadDefinitionFiles(paths, options = {}) {
113
+ if (paths.length === 0) {
114
+ return { count: 0, files: [], overriddenCount: 0 };
115
+ }
116
+ const patterns = createFilePatterns(paths);
117
+ const files = await glob(patterns, {
118
+ absolute: true,
119
+ onlyFiles: true,
120
+ ignore: options.excludePatterns
121
+ });
122
+ const definitionsMap = /* @__PURE__ */ new Map();
123
+ const filteredFiles = options.filter ? files.filter(options.filter) : files;
124
+ let overriddenCount = 0;
125
+ for (const filePath of filteredFiles) {
126
+ const filename = filePath.split("/").pop();
127
+ const identifier = toIdentifier(filename);
128
+ if (definitionsMap.has(identifier)) {
129
+ overriddenCount++;
130
+ }
131
+ definitionsMap.set(identifier, filePath);
132
+ }
133
+ const total = definitionsMap.size;
134
+ return {
135
+ count: total,
136
+ files: Array.from(definitionsMap.values()),
137
+ overriddenCount
138
+ };
139
+ }
@@ -0,0 +1,18 @@
1
+ import type { McpToolDefinition, McpResourceDefinition, McpPromptDefinition } from './definitions/index.js';
2
+ import type { H3Event } from 'h3';
3
+ export type CreateMcpHandlerConfig = {
4
+ name: string;
5
+ version: string;
6
+ browserRedirect: string;
7
+ tools?: McpToolDefinition[];
8
+ resources?: McpResourceDefinition[];
9
+ prompts?: McpPromptDefinition[];
10
+ } | ((event: H3Event) => {
11
+ name: string;
12
+ version: string;
13
+ browserRedirect: string;
14
+ tools?: McpToolDefinition[];
15
+ resources?: McpResourceDefinition[];
16
+ prompts?: McpPromptDefinition[];
17
+ });
18
+ export declare function createMcpHandler(config: CreateMcpHandlerConfig): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
@@ -0,0 +1,42 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
3
+ import { registerToolFromDefinition, registerResourceFromDefinition, registerPromptFromDefinition } from "./definitions/index.js";
4
+ import { sendRedirect, getHeader, readBody, defineEventHandler } from "h3";
5
+ function resolveConfig(config, event) {
6
+ return typeof config === "function" ? config(event) : config;
7
+ }
8
+ function createMcpServer(config) {
9
+ const server = new McpServer({
10
+ name: config.name,
11
+ version: config.version
12
+ });
13
+ for (const tool of config.tools || []) {
14
+ registerToolFromDefinition(server, tool);
15
+ }
16
+ for (const resource of config.resources || []) {
17
+ registerResourceFromDefinition(server, resource);
18
+ }
19
+ for (const prompt of config.prompts || []) {
20
+ registerPromptFromDefinition(server, prompt);
21
+ }
22
+ return server;
23
+ }
24
+ export function createMcpHandler(config) {
25
+ return defineEventHandler(async (event) => {
26
+ const resolvedConfig = resolveConfig(config, event);
27
+ if (getHeader(event, "accept")?.includes("text/html")) {
28
+ return sendRedirect(event, resolvedConfig.browserRedirect);
29
+ }
30
+ const server = createMcpServer(resolvedConfig);
31
+ const transport = new StreamableHTTPServerTransport({
32
+ sessionIdGenerator: void 0
33
+ });
34
+ event.node.res.on("close", () => {
35
+ transport.close();
36
+ server.close();
37
+ });
38
+ await server.connect(transport);
39
+ const body = await readBody(event);
40
+ await transport.handleRequest(event.node.req, event.node.res, body);
41
+ });
42
+ }
@@ -0,0 +1,4 @@
1
+ export * from './tools.js';
2
+ export * from './resources.js';
3
+ export * from './prompts.js';
4
+ export type { ValidationError } from './tools.js';
@@ -0,0 +1,3 @@
1
+ export * from "./tools.js";
2
+ export * from "./resources.js";
3
+ export * from "./prompts.js";
@@ -0,0 +1,14 @@
1
+ import type { McpPromptDefinition } from '../definitions/prompts.js';
2
+ export interface ValidationError {
3
+ file?: string;
4
+ message: string;
5
+ suggestion?: string;
6
+ }
7
+ /**
8
+ * Validate an MCP prompt definition
9
+ */
10
+ export declare function validatePromptDefinition(prompt: McpPromptDefinition, filePath?: string): ValidationError[];
11
+ /**
12
+ * Validate multiple prompt definitions
13
+ */
14
+ export declare function validatePromptDefinitions(prompts: McpPromptDefinition[], filePaths?: string[]): ValidationError[];
@@ -0,0 +1,36 @@
1
+ export function validatePromptDefinition(prompt, filePath) {
2
+ const errors = [];
3
+ if (!prompt.handler) {
4
+ errors.push({
5
+ file: filePath,
6
+ message: "Prompt definition is missing a handler function",
7
+ suggestion: "Add a handler function: handler: async (args) => { ... } or handler: async () => { ... }"
8
+ });
9
+ }
10
+ if (prompt.handler && typeof prompt.handler !== "function") {
11
+ errors.push({
12
+ file: filePath,
13
+ message: "Prompt handler must be a function",
14
+ suggestion: "Ensure handler is defined as: handler: async (args) => { ... }"
15
+ });
16
+ }
17
+ if (prompt.inputSchema && typeof prompt.inputSchema !== "object") {
18
+ errors.push({
19
+ file: filePath,
20
+ message: "Prompt inputSchema must be an object with Zod string schemas",
21
+ suggestion: "Use an object with Zod string schemas: inputSchema: { param: z.string() }"
22
+ });
23
+ }
24
+ return errors;
25
+ }
26
+ export function validatePromptDefinitions(prompts, filePaths) {
27
+ const errors = [];
28
+ for (let i = 0; i < prompts.length; i++) {
29
+ const prompt = prompts[i];
30
+ if (!prompt) continue;
31
+ const filePath = filePaths?.[i];
32
+ const promptErrors = validatePromptDefinition(prompt, filePath);
33
+ errors.push(...promptErrors);
34
+ }
35
+ return errors;
36
+ }
@@ -0,0 +1,14 @@
1
+ import type { McpResourceDefinition } from '../definitions/resources.js';
2
+ export interface ValidationError {
3
+ file?: string;
4
+ message: string;
5
+ suggestion?: string;
6
+ }
7
+ /**
8
+ * Validate an MCP resource definition
9
+ */
10
+ export declare function validateResourceDefinition(resource: McpResourceDefinition, filePath?: string): ValidationError[];
11
+ /**
12
+ * Validate multiple resource definitions
13
+ */
14
+ export declare function validateResourceDefinitions(resources: McpResourceDefinition[], filePaths?: string[]): ValidationError[];
@@ -0,0 +1,43 @@
1
+ export function validateResourceDefinition(resource, filePath) {
2
+ const errors = [];
3
+ const isFileResource = "file" in resource && !!resource.file;
4
+ if (!resource.handler && !isFileResource) {
5
+ errors.push({
6
+ file: filePath,
7
+ message: "Resource definition is missing a handler function",
8
+ suggestion: "Add a handler function: handler: async (uri) => { ... }"
9
+ });
10
+ }
11
+ if (!resource.uri && !isFileResource) {
12
+ errors.push({
13
+ file: filePath,
14
+ message: "Resource definition is missing a URI",
15
+ suggestion: 'Add a URI string or ResourceTemplate: uri: "file:///path/to/resource"'
16
+ });
17
+ } else if (resource.uri && typeof resource.uri !== "string" && typeof resource.uri !== "object") {
18
+ errors.push({
19
+ file: filePath,
20
+ message: "Resource URI must be a string or ResourceTemplate",
21
+ suggestion: "Use a string URI or ResourceTemplate instance"
22
+ });
23
+ }
24
+ if (resource.handler && typeof resource.handler !== "function") {
25
+ errors.push({
26
+ file: filePath,
27
+ message: "Resource handler must be a function",
28
+ suggestion: "Ensure handler is defined as: handler: async (uri) => { ... }"
29
+ });
30
+ }
31
+ return errors;
32
+ }
33
+ export function validateResourceDefinitions(resources, filePaths) {
34
+ const errors = [];
35
+ for (let i = 0; i < resources.length; i++) {
36
+ const resource = resources[i];
37
+ if (!resource) continue;
38
+ const filePath = filePaths?.[i];
39
+ const resourceErrors = validateResourceDefinition(resource, filePath);
40
+ errors.push(...resourceErrors);
41
+ }
42
+ return errors;
43
+ }
@@ -0,0 +1,14 @@
1
+ import type { McpToolDefinition } from '../definitions/tools.js';
2
+ export interface ValidationError {
3
+ file?: string;
4
+ message: string;
5
+ suggestion?: string;
6
+ }
7
+ /**
8
+ * Validate an MCP tool definition
9
+ */
10
+ export declare function validateToolDefinition(tool: McpToolDefinition, filePath?: string): ValidationError[];
11
+ /**
12
+ * Validate multiple tool definitions
13
+ */
14
+ export declare function validateToolDefinitions(tools: McpToolDefinition[], filePaths?: string[]): ValidationError[];
@@ -0,0 +1,47 @@
1
+ export function validateToolDefinition(tool, filePath) {
2
+ const errors = [];
3
+ if (!tool.handler) {
4
+ errors.push({
5
+ file: filePath,
6
+ message: "Tool definition is missing a handler function",
7
+ suggestion: "Add a handler function: handler: async (args) => { ... }"
8
+ });
9
+ }
10
+ if (tool.inputSchema && typeof tool.inputSchema !== "object") {
11
+ errors.push({
12
+ file: filePath,
13
+ message: "Tool inputSchema must be an object with Zod schemas",
14
+ suggestion: "Use an object with Zod schemas: inputSchema: { param: z.string() }"
15
+ });
16
+ } else if (tool.inputSchema) {
17
+ const schema = tool.inputSchema;
18
+ for (const [key, value] of Object.entries(schema)) {
19
+ if (!value || typeof value !== "object") {
20
+ errors.push({
21
+ file: filePath,
22
+ message: `inputSchema property "${key}" is not a valid Zod schema`,
23
+ suggestion: `Use a Zod schema: ${key}: z.string() or z.number(), etc.`
24
+ });
25
+ }
26
+ }
27
+ }
28
+ if (tool.handler && typeof tool.handler !== "function") {
29
+ errors.push({
30
+ file: filePath,
31
+ message: "Tool handler must be a function",
32
+ suggestion: "Ensure handler is defined as: handler: async (args) => { ... }"
33
+ });
34
+ }
35
+ return errors;
36
+ }
37
+ export function validateToolDefinitions(tools, filePaths) {
38
+ const errors = [];
39
+ for (let i = 0; i < tools.length; i++) {
40
+ const tool = tools[i];
41
+ if (!tool) continue;
42
+ const filePath = filePaths?.[i];
43
+ const toolErrors = validateToolDefinition(tool, filePath);
44
+ errors.push(...toolErrors);
45
+ }
46
+ return errors;
47
+ }
@@ -0,0 +1,16 @@
1
+ declare module '@nuxt/schema' {
2
+ interface NuxtHooks {
3
+ /**
4
+ * Add additional directories to scan for MCP definition files (tools, resources, prompts, handlers).
5
+ * @param paths - Object containing arrays of directory paths for each definition type.
6
+ * @returns void | Promise<void>
7
+ */
8
+ 'mcp:definitions:paths': (paths: {
9
+ tools?: string[];
10
+ resources?: string[];
11
+ prompts?: string[];
12
+ handlers?: string[];
13
+ }) => void | Promise<void>;
14
+ }
15
+ }
16
+ export {};
@@ -0,0 +1 @@
1
+ export * from '../mcp/definitions/index.js';
@@ -0,0 +1 @@
1
+ export * from "../mcp/definitions/index.js";
@@ -0,0 +1,14 @@
1
+ import type { McpToolDefinition, McpResourceDefinition, McpPromptDefinition } from './mcp/definitions'
2
+ import './types/hooks'
3
+
4
+ declare module '#nuxt-mcp/tools.mjs' {
5
+ export const tools: McpToolDefinition[]
6
+ }
7
+
8
+ declare module '#nuxt-mcp/resources.mjs' {
9
+ export const resources: McpResourceDefinition[]
10
+ }
11
+
12
+ declare module '#nuxt-mcp/prompts.mjs' {
13
+ export const prompts: McpPromptDefinition[]
14
+ }
@@ -0,0 +1,5 @@
1
+ export { default, type resolve } from './module.mjs'
2
+
3
+ export { type ModuleOptions } from './module.mjs'
4
+
5
+ export * from '../dist/runtime/server/types/index.js'
package/package.json CHANGED
@@ -1,8 +1,80 @@
1
1
  {
2
2
  "name": "@nuxtjs/mcp-toolkit",
3
- "version": "0.0.0",
3
+ "version": "0.0.1",
4
+ "description": "Create MCP servers directly in your Nuxt application. Define tools, resources, and prompts with a simple and intuitive API.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/nuxt-modules/mcp-toolkit.git"
8
+ },
9
+ "homepage": "https://mcp-toolkit.nuxt.dev",
10
+ "bugs": {
11
+ "url": "https://github.com/nuxt-modules/mcp-toolkit/issues"
12
+ },
13
+ "author": "Hugo Richard <hugo.richard@vercel.com>",
14
+ "license": "MIT",
15
+ "type": "module",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/types.d.mts",
19
+ "import": "./dist/module.mjs"
20
+ }
21
+ },
22
+ "main": "./dist/module.mjs",
23
+ "typesVersions": {
24
+ "*": {
25
+ ".": [
26
+ "./dist/types.d.mts"
27
+ ]
28
+ }
29
+ },
4
30
  "files": [
31
+ "README.md",
5
32
  "dist"
6
33
  ],
7
- "author": "Daniel Roe <daniel@roe.dev>"
34
+ "dependencies": {
35
+ "@clack/prompts": "^0.11.0",
36
+ "@modelcontextprotocol/sdk": "^1.22.0",
37
+ "@nuxt/kit": "^4.2.1",
38
+ "automd": "^0.4.2",
39
+ "chokidar": "^4.0.3",
40
+ "defu": "^6.1.4",
41
+ "pathe": "^2.0.3",
42
+ "scule": "^1.3.0",
43
+ "tinyglobby": "^0.2.15"
44
+ },
45
+ "peerDependencies": {
46
+ "zod": "^3.25.76"
47
+ },
48
+ "peerDependenciesMeta": {
49
+ "zod": {
50
+ "optional": false
51
+ }
52
+ },
53
+ "devDependencies": {
54
+ "@nuxt/devtools": "^3.1.0",
55
+ "@nuxt/eslint-config": "^1.10.0",
56
+ "@nuxt/module-builder": "^1.0.2",
57
+ "@nuxt/schema": "^4.2.1",
58
+ "@nuxt/test-utils": "^3.20.1",
59
+ "@types/node": "latest",
60
+ "changelogen": "^0.6.2",
61
+ "eslint": "^9.39.1",
62
+ "nuxt": "^4.2.1",
63
+ "typescript": "~5.9.3",
64
+ "vitest": "^4.0.10",
65
+ "vue-tsc": "^3.1.4"
66
+ },
67
+ "publishConfig": {
68
+ "access": "public"
69
+ },
70
+ "scripts": {
71
+ "build": "nuxt-module-build build",
72
+ "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare",
73
+ "lint": "eslint .",
74
+ "lint:fix": "eslint . --fix",
75
+ "test": "vitest run",
76
+ "test:watch": "vitest watch",
77
+ "typecheck": "vue-tsc --noEmit",
78
+ "release": "pnpm run typecheck && pnpm run test && pnpm run lint && pnpm run build && npm publish && git push --follow-tags"
79
+ }
8
80
  }