add-resource

Scaffold MCP resource definitions with zod-validated parameters and register them in createApp().

148|28|Updated Mar 20, 2025
One-click install
npx skills add https://github.com/cyanheads/mcp-ts-core --skill add-resource-cyanheads
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: add-resource
Source: https://github.com/cyanheads/mcp-ts-core/tree/main/skills/add-resource
Command: npx skills add https://github.com/cyanheads/mcp-ts-core --skill add-resource-cyanheads

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Scaffold MCP resource definitions quickly when users request new resources, enabling URI-based access and structured data endpoints.

Core Features & Use Cases

  • Create the file at src/mcp-server/resources/definitions/{{resource-name}}.resource.ts
  • Register the resource in createApp() so it becomes available to tools and prompts
  • Provide a reusable template with validated params and a pure handler

Quick Start

Describe the resource to scaffold and let the tool generate the skeleton in your MCP project.

Frequently Asked Questions about add-resource

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I scaffold a new MCP resource definition in TypeScript?

To scaffold an MCP resource definition, describe the desired resource to generate a skeleton file at src/mcp-server/resources/definitions/{{resource-name}}.resource.ts, complete with validated parameters and a pure handler.

What is the best way to expose data via a URI endpoint for MCP agents?

Exposing data via a URI endpoint for agents requires creating an MCP resource definition. This provides a readable, testable surface and automatically registers the endpoint in createApp() for tool access.

How do I register a new MCP resource so tools and prompts can access it?

Registering an MCP resource involves adding the definition file under the resources directory and ensuring it is registered in createApp(), making the URI endpoint available to other tools and prompts.

Can I use zod to validate parameters when creating an MCP resource definition?

Yes, you can use zod to validate parameters when creating an MCP resource definition. The scaffolding process enforces parameter descriptions with zod to ensure a pure, testable handler.

Does scaffolding an MCP resource definition follow specific project file placement rules?

Scaffolding an MCP resource definition strictly enforces file placement under src/mcp-server/resources/definitions/{{resource-name}}.resource.ts, adhering to the structural guidance specified in CLAUDE.md.

When do I need to create a structured data endpoint using an MCP resource?

You need to create a structured data endpoint using an MCP resource when you want to expose specific data via a URI endpoint, providing a readable and testable surface for agents and tools.