@leanmcp/cli 0.5.0 → 0.5.2-alpha.6.6dae082

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.
package/README.md CHANGED
@@ -1,353 +1,368 @@
1
- <p align="center">
2
- <img
3
- src="https://raw.githubusercontent.com/LeanMCP/leanmcp-sdk/refs/heads/main/assets/logo.png"
4
- alt="LeanMCP Logo"
5
- width="400"
6
- />
7
- </p>
8
-
9
- <p align="center">
10
- <strong>@leanmcp/cli</strong><br/>
11
- Command-line tool for creating, developing, and deploying LeanMCP projects.
12
- </p>
13
-
14
- <p align="center">
15
- <a href="https://www.npmjs.com/package/@leanmcp/cli">
16
- <img src="https://img.shields.io/npm/v/@leanmcp/cli" alt="npm version" />
17
- </a>
18
- <a href="https://www.npmjs.com/package/@leanmcp/cli">
19
- <img src="https://img.shields.io/npm/dm/@leanmcp/cli" alt="npm downloads" />
20
- </a>
21
- <a href="https://docs.leanmcp.com/sdk/cli">
22
- <img src="https://img.shields.io/badge/Docs-leanmcp-0A66C2?" />
23
- </a>
24
- <a href="https://discord.com/invite/DsRcA3GwPy">
25
- <img src="https://img.shields.io/badge/Discord-Join-5865F2?logo=discord&logoColor=white" />
26
- </a>
27
- <a href="https://x.com/LeanMcp">
28
- <img src="https://img.shields.io/badge/@LeanMCP-f5f5f5?logo=x&logoColor=000000" />
29
- </a>
30
- </p>
31
-
32
- ## Features
33
-
34
- - **Quick Scaffolding** — Create production-ready MCP servers in seconds
35
- - **Hot Reload Development** — `leanmcp dev` with UI component hot-reload
36
- - **Cloud Deployment** — Deploy to LeanMCP Cloud with custom subdomains
37
- - **Project Management** — List, view, and delete cloud projects
38
- - **Interactive Setup** — Guided prompts for dependencies and dev server
39
-
40
- ## Installation
41
-
42
- ```bash
43
- npm install -g @leanmcp/cli
44
- ```
45
-
46
- Or run without installing:
47
- ```bash
48
- npx @leanmcp/cli create my-mcp-server
49
- ```
50
-
51
- ## Commands Overview
52
-
53
- ```bash
54
- # Local development
55
- leanmcp create <name> # Create a new project
56
- leanmcp add <service> # Add a service to existing project
57
- leanmcp dev # Start development server with hot-reload
58
- leanmcp build # Build for production
59
- leanmcp start # Start production server
60
-
61
- # Cloud commands
62
- leanmcp login # Authenticate with LeanMCP Cloud
63
- leanmcp logout # Remove API key
64
- leanmcp whoami # Show login status
65
- leanmcp deploy <folder> # Deploy to LeanMCP Cloud
66
- leanmcp projects list # List your cloud projects
67
- leanmcp projects get <id> # Get project details
68
- leanmcp projects delete <id> # Delete a project
69
- ```
70
-
71
- ---
72
-
73
- ## Local Development
74
-
75
- ### create
76
-
77
- Create a new MCP server project:
78
-
79
- ```bash
80
- leanmcp create my-sentiment-tool
81
- ```
82
-
83
- Interactive prompts will guide you through:
84
- 1. Creating the project structure
85
- 2. Installing dependencies (optional)
86
- 3. Starting the dev server (optional)
87
-
88
- **Generated structure:**
89
- ```
90
- my-mcp-server/
91
- ├── main.ts # Entry point with HTTP server
92
- ├── package.json # Dependencies and scripts
93
- ├── tsconfig.json # TypeScript configuration
94
- └── mcp/ # Services directory
95
- └── example/
96
- └── index.ts # Example service with tools
97
- ```
98
-
99
- ### add
100
-
101
- Add a new service to an existing project:
102
-
103
- ```bash
104
- cd my-mcp-server
105
- leanmcp add weather
106
- ```
107
-
108
- This:
109
- - Creates `mcp/weather/index.ts` with example Tool, Prompt, and Resource
110
- - Automatically registers the service in `main.ts`
111
- - Includes `@SchemaConstraint` validation examples
112
-
113
- ### dev
114
-
115
- Start the development server with hot-reload:
116
-
117
- ```bash
118
- leanmcp dev
119
- ```
120
-
121
- This command:
122
- - Scans for `@UIApp` components and builds them
123
- - Starts the HTTP server with `tsx watch`
124
- - Watches `mcp/` directory for changes
125
- - Automatically rebuilds UI components when modified
126
- - Hot-reloads when adding/removing `@UIApp` decorators
127
-
128
- ```bash
129
- $ leanmcp dev
130
-
131
- LeanMCP Development Server
132
-
133
- Found 2 @UIApp component(s)
134
- UI components built
135
-
136
- Starting development server...
137
-
138
- [HTTP][INFO] Server running on http://localhost:3001
139
- [HTTP][INFO] MCP endpoint: http://localhost:3001/mcp
140
- ```
141
-
142
- ### build
143
-
144
- Build the project for production:
145
-
146
- ```bash
147
- leanmcp build
148
- ```
149
-
150
- Compiles TypeScript and bundles UI components.
151
-
152
- ### start
153
-
154
- Start the production server:
155
-
156
- ```bash
157
- leanmcp start
158
- ```
159
-
160
- Runs the compiled production build.
161
-
162
- ---
163
-
164
- ## Cloud Commands
165
-
166
- ### login
167
-
168
- Authenticate with LeanMCP Cloud:
169
-
170
- ```bash
171
- leanmcp login
172
- ```
173
-
174
- Steps:
175
- 1. Go to [ship.leanmcp.com/api-keys](https://ship.leanmcp.com/api-keys)
176
- 2. Create an API key with "BUILD_AND_DEPLOY" scope
177
- 3. Enter the key when prompted
178
-
179
- ### logout
180
-
181
- Remove your API key:
182
-
183
- ```bash
184
- leanmcp logout
185
- ```
186
-
187
- ### whoami
188
-
189
- Check your current login status:
190
-
191
- ```bash
192
- leanmcp whoami
193
- ```
194
-
195
- ### deploy
196
-
197
- Deploy your MCP server to LeanMCP Cloud:
198
-
199
- ```bash
200
- leanmcp deploy .
201
- # Or specify a folder
202
- leanmcp deploy ./my-project
203
- ```
204
-
205
- Deployment process:
206
- 1. Creates project (or updates existing)
207
- 2. Packages and uploads code
208
- 3. Builds container image
209
- 4. Deploys to serverless Lambda
210
- 5. Configures custom subdomain
211
-
212
- ```bash
213
- $ leanmcp deploy .
214
-
215
- LeanMCP Deploy
216
-
217
- Generated project name: swift-coral-sunset
218
- Path: /path/to/my-project
219
-
220
- ? Subdomain for your deployment: my-api
221
- Subdomain 'my-api' is available
222
-
223
- ? Proceed with deployment? Yes
224
-
225
- ✔ Project created: 7f4a3b2c...
226
- Project uploaded
227
- ✔ Build complete (45s)
228
- Deployed
229
- Subdomain configured
230
-
231
- ============================================================
232
- DEPLOYMENT SUCCESSFUL!
233
- ============================================================
234
-
235
- Your MCP server is now live:
236
-
237
- URL: https://my-api.leanmcp.dev
238
-
239
- Test endpoints:
240
- curl https://my-api.leanmcp.dev/health
241
- curl https://my-api.leanmcp.dev/mcp
242
- ```
243
-
244
- ### projects
245
-
246
- Manage your cloud projects:
247
-
248
- ```bash
249
- # List all projects
250
- leanmcp projects list
251
-
252
- # Get project details
253
- leanmcp projects get <project-id>
254
-
255
- # Delete a project
256
- leanmcp projects delete <project-id>
257
- leanmcp projects delete <project-id> --force # Skip confirmation
258
- ```
259
-
260
- ---
261
-
262
- ## NPM Scripts
263
-
264
- Generated projects include:
265
-
266
- ```bash
267
- npm run dev # Start with hot reload (tsx watch)
268
- npm run build # Build for production
269
- npm run start # Run production build
270
- npm run clean # Remove build artifacts
271
- ```
272
-
273
- ## Configuration
274
-
275
- ### Port
276
-
277
- ```bash
278
- PORT=4000 npm run dev
279
- # Or in .env file
280
- PORT=4000
281
- ```
282
-
283
- ### LeanMCP Config
284
-
285
- Stored in `~/.leanmcp/config.json`:
286
- ```json
287
- {
288
- "apiKey": "airtrain_...",
289
- "apiUrl": "https://api.leanmcp.com",
290
- "lastUpdated": "2024-01-15T10:30:00.000Z"
291
- }
292
- ```
293
-
294
- ## Troubleshooting
295
-
296
- ### Port Already in Use
297
-
298
- Change the port in `.env`:
299
- ```bash
300
- PORT=3002
301
- ```
302
-
303
- ### Module Not Found Errors
304
-
305
- Ensure dependencies are installed:
306
- ```bash
307
- npm install
308
- ```
309
-
310
- ### TypeScript Decorator Errors
311
-
312
- Ensure your `tsconfig.json` has:
313
- ```json
314
- {
315
- "compilerOptions": {
316
- "experimentalDecorators": true,
317
- "emitDecoratorMetadata": true
318
- }
319
- }
320
- ```
321
-
322
- ### Deploy: Not Logged In
323
-
324
- Run `leanmcp login` first to authenticate with your API key.
325
-
326
- ### Deploy: Subdomain Taken
327
-
328
- Choose a different subdomain when prompted.
329
-
330
- ## Requirements
331
-
332
- - Node.js >= 18.0.0
333
- - npm >= 9.0.0
334
-
335
- ## Documentation
336
-
337
- - [Full Documentation](https://docs.leanmcp.com/sdk/cli)
338
-
339
- ## Related Packages
340
-
341
- - [@leanmcp/core](https://www.npmjs.com/package/@leanmcp/core) Core MCP server functionality
342
- - [@leanmcp/auth](https://www.npmjs.com/package/@leanmcp/auth) — Authentication decorators
343
- - [@leanmcp/ui](https://www.npmjs.com/package/@leanmcp/ui) MCP App UI components
344
-
345
- ## Links
346
-
347
- - [GitHub Repository](https://github.com/LeanMCP/leanmcp-sdk)
348
- - [NPM Package](https://www.npmjs.com/package/@leanmcp/cli)
349
- - [LeanMCP Dashboard](https://ship.leanmcp.com)
350
-
351
- ## License
352
-
353
- MIT
1
+ <p align="center">
2
+ <img
3
+ src="https://raw.githubusercontent.com/LeanMCP/leanmcp-sdk/refs/heads/main/assets/logo.png"
4
+ alt="LeanMCP Logo"
5
+ width="400"
6
+ />
7
+ </p>
8
+
9
+ <p align="center">
10
+ <strong>@leanmcp/cli</strong><br/>
11
+ Command-line tool for creating, developing, and deploying LeanMCP projects.
12
+ </p>
13
+
14
+ <p align="center">
15
+ <a href="https://www.npmjs.com/package/@leanmcp/cli">
16
+ <img src="https://img.shields.io/npm/v/@leanmcp/cli" alt="npm version" />
17
+ </a>
18
+ <a href="https://www.npmjs.com/package/@leanmcp/cli">
19
+ <img src="https://img.shields.io/npm/dm/@leanmcp/cli" alt="npm downloads" />
20
+ </a>
21
+ <a href="https://docs.leanmcp.com/sdk/cli">
22
+ <img src="https://img.shields.io/badge/Docs-leanmcp-0A66C2?" />
23
+ </a>
24
+ <a href="https://discord.com/invite/DsRcA3GwPy">
25
+ <img src="https://img.shields.io/badge/Discord-Join-5865F2?logo=discord&logoColor=white" />
26
+ </a>
27
+ <a href="https://x.com/LeanMcp">
28
+ <img src="https://img.shields.io/badge/@LeanMCP-f5f5f5?logo=x&logoColor=000000" />
29
+ </a>
30
+ <a href="https://leanmcp.com/">
31
+ <img src="https://img.shields.io/badge/Website-leanmcp-0A66C2?" />
32
+ </a>
33
+ <a href="https://deepwiki.com/LeanMCP/leanmcp-sdk"><img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki"></a>
34
+ </p>
35
+
36
+ ## Features
37
+
38
+ - **Quick Scaffolding** — Create production-ready MCP servers in seconds
39
+ - **Hot Reload Development** — `leanmcp dev` with UI component hot-reload
40
+ - **Cloud Deployment** — Deploy to LeanMCP Cloud with custom subdomains
41
+ - **Project Management** — List, view, and delete cloud projects
42
+ - **Interactive Setup** — Guided prompts for dependencies and dev server
43
+
44
+ ## Installation
45
+
46
+ ```bash
47
+ npm install -g @leanmcp/cli
48
+ ```
49
+
50
+ Or run without installing:
51
+
52
+ ```bash
53
+ npx @leanmcp/cli create my-mcp-server
54
+ ```
55
+
56
+ ## Commands Overview
57
+
58
+ ```bash
59
+ # Local development
60
+ leanmcp create <name> # Create a new project
61
+ leanmcp add <service> # Add a service to existing project
62
+ leanmcp dev # Start development server with hot-reload
63
+ leanmcp build # Build for production
64
+ leanmcp start # Start production server
65
+
66
+ # Cloud commands
67
+ leanmcp login # Authenticate with LeanMCP Cloud
68
+ leanmcp logout # Remove API key
69
+ leanmcp whoami # Show login status
70
+ leanmcp deploy <folder> # Deploy to LeanMCP Cloud
71
+ leanmcp projects list # List your cloud projects
72
+ leanmcp projects get <id> # Get project details
73
+ leanmcp projects delete <id> # Delete a project
74
+ ```
75
+
76
+ ---
77
+
78
+ ## Local Development
79
+
80
+ ### create
81
+
82
+ Create a new MCP server project:
83
+
84
+ ```bash
85
+ leanmcp create my-sentiment-tool
86
+ ```
87
+
88
+ Interactive prompts will guide you through:
89
+
90
+ 1. Creating the project structure
91
+ 2. Installing dependencies (optional)
92
+ 3. Starting the dev server (optional)
93
+
94
+ **Generated structure:**
95
+
96
+ ```
97
+ my-mcp-server/
98
+ ├── main.ts # Entry point with HTTP server
99
+ ├── package.json # Dependencies and scripts
100
+ ├── tsconfig.json # TypeScript configuration
101
+ └── mcp/ # Services directory
102
+ └── example/
103
+ └── index.ts # Example service with tools
104
+ ```
105
+
106
+ ### add
107
+
108
+ Add a new service to an existing project:
109
+
110
+ ```bash
111
+ cd my-mcp-server
112
+ leanmcp add weather
113
+ ```
114
+
115
+ This:
116
+
117
+ - Creates `mcp/weather/index.ts` with example Tool, Prompt, and Resource
118
+ - Automatically registers the service in `main.ts`
119
+ - Includes `@SchemaConstraint` validation examples
120
+
121
+ ### dev
122
+
123
+ Start the development server with hot-reload:
124
+
125
+ ```bash
126
+ leanmcp dev
127
+ ```
128
+
129
+ This command:
130
+
131
+ - Scans for `@UIApp` components and builds them
132
+ - Starts the HTTP server with `tsx watch`
133
+ - Watches `mcp/` directory for changes
134
+ - Automatically rebuilds UI components when modified
135
+ - Hot-reloads when adding/removing `@UIApp` decorators
136
+
137
+ ```bash
138
+ $ leanmcp dev
139
+
140
+ LeanMCP Development Server
141
+
142
+ Found 2 @UIApp component(s)
143
+ ℹ UI components built
144
+
145
+ Starting development server...
146
+
147
+ [HTTP][INFO] Server running on http://localhost:3001
148
+ [HTTP][INFO] MCP endpoint: http://localhost:3001/mcp
149
+ ```
150
+
151
+ ### build
152
+
153
+ Build the project for production:
154
+
155
+ ```bash
156
+ leanmcp build
157
+ ```
158
+
159
+ Compiles TypeScript and bundles UI components.
160
+
161
+ ### start
162
+
163
+ Start the production server:
164
+
165
+ ```bash
166
+ leanmcp start
167
+ ```
168
+
169
+ Runs the compiled production build.
170
+
171
+ ---
172
+
173
+ ## Cloud Commands
174
+
175
+ ### login
176
+
177
+ Authenticate with LeanMCP Cloud:
178
+
179
+ ```bash
180
+ leanmcp login
181
+ ```
182
+
183
+ Steps:
184
+
185
+ 1. Go to [ship.leanmcp.com/api-keys](https://ship.leanmcp.com/api-keys)
186
+ 2. Create an API key with "BUILD_AND_DEPLOY" scope
187
+ 3. Enter the key when prompted
188
+
189
+ ### logout
190
+
191
+ Remove your API key:
192
+
193
+ ```bash
194
+ leanmcp logout
195
+ ```
196
+
197
+ ### whoami
198
+
199
+ Check your current login status:
200
+
201
+ ```bash
202
+ leanmcp whoami
203
+ ```
204
+
205
+ ### deploy
206
+
207
+ Deploy your MCP server to LeanMCP Cloud:
208
+
209
+ ```bash
210
+ leanmcp deploy .
211
+ # Or specify a folder
212
+ leanmcp deploy ./my-project
213
+ ```
214
+
215
+ Deployment process:
216
+
217
+ 1. Creates project (or updates existing)
218
+ 2. Packages and uploads code
219
+ 3. Builds container image
220
+ 4. Deploys to serverless Lambda
221
+ 5. Configures custom subdomain
222
+
223
+ ```bash
224
+ $ leanmcp deploy .
225
+
226
+ LeanMCP Deploy
227
+
228
+ Generated project name: swift-coral-sunset
229
+ Path: /path/to/my-project
230
+
231
+ ? Subdomain for your deployment: my-api
232
+ Subdomain 'my-api' is available
233
+
234
+ ? Proceed with deployment? Yes
235
+
236
+ ✔ Project created: 7f4a3b2c...
237
+ ✔ Project uploaded
238
+ ✔ Build complete (45s)
239
+ Deployed
240
+ Subdomain configured
241
+
242
+ ============================================================
243
+ DEPLOYMENT SUCCESSFUL!
244
+ ============================================================
245
+
246
+ Your MCP server is now live:
247
+
248
+ URL: https://my-api.leanmcp.dev
249
+
250
+ Test endpoints:
251
+ curl https://my-api.leanmcp.dev/health
252
+ curl https://my-api.leanmcp.dev/mcp
253
+ ```
254
+
255
+ ### projects
256
+
257
+ Manage your cloud projects:
258
+
259
+ ```bash
260
+ # List all projects
261
+ leanmcp projects list
262
+
263
+ # Get project details
264
+ leanmcp projects get <project-id>
265
+
266
+ # Delete a project
267
+ leanmcp projects delete <project-id>
268
+ leanmcp projects delete <project-id> --force # Skip confirmation
269
+ ```
270
+
271
+ ---
272
+
273
+ ## NPM Scripts
274
+
275
+ Generated projects include:
276
+
277
+ ```bash
278
+ npm run dev # Start with hot reload (tsx watch)
279
+ npm run build # Build for production
280
+ npm run start # Run production build
281
+ npm run clean # Remove build artifacts
282
+ ```
283
+
284
+ ## Configuration
285
+
286
+ ### Port
287
+
288
+ ```bash
289
+ PORT=4000 npm run dev
290
+ # Or in .env file
291
+ PORT=4000
292
+ ```
293
+
294
+ ### LeanMCP Config
295
+
296
+ Stored in `~/.leanmcp/config.json`:
297
+
298
+ ```json
299
+ {
300
+ "apiKey": "airtrain_...",
301
+ "apiUrl": "https://api.leanmcp.com",
302
+ "lastUpdated": "2024-01-15T10:30:00.000Z"
303
+ }
304
+ ```
305
+
306
+ ## Troubleshooting
307
+
308
+ ### Port Already in Use
309
+
310
+ Change the port in `.env`:
311
+
312
+ ```bash
313
+ PORT=3002
314
+ ```
315
+
316
+ ### Module Not Found Errors
317
+
318
+ Ensure dependencies are installed:
319
+
320
+ ```bash
321
+ npm install
322
+ ```
323
+
324
+ ### TypeScript Decorator Errors
325
+
326
+ Ensure your `tsconfig.json` has:
327
+
328
+ ```json
329
+ {
330
+ "compilerOptions": {
331
+ "experimentalDecorators": true,
332
+ "emitDecoratorMetadata": true
333
+ }
334
+ }
335
+ ```
336
+
337
+ ### Deploy: Not Logged In
338
+
339
+ Run `leanmcp login` first to authenticate with your API key.
340
+
341
+ ### Deploy: Subdomain Taken
342
+
343
+ Choose a different subdomain when prompted.
344
+
345
+ ## Requirements
346
+
347
+ - Node.js >= 18.0.0
348
+ - npm >= 9.0.0
349
+
350
+ ## Documentation
351
+
352
+ - [Full Documentation](https://docs.leanmcp.com/sdk/cli)
353
+
354
+ ## Related Packages
355
+
356
+ - [@leanmcp/core](https://www.npmjs.com/package/@leanmcp/core) — Core MCP server functionality
357
+ - [@leanmcp/auth](https://www.npmjs.com/package/@leanmcp/auth) — Authentication decorators
358
+ - [@leanmcp/ui](https://www.npmjs.com/package/@leanmcp/ui) — MCP App UI components
359
+
360
+ ## Links
361
+
362
+ - [GitHub Repository](https://github.com/LeanMCP/leanmcp-sdk)
363
+ - [NPM Package](https://www.npmjs.com/package/@leanmcp/cli)
364
+ - [LeanMCP Dashboard](https://ship.leanmcp.com)
365
+
366
+ ## License
367
+
368
+ MIT