@leanmcp/cli 0.5.6 → 0.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +477 -477
  2. package/dist/index.js +315 -57
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -1,477 +1,477 @@
1
- # @leanmcp/cli
2
-
3
- <p align="center">
4
- <img
5
- src="https://raw.githubusercontent.com/LeanMCP/leanmcp-sdk/refs/heads/main/assets/logo.png"
6
- alt="LeanMCP Logo"
7
- width="400"
8
- />
9
- </p>
10
-
11
- <p align="center">
12
- <a href="https://www.npmjs.com/package/@leanmcp/cli">
13
- <img src="https://img.shields.io/npm/v/@leanmcp/cli" alt="npm version" />
14
- </a>
15
- <a href="https://www.npmjs.com/package/@leanmcp/cli">
16
- <img src="https://img.shields.io/npm/dm/@leanmcp/cli" alt="npm downloads" />
17
- </a>
18
- <a href="https://docs.leanmcp.com/sdk/cli">
19
- <img src="https://img.shields.io/badge/Docs-leanmcp-0A66C2?" />
20
- </a>
21
- <a href="https://discord.com/invite/DsRcA3GwPy">
22
- <img src="https://dcbadge.limes.pink/api/server/DsRcA3GwPy?style=flat" alt="Discord" />
23
- </a>
24
- <a href="https://x.com/LeanMcp">
25
- <img src="https://img.shields.io/badge/@LeanMCP-f5f5f5?logo=x&logoColor=000000" />
26
- </a>
27
- <a href="https://leanmcp.com/">
28
- <img src="https://img.shields.io/badge/Website-leanmcp-0A66C2?" />
29
- </a>
30
- <a href="https://deepwiki.com/LeanMCP/leanmcp-sdk"><img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki"></a>
31
- </p>
32
-
33
- ```json
34
- {
35
- "package": "@leanmcp/cli",
36
- "purpose": "Command-line interface for scaffolding LeanMCP projects",
37
- "useCases": [
38
- "Project scaffolding",
39
- "Local development with hot-reload",
40
- "Cloud deployment",
41
- "Project management"
42
- ],
43
- "dependencies": ["@inquirer/prompts", "commander", "chalk", "vite", "archiver", "fs-extra"],
44
- "bin": {
45
- "leanmcp": "bin/leanmcp.js"
46
- },
47
- "main": "dist/index.js",
48
- "exports": {
49
- ".": {
50
- "types": "./dist/index.d.ts",
51
- "import": "./dist/index.js"
52
- }
53
- }
54
- }
55
- ```
56
-
57
- ## Overview
58
-
59
- - **What it is**: Command-line interface for scaffolding LeanMCP projects with hot-reload development and cloud deployment
60
- - **Purpose**: Streamlines the entire MCP server development workflow from project creation to production deployment
61
- - **Key benefits**:
62
- - Quick project scaffolding with production-ready templates
63
- - Hot-reload development server with UI component building
64
- - One-command cloud deployment to LeanMCP platform
65
- - Interactive setup with guided prompts
66
- - Project management and monitoring tools
67
-
68
- ## When to Use It
69
-
70
- **Use `@leanmcp/cli` when:**
71
-
72
- - Starting any new MCP server project (highly recommended)
73
- - Need local development with hot-reload and UI building
74
- - Want to deploy to LeanMCP Cloud with custom subdomains
75
- - Managing multiple MCP projects
76
- - Need guided setup for dependencies and configuration
77
-
78
- **You probably do NOT need this if:**
79
-
80
- - Using custom build systems or deployment pipelines
81
- - Only working with existing projects without scaffolding needs
82
- - Building MCP clients (not servers)
83
- - Working in environments where global CLI tools aren't allowed
84
-
85
- ## Features
86
-
87
- - **Quick Scaffolding** — Create production-ready MCP servers in seconds
88
- - **Hot Reload Development** — `leanmcp dev` with UI component hot-reload
89
- - **Cloud Deployment** — Deploy to LeanMCP Cloud with custom subdomains
90
- - **Project Management** — List, view, and delete cloud projects
91
- - **Interactive Setup** — Guided prompts for dependencies and dev server
92
-
93
- ## Installation
94
-
95
- ```bash
96
- npm install -g @leanmcp/cli
97
- ```
98
-
99
- Or run without installing:
100
-
101
- ```bash
102
- npx @leanmcp/cli create my-mcp-server
103
- ```
104
-
105
- **Requirements:**
106
-
107
- - Node.js >= 18.0.0
108
- - npm >= 9.0.0
109
-
110
- ## Usage / Examples
111
-
112
- ### Commands Overview
113
-
114
- ```bash
115
- # Local development
116
- leanmcp create <name> # Create a new project
117
- leanmcp add <service> # Add a service to existing project
118
- leanmcp dev # Start development server with hot-reload
119
- leanmcp build # Build for production
120
- leanmcp start # Start production server
121
-
122
- # Cloud commands
123
- leanmcp login # Authenticate with LeanMCP Cloud
124
- leanmcp logout # Remove API key
125
- leanmcp whoami # Show login status
126
- leanmcp deploy <folder> # Deploy to LeanMCP Cloud
127
- leanmcp projects list # List your cloud projects
128
- leanmcp projects get <id> # Get project details
129
- leanmcp projects delete <id> # Delete a project
130
- ```
131
-
132
- ---
133
-
134
- ## Local Development
135
-
136
- ### create
137
-
138
- Create a new MCP server project:
139
-
140
- ```bash
141
- leanmcp create my-sentiment-tool
142
- ```
143
-
144
- Interactive prompts will guide you through:
145
-
146
- 1. Creating the project structure
147
- 2. Installing dependencies (optional)
148
- 3. Starting the dev server (optional)
149
-
150
- **Generated structure:**
151
-
152
- ```
153
- my-mcp-server/
154
- ├── main.ts # Entry point with HTTP server
155
- ├── package.json # Dependencies and scripts
156
- ├── tsconfig.json # TypeScript configuration
157
- └── mcp/ # Services directory
158
- └── example/
159
- └── index.ts # Example service with tools
160
- ```
161
-
162
- ### add
163
-
164
- Add a new service to an existing project:
165
-
166
- ```bash
167
- cd my-mcp-server
168
- leanmcp add weather
169
- ```
170
-
171
- This:
172
-
173
- - Creates `mcp/weather/index.ts` with example Tool, Prompt, and Resource
174
- - Automatically registers the service in `main.ts`
175
- - Includes `@SchemaConstraint` validation examples
176
-
177
- ### dev
178
-
179
- Start the development server with hot-reload:
180
-
181
- ```bash
182
- leanmcp dev
183
- ```
184
-
185
- This command:
186
-
187
- - Scans for `@UIApp` components and builds them
188
- - Starts the HTTP server with `tsx watch`
189
- - Watches `mcp/` directory for changes
190
- - Automatically rebuilds UI components when modified
191
- - Hot-reloads when adding/removing `@UIApp` decorators
192
-
193
- ```bash
194
- $ leanmcp dev
195
-
196
- LeanMCP Development Server
197
-
198
- ℹ Found 2 @UIApp component(s)
199
- ℹ UI components built
200
-
201
- Starting development server...
202
-
203
- [HTTP][INFO] Server running on http://localhost:3001
204
- [HTTP][INFO] MCP endpoint: http://localhost:3001/mcp
205
- ```
206
-
207
- ### build
208
-
209
- Build the project for production:
210
-
211
- ```bash
212
- leanmcp build
213
- ```
214
-
215
- Compiles TypeScript and bundles UI components.
216
-
217
- ### start
218
-
219
- Start the production server:
220
-
221
- ```bash
222
- leanmcp start
223
- ```
224
-
225
- Runs the compiled production build.
226
-
227
- ---
228
-
229
- ## Cloud Commands
230
-
231
- ### login
232
-
233
- Authenticate with LeanMCP Cloud:
234
-
235
- ```bash
236
- leanmcp login
237
- ```
238
-
239
- Steps:
240
-
241
- 1. Go to [ship.leanmcp.com/api-keys](https://ship.leanmcp.com/api-keys)
242
- 2. Create an API key with "BUILD_AND_DEPLOY" scope
243
- 3. Enter the key when prompted
244
-
245
- ### logout
246
-
247
- Remove your API key:
248
-
249
- ```bash
250
- leanmcp logout
251
- ```
252
-
253
- ### whoami
254
-
255
- Check your current login status:
256
-
257
- ```bash
258
- leanmcp whoami
259
- ```
260
-
261
- ### deploy
262
-
263
- Deploy your MCP server to LeanMCP Cloud:
264
-
265
- ```bash
266
- leanmcp deploy .
267
- # Or specify a folder
268
- leanmcp deploy ./my-project
269
- ```
270
-
271
- Deployment process:
272
-
273
- 1. Creates project (or updates existing)
274
- 2. Packages and uploads code
275
- 3. Builds container image
276
- 4. Deploys to serverless Lambda
277
- 5. Configures custom subdomain
278
-
279
- ```bash
280
- $ leanmcp deploy .
281
-
282
- LeanMCP Deploy
283
-
284
- Generated project name: swift-coral-sunset
285
- Path: /path/to/my-project
286
-
287
- ? Subdomain for your deployment: my-api
288
- ✔ Subdomain 'my-api' is available
289
-
290
- ? Proceed with deployment? Yes
291
-
292
- ✔ Project created: 7f4a3b2c...
293
- ✔ Project uploaded
294
- ✔ Build complete (45s)
295
- ✔ Deployed
296
- ✔ Subdomain configured
297
-
298
- ============================================================
299
- DEPLOYMENT SUCCESSFUL!
300
- ============================================================
301
-
302
- Your MCP server is now live:
303
-
304
- URL: https://my-api.leanmcp.dev
305
-
306
- Test endpoints:
307
- curl https://my-api.leanmcp.dev/health
308
- curl https://my-api.leanmcp.dev/mcp
309
- ```
310
-
311
- ### projects
312
-
313
- Manage your cloud projects:
314
-
315
- ```bash
316
- # List all projects
317
- leanmcp projects list
318
-
319
- # Get project details
320
- leanmcp projects get <project-id>
321
-
322
- # Delete a project
323
- leanmcp projects delete <project-id>
324
- leanmcp projects delete <project-id> --force # Skip confirmation
325
- ```
326
-
327
- ---
328
-
329
- ## API Reference
330
-
331
- ### Command Reference
332
-
333
- | Command | Description | Usage |
334
- | ---------------------- | ---------------------------------------- | ------------------------------ |
335
- | `create <name>` | Create new MCP server project | `leanmcp create my-server` |
336
- | `add <service>` | Add service to existing project | `leanmcp add weather` |
337
- | `dev` | Start development server with hot-reload | `leanmcp dev` |
338
- | `build` | Build for production | `leanmcp build` |
339
- | `start` | Start production server | `leanmcp start` |
340
- | `login` | Authenticate with LeanMCP Cloud | `leanmcp login` |
341
- | `logout` | Remove API key | `leanmcp logout` |
342
- | `whoami` | Show login status | `leanmcp whoami` |
343
- | `deploy [folder]` | Deploy to LeanMCP Cloud | `leanmcp deploy .` |
344
- | `projects list` | List cloud projects | `leanmcp projects list` |
345
- | `projects get <id>` | Get project details | `leanmcp projects get <id>` |
346
- | `projects delete <id>` | Delete project | `leanmcp projects delete <id>` |
347
- | `env list [folder]` | List environment variables | `leanmcp env list` |
348
- | `env set <keyValue>` | Set environment variable | `leanmcp env set KEY=VALUE` |
349
- | `env get <key>` | Get environment variable value | `leanmcp env get KEY` |
350
- | `env remove <key>` | Remove environment variable | `leanmcp env remove KEY` |
351
- | `env pull [folder]` | Download env vars to local file | `leanmcp env pull` |
352
- | `env push [folder]` | Upload env vars from local file | `leanmcp env push` |
353
-
354
- ---
355
-
356
- ## Integration with Other LeanMCP Packages
357
-
358
- **@leanmcp/cli** works seamlessly with all LeanMCP packages:
359
-
360
- - **[@leanmcp/core](https://www.npmjs.com/package/@leanmcp/core)** — Generated projects use `@leanmcp/core` as the foundation
361
- - **[@leanmcp/auth](https://www.npmjs.com/package/@leanmcp/auth)** — CLI can scaffold projects with authentication setup
362
- - **[@leanmcp/ui](https://www.npmjs.com/package/@leanmcp/ui)** — `leanmcp dev` automatically builds UI components with hot-reload
363
- - **[@leanmcp/elicitation](https://www.npmjs.com/package/@leanmcp/elicitation)** — Generated services include elicitation examples
364
- - **[@leanmcp/env-injection](https://www.npmjs.com/package/@leanmcp/env-injection)** — Deploy command handles user secrets configuration
365
-
366
- **Generated project structure:**
367
-
368
- ```
369
- my-mcp-server/
370
- ├── main.ts # Entry point with HTTP server
371
- ├── package.json # Dependencies and scripts
372
- ├── tsconfig.json # TypeScript configuration
373
- └── mcp/ # Services directory (auto-discovered)
374
- └── example/
375
- └── index.ts # Example service with @Tool, @Prompt, @Resource
376
- ```
377
-
378
- ---
379
-
380
- ## Best Practices / Troubleshooting
381
-
382
- ### NPM Scripts
383
-
384
- Generated projects include:
385
-
386
- ```bash
387
- npm run dev # Start with hot reload (tsx watch)
388
- npm run build # Build for production
389
- npm run start # Run production build
390
- npm run clean # Remove build artifacts
391
- ```
392
-
393
- ## Configuration
394
-
395
- ### Port
396
-
397
- ```bash
398
- PORT=4000 npm run dev
399
- # Or in .env file
400
- PORT=4000
401
- ```
402
-
403
- ### LeanMCP Config
404
-
405
- Stored in `~/.leanmcp/config.json`:
406
-
407
- ```json
408
- {
409
- "apiKey": "airtrain_...",
410
- "apiUrl": "https://api.leanmcp.com",
411
- "lastUpdated": "2024-01-15T10:30:00.000Z"
412
- }
413
- ```
414
-
415
- ## Troubleshooting
416
-
417
- ### Port Already in Use
418
-
419
- Change the port in `.env`:
420
-
421
- ```bash
422
- PORT=3002
423
- ```
424
-
425
- ### Module Not Found Errors
426
-
427
- Ensure dependencies are installed:
428
-
429
- ```bash
430
- npm install
431
- ```
432
-
433
- ### TypeScript Decorator Errors
434
-
435
- Ensure your `tsconfig.json` has:
436
-
437
- ```json
438
- {
439
- "compilerOptions": {
440
- "experimentalDecorators": true,
441
- "emitDecoratorMetadata": true
442
- }
443
- }
444
- ```
445
-
446
- ### Deploy: Not Logged In
447
-
448
- Run `leanmcp login` first to authenticate with your API key.
449
-
450
- ### Deploy: Subdomain Taken
451
-
452
- Choose a different subdomain when prompted.
453
-
454
- ## Requirements
455
-
456
- - Node.js >= 18.0.0
457
- - npm >= 9.0.0
458
-
459
- ## Documentation
460
-
461
- - [Full Documentation](https://docs.leanmcp.com/sdk/cli)
462
-
463
- ## Related Packages
464
-
465
- - [@leanmcp/core](https://www.npmjs.com/package/@leanmcp/core) — Core MCP server functionality
466
- - [@leanmcp/auth](https://www.npmjs.com/package/@leanmcp/auth) — Authentication decorators
467
- - [@leanmcp/ui](https://www.npmjs.com/package/@leanmcp/ui) — MCP App UI components
468
-
469
- ---
470
-
471
- ## Links
472
-
473
- - **Documentation**: [https://docs.leanmcp.com/sdk/cli](https://docs.leanmcp.com/sdk/cli)
474
- - **GitHub**: [https://github.com/LeanMCP/leanmcp-sdk/tree/main/packages/cli](https://github.com/LeanMCP/leanmcp-sdk/tree/main/packages/cli)
475
- - **npm**: [https://www.npmjs.com/package/@leanmcp/cli](https://www.npmjs.com/package/@leanmcp/cli)
476
- - **LeanMCP Dashboard**: [https://ship.leanmcp.com](https://ship.leanmcp.com)
477
- - **License**: MIT
1
+ # @leanmcp/cli
2
+
3
+ <p align="center">
4
+ <img
5
+ src="https://raw.githubusercontent.com/LeanMCP/leanmcp-sdk/refs/heads/main/assets/logo.png"
6
+ alt="LeanMCP Logo"
7
+ width="400"
8
+ />
9
+ </p>
10
+
11
+ <p align="center">
12
+ <a href="https://www.npmjs.com/package/@leanmcp/cli">
13
+ <img src="https://img.shields.io/npm/v/@leanmcp/cli" alt="npm version" />
14
+ </a>
15
+ <a href="https://www.npmjs.com/package/@leanmcp/cli">
16
+ <img src="https://img.shields.io/npm/dm/@leanmcp/cli" alt="npm downloads" />
17
+ </a>
18
+ <a href="https://docs.leanmcp.com/sdk/cli">
19
+ <img src="https://img.shields.io/badge/Docs-leanmcp-0A66C2?" />
20
+ </a>
21
+ <a href="https://discord.com/invite/DsRcA3GwPy">
22
+ <img src="https://dcbadge.limes.pink/api/server/DsRcA3GwPy?style=flat" alt="Discord" />
23
+ </a>
24
+ <a href="https://x.com/LeanMcp">
25
+ <img src="https://img.shields.io/badge/@LeanMCP-f5f5f5?logo=x&logoColor=000000" />
26
+ </a>
27
+ <a href="https://leanmcp.com/">
28
+ <img src="https://img.shields.io/badge/Website-leanmcp-0A66C2?" />
29
+ </a>
30
+ <a href="https://deepwiki.com/LeanMCP/leanmcp-sdk"><img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki"></a>
31
+ </p>
32
+
33
+ ```json
34
+ {
35
+ "package": "@leanmcp/cli",
36
+ "purpose": "Command-line interface for scaffolding LeanMCP projects",
37
+ "useCases": [
38
+ "Project scaffolding",
39
+ "Local development with hot-reload",
40
+ "Cloud deployment",
41
+ "Project management"
42
+ ],
43
+ "dependencies": ["@inquirer/prompts", "commander", "chalk", "vite", "archiver", "fs-extra"],
44
+ "bin": {
45
+ "leanmcp": "bin/leanmcp.js"
46
+ },
47
+ "main": "dist/index.js",
48
+ "exports": {
49
+ ".": {
50
+ "types": "./dist/index.d.ts",
51
+ "import": "./dist/index.js"
52
+ }
53
+ }
54
+ }
55
+ ```
56
+
57
+ ## Overview
58
+
59
+ - **What it is**: Command-line interface for scaffolding LeanMCP projects with hot-reload development and cloud deployment
60
+ - **Purpose**: Streamlines the entire MCP server development workflow from project creation to production deployment
61
+ - **Key benefits**:
62
+ - Quick project scaffolding with production-ready templates
63
+ - Hot-reload development server with UI component building
64
+ - One-command cloud deployment to LeanMCP platform
65
+ - Interactive setup with guided prompts
66
+ - Project management and monitoring tools
67
+
68
+ ## When to Use It
69
+
70
+ **Use `@leanmcp/cli` when:**
71
+
72
+ - Starting any new MCP server project (highly recommended)
73
+ - Need local development with hot-reload and UI building
74
+ - Want to deploy to LeanMCP Cloud with custom subdomains
75
+ - Managing multiple MCP projects
76
+ - Need guided setup for dependencies and configuration
77
+
78
+ **You probably do NOT need this if:**
79
+
80
+ - Using custom build systems or deployment pipelines
81
+ - Only working with existing projects without scaffolding needs
82
+ - Building MCP clients (not servers)
83
+ - Working in environments where global CLI tools aren't allowed
84
+
85
+ ## Features
86
+
87
+ - **Quick Scaffolding** — Create production-ready MCP servers in seconds
88
+ - **Hot Reload Development** — `leanmcp dev` with UI component hot-reload
89
+ - **Cloud Deployment** — Deploy to LeanMCP Cloud with custom subdomains
90
+ - **Project Management** — List, view, and delete cloud projects
91
+ - **Interactive Setup** — Guided prompts for dependencies and dev server
92
+
93
+ ## Installation
94
+
95
+ ```bash
96
+ npm install -g @leanmcp/cli
97
+ ```
98
+
99
+ Or run without installing:
100
+
101
+ ```bash
102
+ npx @leanmcp/cli create my-mcp-server
103
+ ```
104
+
105
+ **Requirements:**
106
+
107
+ - Node.js >= 18.0.0
108
+ - npm >= 9.0.0
109
+
110
+ ## Usage / Examples
111
+
112
+ ### Commands Overview
113
+
114
+ ```bash
115
+ # Local development
116
+ leanmcp create <name> # Create a new project
117
+ leanmcp add <service> # Add a service to existing project
118
+ leanmcp dev # Start development server with hot-reload
119
+ leanmcp build # Build for production
120
+ leanmcp start # Start production server
121
+
122
+ # Cloud commands
123
+ leanmcp login # Authenticate with LeanMCP Cloud
124
+ leanmcp logout # Remove API key
125
+ leanmcp whoami # Show login status
126
+ leanmcp deploy <folder> # Deploy to LeanMCP Cloud
127
+ leanmcp projects list # List your cloud projects
128
+ leanmcp projects get <id> # Get project details
129
+ leanmcp projects delete <id> # Delete a project
130
+ ```
131
+
132
+ ---
133
+
134
+ ## Local Development
135
+
136
+ ### create
137
+
138
+ Create a new MCP server project:
139
+
140
+ ```bash
141
+ leanmcp create my-sentiment-tool
142
+ ```
143
+
144
+ Interactive prompts will guide you through:
145
+
146
+ 1. Creating the project structure
147
+ 2. Installing dependencies (optional)
148
+ 3. Starting the dev server (optional)
149
+
150
+ **Generated structure:**
151
+
152
+ ```
153
+ my-mcp-server/
154
+ ├── main.ts # Entry point with HTTP server
155
+ ├── package.json # Dependencies and scripts
156
+ ├── tsconfig.json # TypeScript configuration
157
+ └── mcp/ # Services directory
158
+ └── example/
159
+ └── index.ts # Example service with tools
160
+ ```
161
+
162
+ ### add
163
+
164
+ Add a new service to an existing project:
165
+
166
+ ```bash
167
+ cd my-mcp-server
168
+ leanmcp add weather
169
+ ```
170
+
171
+ This:
172
+
173
+ - Creates `mcp/weather/index.ts` with example Tool, Prompt, and Resource
174
+ - Automatically registers the service in `main.ts`
175
+ - Includes `@SchemaConstraint` validation examples
176
+
177
+ ### dev
178
+
179
+ Start the development server with hot-reload:
180
+
181
+ ```bash
182
+ leanmcp dev
183
+ ```
184
+
185
+ This command:
186
+
187
+ - Scans for `@UIApp` components and builds them
188
+ - Starts the HTTP server with `tsx watch`
189
+ - Watches `mcp/` directory for changes
190
+ - Automatically rebuilds UI components when modified
191
+ - Hot-reloads when adding/removing `@UIApp` decorators
192
+
193
+ ```bash
194
+ $ leanmcp dev
195
+
196
+ LeanMCP Development Server
197
+
198
+ ℹ Found 2 @UIApp component(s)
199
+ ℹ UI components built
200
+
201
+ Starting development server...
202
+
203
+ [HTTP][INFO] Server running on http://localhost:3001
204
+ [HTTP][INFO] MCP endpoint: http://localhost:3001/mcp
205
+ ```
206
+
207
+ ### build
208
+
209
+ Build the project for production:
210
+
211
+ ```bash
212
+ leanmcp build
213
+ ```
214
+
215
+ Compiles TypeScript and bundles UI components.
216
+
217
+ ### start
218
+
219
+ Start the production server:
220
+
221
+ ```bash
222
+ leanmcp start
223
+ ```
224
+
225
+ Runs the compiled production build.
226
+
227
+ ---
228
+
229
+ ## Cloud Commands
230
+
231
+ ### login
232
+
233
+ Authenticate with LeanMCP Cloud:
234
+
235
+ ```bash
236
+ leanmcp login
237
+ ```
238
+
239
+ Steps:
240
+
241
+ 1. Go to [ship.leanmcp.com/api-keys](https://ship.leanmcp.com/api-keys)
242
+ 2. Create an API key with "BUILD_AND_DEPLOY" scope
243
+ 3. Enter the key when prompted
244
+
245
+ ### logout
246
+
247
+ Remove your API key:
248
+
249
+ ```bash
250
+ leanmcp logout
251
+ ```
252
+
253
+ ### whoami
254
+
255
+ Check your current login status:
256
+
257
+ ```bash
258
+ leanmcp whoami
259
+ ```
260
+
261
+ ### deploy
262
+
263
+ Deploy your MCP server to LeanMCP Cloud:
264
+
265
+ ```bash
266
+ leanmcp deploy .
267
+ # Or specify a folder
268
+ leanmcp deploy ./my-project
269
+ ```
270
+
271
+ Deployment process:
272
+
273
+ 1. Creates project (or updates existing)
274
+ 2. Packages and uploads code
275
+ 3. Builds container image
276
+ 4. Deploys to serverless Lambda
277
+ 5. Configures custom subdomain
278
+
279
+ ```bash
280
+ $ leanmcp deploy .
281
+
282
+ LeanMCP Deploy
283
+
284
+ Generated project name: swift-coral-sunset
285
+ Path: /path/to/my-project
286
+
287
+ ? Subdomain for your deployment: my-api
288
+ ✔ Subdomain 'my-api' is available
289
+
290
+ ? Proceed with deployment? Yes
291
+
292
+ ✔ Project created: 7f4a3b2c...
293
+ ✔ Project uploaded
294
+ ✔ Build complete (45s)
295
+ ✔ Deployed
296
+ ✔ Subdomain configured
297
+
298
+ ============================================================
299
+ DEPLOYMENT SUCCESSFUL!
300
+ ============================================================
301
+
302
+ Your MCP server is now live:
303
+
304
+ URL: https://my-api.leanmcp.dev
305
+
306
+ Test endpoints:
307
+ curl https://my-api.leanmcp.dev/health
308
+ curl https://my-api.leanmcp.dev/mcp
309
+ ```
310
+
311
+ ### projects
312
+
313
+ Manage your cloud projects:
314
+
315
+ ```bash
316
+ # List all projects
317
+ leanmcp projects list
318
+
319
+ # Get project details
320
+ leanmcp projects get <project-id>
321
+
322
+ # Delete a project
323
+ leanmcp projects delete <project-id>
324
+ leanmcp projects delete <project-id> --force # Skip confirmation
325
+ ```
326
+
327
+ ---
328
+
329
+ ## API Reference
330
+
331
+ ### Command Reference
332
+
333
+ | Command | Description | Usage |
334
+ | ---------------------- | ---------------------------------------- | ------------------------------ |
335
+ | `create <name>` | Create new MCP server project | `leanmcp create my-server` |
336
+ | `add <service>` | Add service to existing project | `leanmcp add weather` |
337
+ | `dev` | Start development server with hot-reload | `leanmcp dev` |
338
+ | `build` | Build for production | `leanmcp build` |
339
+ | `start` | Start production server | `leanmcp start` |
340
+ | `login` | Authenticate with LeanMCP Cloud | `leanmcp login` |
341
+ | `logout` | Remove API key | `leanmcp logout` |
342
+ | `whoami` | Show login status | `leanmcp whoami` |
343
+ | `deploy [folder]` | Deploy to LeanMCP Cloud | `leanmcp deploy .` |
344
+ | `projects list` | List cloud projects | `leanmcp projects list` |
345
+ | `projects get <id>` | Get project details | `leanmcp projects get <id>` |
346
+ | `projects delete <id>` | Delete project | `leanmcp projects delete <id>` |
347
+ | `env list [folder]` | List environment variables | `leanmcp env list` |
348
+ | `env set <keyValue>` | Set environment variable | `leanmcp env set KEY=VALUE` |
349
+ | `env get <key>` | Get environment variable value | `leanmcp env get KEY` |
350
+ | `env remove <key>` | Remove environment variable | `leanmcp env remove KEY` |
351
+ | `env pull [folder]` | Download env vars to local file | `leanmcp env pull` |
352
+ | `env push [folder]` | Upload env vars from local file | `leanmcp env push` |
353
+
354
+ ---
355
+
356
+ ## Integration with Other LeanMCP Packages
357
+
358
+ **@leanmcp/cli** works seamlessly with all LeanMCP packages:
359
+
360
+ - **[@leanmcp/core](https://www.npmjs.com/package/@leanmcp/core)** — Generated projects use `@leanmcp/core` as the foundation
361
+ - **[@leanmcp/auth](https://www.npmjs.com/package/@leanmcp/auth)** — CLI can scaffold projects with authentication setup
362
+ - **[@leanmcp/ui](https://www.npmjs.com/package/@leanmcp/ui)** — `leanmcp dev` automatically builds UI components with hot-reload
363
+ - **[@leanmcp/elicitation](https://www.npmjs.com/package/@leanmcp/elicitation)** — Generated services include elicitation examples
364
+ - **[@leanmcp/env-injection](https://www.npmjs.com/package/@leanmcp/env-injection)** — Deploy command handles user secrets configuration
365
+
366
+ **Generated project structure:**
367
+
368
+ ```
369
+ my-mcp-server/
370
+ ├── main.ts # Entry point with HTTP server
371
+ ├── package.json # Dependencies and scripts
372
+ ├── tsconfig.json # TypeScript configuration
373
+ └── mcp/ # Services directory (auto-discovered)
374
+ └── example/
375
+ └── index.ts # Example service with @Tool, @Prompt, @Resource
376
+ ```
377
+
378
+ ---
379
+
380
+ ## Best Practices / Troubleshooting
381
+
382
+ ### NPM Scripts
383
+
384
+ Generated projects include:
385
+
386
+ ```bash
387
+ npm run dev # Start with hot reload (tsx watch)
388
+ npm run build # Build for production
389
+ npm run start # Run production build
390
+ npm run clean # Remove build artifacts
391
+ ```
392
+
393
+ ## Configuration
394
+
395
+ ### Port
396
+
397
+ ```bash
398
+ PORT=4000 npm run dev
399
+ # Or in .env file
400
+ PORT=4000
401
+ ```
402
+
403
+ ### LeanMCP Config
404
+
405
+ Stored in `~/.leanmcp/config.json`:
406
+
407
+ ```json
408
+ {
409
+ "apiKey": "airtrain_...",
410
+ "apiUrl": "https://api.leanmcp.com",
411
+ "lastUpdated": "2024-01-15T10:30:00.000Z"
412
+ }
413
+ ```
414
+
415
+ ## Troubleshooting
416
+
417
+ ### Port Already in Use
418
+
419
+ Change the port in `.env`:
420
+
421
+ ```bash
422
+ PORT=3002
423
+ ```
424
+
425
+ ### Module Not Found Errors
426
+
427
+ Ensure dependencies are installed:
428
+
429
+ ```bash
430
+ npm install
431
+ ```
432
+
433
+ ### TypeScript Decorator Errors
434
+
435
+ Ensure your `tsconfig.json` has:
436
+
437
+ ```json
438
+ {
439
+ "compilerOptions": {
440
+ "experimentalDecorators": true,
441
+ "emitDecoratorMetadata": true
442
+ }
443
+ }
444
+ ```
445
+
446
+ ### Deploy: Not Logged In
447
+
448
+ Run `leanmcp login` first to authenticate with your API key.
449
+
450
+ ### Deploy: Subdomain Taken
451
+
452
+ Choose a different subdomain when prompted.
453
+
454
+ ## Requirements
455
+
456
+ - Node.js >= 18.0.0
457
+ - npm >= 9.0.0
458
+
459
+ ## Documentation
460
+
461
+ - [Full Documentation](https://docs.leanmcp.com/sdk/cli)
462
+
463
+ ## Related Packages
464
+
465
+ - [@leanmcp/core](https://www.npmjs.com/package/@leanmcp/core) — Core MCP server functionality
466
+ - [@leanmcp/auth](https://www.npmjs.com/package/@leanmcp/auth) — Authentication decorators
467
+ - [@leanmcp/ui](https://www.npmjs.com/package/@leanmcp/ui) — MCP App UI components
468
+
469
+ ---
470
+
471
+ ## Links
472
+
473
+ - **Documentation**: [https://docs.leanmcp.com/sdk/cli](https://docs.leanmcp.com/sdk/cli)
474
+ - **GitHub**: [https://github.com/LeanMCP/leanmcp-sdk/tree/main/packages/cli](https://github.com/LeanMCP/leanmcp-sdk/tree/main/packages/cli)
475
+ - **npm**: [https://www.npmjs.com/package/@leanmcp/cli](https://www.npmjs.com/package/@leanmcp/cli)
476
+ - **LeanMCP Dashboard**: [https://ship.leanmcp.com](https://ship.leanmcp.com)
477
+ - **License**: MIT