Skip to main content
Scaffold new MCP server components with pre-configured templates.

Usage

xmcp create <type> <name> [options]

Arguments

type
string
required
Type of component to create. Must be one of:
  • tool - MCP tool for performing actions
  • resource - MCP resource for exposing data
  • prompt - MCP prompt template
  • widget - Interactive UI widget component
name
string
required
Name of the component to create. Will be converted to kebab-case for the filename.Supports nested paths like api/users to create files in subdirectories.

Options

-d, --dir
string
Custom output directory for the generated file.If not specified, uses default directories:
  • Tools: src/tools/
  • Resources: src/resources/
  • Prompts: src/prompts/
  • Widgets: src/tools/

Examples

Create a new tool:
xmcp create tool send-email
Create a resource:
xmcp create resource user-profile
Create a prompt:
xmcp create prompt code-review
Create a widget:
xmcp create widget dashboard
Create with custom directory:
xmcp create tool database-query --dir src/custom
Create in nested path:
xmcp create tool api/fetch-data

Generated files

Tool template

Generates a TypeScript file in src/tools/ with:
  • Tool definition function
  • Type-safe parameter schema
  • Handler implementation stub
  • JSDoc comments
src/tools/send-email.ts
// Auto-generated tool template

Resource template

Generates a TypeScript file in src/resources/ with:
  • Resource definition function
  • URI template
  • Handler implementation stub
src/resources/user-profile.ts
// Auto-generated resource template

Prompt template

Generates a TypeScript file in src/prompts/ with:
  • Prompt definition function
  • Message template
  • Parameter placeholders
src/prompts/code-review.ts
// Auto-generated prompt template

Widget template

Generates a TSX file in src/tools/ with:
  • React component structure
  • Widget props interface
  • Basic UI scaffold
src/tools/dashboard.tsx
// Auto-generated widget template

File naming

All generated files use kebab-case naming:
  • Input: SendEmail → Output: send-email.ts
  • Input: userProfile → Output: user-profile.ts
  • Input: DatabaseQuery → Output: database-query.ts
The create command will not overwrite existing files. If a file already exists at the target path, the command will exit with an error.

Tools

Learn about creating tools

Resources

Learn about creating resources

Prompts

Learn about creating prompts

Widgets

Learn about creating widgets

Build docs developers (and LLMs) love