@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-reloadCloud 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
Commands Overview
Local Development
create
Create a new MCP server project:- Creating the project structure
- Installing dependencies (optional)
- Starting the dev server (optional)
add
Add a new service to an existing project:- Creates
mcp/weather.tswith example Tool, Prompt, and Resource - Automatically registers the service in
main.ts - Includes
@SchemaConstraintvalidation examples
dev
Start the development server with hot-reload:- Scans for
@UIAppcomponents 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
@UIAppdecorators
build
Build the project for production:start
Start the production server:Cloud Commands
login
Authenticate with LeanMCP Cloud:- Go to ship.leanmcp.com/api-keys
- Create an API key with “BUILD_AND_DEPLOY” scope
- Enter the key when prompted
logout
Remove your API key:whoami
Check your current login status:deploy
Deploy your MCP server to LeanMCP Cloud:- Creates project (or updates existing)
- Packages and uploads code
- Builds container image
- Deploys to serverless Lambda
- 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
Port Already in Use
Port Already in Use
Change the port in
.env:Module Not Found Errors
Module Not Found Errors
Ensure dependencies are installed:
TypeScript Decorator Errors
TypeScript Decorator Errors
Ensure your
tsconfig.json has:Deploy: Not Logged In
Deploy: Not Logged In
Run
leanmcp login first to authenticate with your API key.Deploy: Subdomain Taken
Deploy: Subdomain Taken
Choose a different subdomain when prompted.
Requirements
- Node.js >= 18.0.0
- npm >= 9.0.0
Related Packages
- @leanmcp/core - Core MCP server functionality
- @leanmcp/auth - Authentication decorators
- @leanmcp/ui - MCP App UI components