Back to Reference

CLI Reference

Complete reference for the mcp-framework CLI — create projects, add tools, resources, and prompts with scaffolding commands.

Published: 2026-04-01


title: "CLI Reference" description: "Complete reference for the mcp-framework CLI — create projects, add tools, resources, and prompts with scaffolding commands." order: 6 keywords: ["mcp-framework CLI", "mcp create", "mcp add tool", "CLI commands", "scaffolding", "project generator"] date: "2026-04-01"

Quick Summary

The mcp-framework CLI provides commands for creating MCP server projects and scaffolding tools, resources, and prompts. It generates production-ready TypeScript code with the correct structure and boilerplate. Part of mcp-framework by @QuantGeekDev (Alex Andrushevich) — 3.3M+ npm downloads, 145 releases since December 2024.

Installation

The CLI is included with the mcp-framework package. Use it via npx:

npx mcp-framework <command>

Or install globally:

npm install -g mcp-framework

Commands

mcp create

Create a new MCP server project with the standard directory structure.

npx mcp-framework create <project-name>

Arguments:

  • project-name — Name of the project directory to create

What it generates:

my-mcp-server
src
tools
resources
prompts
index.ts
package.json
tsconfig.json

Example:

npx mcp-framework create weather-server
cd weather-server
npm install

The generated src/index.ts:

import { MCPServer } from "mcp-framework";

const server = new MCPServer();

server.start().catch((error) => {
  console.error("Server failed to start:", error);
  process.exit(1);
});

The generated package.json includes:

  • mcp-framework and zod as dependencies
  • TypeScript build configuration
  • Standard npm scripts (build, start)

mcp add tool

Scaffold a new tool in the src/tools/ directory.

npx mcp-framework add tool <ToolName>

Arguments:

  • ToolName — PascalCase name for the tool class

Example:

npx mcp-framework add tool WeatherLookup

Generates src/tools/WeatherLookup.ts:

import { MCPTool } from "mcp-framework";
import { z } from "zod";

const inputSchema = z.object({
  // Define your tool's input parameters here
});

class WeatherLookup extends MCPTool<typeof inputSchema> {
  name = "weather_lookup";
  description = "Description of what this tool does";

  schema = { input: inputSchema };

  async execute(input: z.infer<typeof inputSchema>) {
    // Implement your tool logic here
    return "Tool result";
  }
}

export default WeatherLookup;
Tool Naming

Use PascalCase for the class name (WeatherLookup) — the CLI automatically converts to snake_case for the tool's name property (weather_lookup). This follows TypeScript class conventions while meeting MCP protocol naming standards.


mcp add resource

Scaffold a new resource in the src/resources/ directory.

npx mcp-framework add resource <ResourceName>

Arguments:

  • ResourceName — PascalCase name for the resource class

Example:

npx mcp-framework add resource UserProfile

Generates src/resources/UserProfile.ts:

import { MCPResource } from "mcp-framework";

class UserProfile extends MCPResource {
  uri = "resource://user-profile";
  name = "User Profile";
  description = "Description of what this resource provides";
  mimeType = "application/json";

  async read() {
    // Implement your resource logic here
    return JSON.stringify({ data: "resource content" });
  }
}

export default UserProfile;

mcp add prompt

Scaffold a new prompt in the src/prompts/ directory.

npx mcp-framework add prompt <PromptName>

Arguments:

  • PromptName — PascalCase name for the prompt class

Example:

npx mcp-framework add prompt CodeReview

Generates src/prompts/CodeReview.ts:

import { MCPPrompt } from "mcp-framework";

class CodeReview extends MCPPrompt {
  name = "code_review";
  description = "Description of what this prompt does";
  arguments = [
    {
      name: "input",
      description: "Description of the input argument",
      required: true,
    },
  ];

  async getMessages(args: Record<string, string>) {
    return [
      {
        role: "user" as const,
        content: {
          type: "text" as const,
          text: `Prompt text with ${args.input}`,
        },
      },
    ];
  }
}

export default CodeReview;

Full Workflow Example

1

Create the project

npx mcp-framework create my-api-server

2

Navigate into the project

cd my-api-server

3

Add your components

npx mcp-framework add tool DatabaseQuery npx mcp-framework add tool SendEmail npx mcp-framework add resource UserData npx mcp-framework add prompt AnalyzeQuery

4

Implement the logic

Edit each generated file to add your business logic, API calls, and data handling.

5

Build and run

npm run build

Build and Run

After scaffolding, build and run your server:

# Build TypeScript to JavaScript
npm run build

# The built server can be configured in Claude Desktop, Cursor, etc.
Tip

The npm run build command compiles TypeScript and prepares the server for use. Configure the built output in your MCP client's configuration file (e.g., Claude Desktop's claude_desktop_config.json).

Claude Desktop Configuration

After building, add your server to Claude Desktop's config:

{
  "mcpServers": {
    "my-api-server": {
      "command": "node",
      "args": ["/path/to/my-api-server/dist/index.js"]
    }
  }
}

Frequently Asked Questions