Resources
Groups & organization
group and tags, on-disk layout, URI schemes, and conditional registration.
Groups and Tags
Organize your resources with group and tags for categorization. These fields work the same way as for tools.
server/mcp/resources/config/app-settings.ts
import { defineMcpResource } from '@nuxtjs/mcp-toolkit/server'
export default defineMcpResource({
group: 'config',
tags: ['readonly', 'settings'],
description: 'Application settings',
file: 'config/app.json',
})
You can also place resource files in subdirectories to auto-infer the group:
server/mcp/resources/
├── config/
│ └── app-settings.ts → group: 'config'
├── docs/
│ └── readme.ts → group: 'docs'
└── schema.ts → no group
Resource
group and tags are stored on the definition objects but are not yet included in resources/list protocol responses. This will be supported when SEP-1300 is adopted by the MCP SDK.File Organization
Organize your resources in the server/mcp/resources/ directory. Both flat and nested layouts are supported:
server/
└── mcp/
└── resources/
├── readme.ts
├── file.ts
└── config/
└── app-settings.ts
Each file should export a default resource definition. Subdirectories automatically set the group.
URI Schemes
You can use any URI scheme that makes sense for your use case:
file://- File system resourcesapi://- API endpointshttp:///https://- Web resourcescustom://- Custom schemes
Conditional Registration
You can control whether a resource is visible to clients using the enabled guard:
server/mcp/resources/internal-data.ts
export default defineMcpResource({
name: 'internal-data',
uri: 'app://internal',
enabled: event => event.context.user?.role === 'admin',
handler: async (uri) => ({
contents: [{ uri: uri.toString(), text: 'Internal data...' }],
}),
})
See the Dynamic Definitions guide for detailed documentation on auth-based filtering.
Next Steps
- Tools - Create tools to perform actions
- Prompts - Create reusable prompts
- Handlers - Create custom MCP endpoints
- Dynamic Definitions - Conditionally register definitions
- Examples - More resource examples