The Nuxt MCP module provides hooks for extending and customizing behavior.
mcp:definitions:pathsThis hook allows you to add additional directories to scan for MCP definitions.
nuxt.hook('mcp:definitions:paths', (paths: {
tools: string[]
resources: string[]
prompts: string[]
handlers: string[]
}) => {
// Modify paths
})
export default defineNuxtConfig({
modules: ['@nuxtjs/mcp-toolkit'],
hooks: {
'mcp:definitions:paths'(paths) {
// Add additional tool directories
paths.tools.push('shared/tools')
paths.tools.push('legacy/tools')
// Add additional resource directories
paths.resources.push('shared/resources')
// Add additional prompt directories
paths.prompts.push('shared/prompts')
// Add additional handler directories
paths.handlers.push('custom/handlers')
},
},
})
export default defineNuxtModule({
setup(options, nuxt) {
nuxt.hook('mcp:definitions:paths', (paths) => {
// Add paths from this module
paths.tools.push('my-module/tools')
paths.resources.push('my-module/resources')
paths.prompts.push('my-module/prompts')
})
},
})
The paths object contains arrays of directory paths:
{
tools: string[] // Directories to scan for tools
resources: string[] // Directories to scan for resources
prompts: string[] // Directories to scan for prompts
handlers: string[] // Directories to scan for handlers
}
All paths are relative to the server/ directory of each Nuxt layer.
Paths are resolved in the following order:
server/: Paths like 'tools' resolve to server/tools// resolve from project rootserver/ directory