The Model Context Protocol (MCP) is an open protocol that enables AI assistants to securely access external data sources and tools. It provides a standardized way for AI applications to:
MCP servers act as bridges between AI assistants and external systems, enabling them to interact with your application's data and functionality in a secure, controlled manner.
The Nuxt MCP Toolkit makes it incredibly easy to create MCP servers directly in your Nuxt application. Instead of building a separate MCP server, you can define tools, resources, and prompts right alongside your Nuxt application code.
Zero Configuration
TypeScript First
Simple API
Flexible Architecture
The module automatically:
server/mcp/ directory (or custom path) for definitionsserver/
└── mcp/
├── tools/
│ ├── echo.ts
│ └── calculator.ts
├── resources/
│ ├── readme.ts
│ └── files.ts
└── prompts/
├── greeting.ts
└── summarize.ts
Tools are functions that AI assistants can call. They accept input parameters (validated with Zod) and return results.
export default defineMcpTool({
name: 'calculate-bmi',
inputSchema: {
weightKg: z.number(),
heightM: z.number(),
},
handler: async ({ weightKg, heightM }) => {
const bmi = weightKg / (heightM * heightM)
return {
content: [{ type: 'text', text: `BMI: ${bmi}` }],
}
},
})
Resources provide access to data via URIs. They can be static files or dynamic data sources.
export default defineMcpResource({
name: 'readme',
uri: 'file:///README.md',
handler: async (uri: URL) => {
const content = await readFile(uri.pathname, 'utf-8')
return {
contents: [{ uri: uri.toString(), text: content }],
}
},
})
Prompts are reusable message templates that can include dynamic arguments.
export default defineMcpPrompt({
name: 'greeting',
inputSchema: {
name: z.string(),
},
handler: async ({ name }) => {
return {
messages: [{
role: 'user',
content: { type: 'text', text: `Hello, ${name}!` },
}],
}
},
})
Ready to get started? Check out: