Skip to main content

@leanmcp/cli

Command-line tool for creating, developing, and deploying MCP servers to LeanMCP Cloud.

Features

Quick Scaffolding

Create production-ready MCP servers in seconds

Hot Reload Development

leanmcp dev with UI component hot-reload

Cloud Deployment

Deploy to LeanMCP Cloud with custom subdomains

Project Management

List, view, and delete cloud projects

Environment Variables

Manage Lambda environment variables from CLI

Installation

Or run without installing:

Commands Overview


Local Development

create

Create a new MCP server project:
Interactive prompts will guide you through:
  1. Creating the project structure
  2. Installing dependencies (optional)
  3. Starting the dev server (optional)
Generated structure:

add

Add a new service to an existing project:
This:
  • Creates mcp/weather.ts with example Tool, Prompt, and Resource
  • Automatically registers the service in main.ts
  • Includes @SchemaConstraint validation examples

dev

Start the development server with hot-reload:
This command:
  • Scans for @UIApp components and builds them
  • Starts the HTTP server with tsx watch
  • Watches mcp/ directory for changes
  • Automatically rebuilds UI components when modified
  • Hot-reloads when adding/removing @UIApp decorators

build

Build the project for production:
Compiles TypeScript and bundles UI components.

start

Start the production server:
Runs the compiled production build.

Cloud Commands

login

Authenticate with LeanMCP Cloud:
Steps:
  1. Go to leanmcp.com/api-keys
  2. Create an API key with “BUILD_AND_DEPLOY” scope
  3. Enter the key when prompted

logout

Remove your API key:

whoami

Check your current login status:

deploy

Deploy your MCP server to LeanMCP Cloud:
Deployment process:
  1. Creates project (or updates existing)
  2. Packages and uploads code
  3. Builds container image
  4. Deploys to serverless Lambda
  5. Configures custom subdomain

projects

Manage your cloud projects:

env

Manage environment variables on your deployed Lambda functions:
Changes to environment variables are applied immediately and will take effect after a cold start. See the Environment Variables guide for detailed documentation.

NPM Scripts

Generated projects include:

Testing Your Server

Configuration

Port

LeanMCP Config

Stored in ~/.leanmcp/config.json:

Troubleshooting

Change the port in .env:
Ensure dependencies are installed:
Ensure your tsconfig.json has:
Run leanmcp login first to authenticate with your API key.
Choose a different subdomain when prompted.

Requirements

  • Node.js >= 18.0.0
  • npm >= 9.0.0