@leanmcp/cli 0.4.2 → 0.4.3

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,353 @@
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
+ </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