Skip to main content

What is the LeanMCP CLI?

The LeanMCP CLI is a command-line interface that streamlines the entire MCP server development workflow from project creation to production deployment. Key capabilities:
  • Quick project scaffolding with production-ready templates
  • Hot-reload development server with UI component building
  • One-command cloud deployment to LeanMCP platform
  • Interactive setup with guided prompts
  • Project management and environment variable handling

Installation

npm install -g @leanmcp/cli
Or use without installing:
npx @leanmcp/cli create my-mcp-server
Requirements:
  • Node.js >= 18.0.0
  • npm >= 9.0.0

Quick Start

1

Create a new project

leanmcp create my-mcp-server
cd my-mcp-server
Interactive prompts will guide you through setup.
2

Start development server

npm run dev
Your server will start at http://localhost:3001 with hot-reload enabled.
3

Test your endpoints

curl http://localhost:3001/health
curl http://localhost:3001/mcp

Generated Project Structure

The CLI creates a clean, production-ready structure:
my-mcp-server/
├── main.ts              # Entry point with HTTP server
├── package.json         # Dependencies and scripts
├── tsconfig.json        # TypeScript configuration
├── .gitignore           # Git ignore rules
├── .env                 # Environment variables
└── mcp/                 # Services directory
    └── example/
        └── index.ts     # Example service

Available Commands

Local Development

CommandDescription
leanmcp create <name>Create a new MCP server project
leanmcp add <service>Add a new service to existing project
leanmcp devStart development server with hot-reload
leanmcp buildBuild UI components and compile TypeScript
leanmcp startBuild and start production server

Cloud Deployment

CommandDescription
leanmcp loginAuthenticate with LeanMCP Cloud
leanmcp logoutRemove stored API key
leanmcp whoamiShow authentication status
leanmcp deploy [folder]Deploy to LeanMCP Cloud

Project Management

CommandDescription
leanmcp projects listList your cloud projects
leanmcp projects get <id>Get project details
leanmcp projects delete <id>Delete a cloud project

Environment Variables

CommandDescription
leanmcp env list [folder]List environment variables
leanmcp env set <key=value>Set an environment variable
leanmcp env get <key>Get environment variable value
leanmcp env remove <key>Remove environment variable
leanmcp env pull [folder]Download variables to local file
leanmcp env push [folder]Upload variables from local file

NPM Scripts

Generated projects include helpful npm scripts:
{
  "scripts": {
    "dev": "leanmcp dev",
    "build": "leanmcp build",
    "start": "leanmcp start",
    "start:node": "node dist/main.js",
    "clean": "rm -rf dist"
  }
}

Configuration

Port Configuration

Set the port in your .env file:
.env
PORT=3001
NODE_ENV=development
Or use an environment variable:
PORT=4000 npm run dev

TypeScript Configuration

Generated tsconfig.json:
{
  "compilerOptions": {
    "module": "ESNext",
    "target": "ES2022",
    "moduleResolution": "Bundler",
    "esModuleInterop": true,
    "strict": true,
    "skipLibCheck": true,
    "outDir": "dist",
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true
  },
  "include": ["**/*.ts"],
  "exclude": ["node_modules", "dist"]
}

Global Options

Available for all commands:
-v, --version    # Output the current version
-h, --help       # Display help for command
-d, --debug      # Enable debug logging

Next Steps

Create Command

Learn about creating new projects with interactive setup

Add Service

Add new services to existing projects

Dev Commands

Development, build, and start commands

Deploy

Deploy to LeanMCP Cloud

Build docs developers (and LLMs) love