@leanmcp/cli 0.4.3 → 0.4.5
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/LICENSE +21 -21
- package/README.md +353 -353
- package/bin/leanmcp.js +3 -3
- package/dist/index.js +3 -4
- package/package.json +73 -73
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 LeanMCP Contributors
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 LeanMCP Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
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
|
package/bin/leanmcp.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// Always prefer ESM build
|
|
4
|
-
import('../dist/index.js');
|
|
2
|
+
|
|
3
|
+
// Always prefer ESM build
|
|
4
|
+
import('../dist/index.js');
|
package/dist/index.js
CHANGED
|
@@ -1116,8 +1116,8 @@ async function loginCommand() {
|
|
|
1116
1116
|
if (!value || value.trim().length === 0) {
|
|
1117
1117
|
return "API key is required";
|
|
1118
1118
|
}
|
|
1119
|
-
if (!value.startsWith("
|
|
1120
|
-
return 'Invalid API key format. API key should start with "
|
|
1119
|
+
if (!value.startsWith("leanmcp_") && !value.startsWith("airtain_")) {
|
|
1120
|
+
return 'Invalid API key format. API key should start with "leanmcp_" or "airtain_"';
|
|
1121
1121
|
}
|
|
1122
1122
|
return true;
|
|
1123
1123
|
}, "validate")
|
|
@@ -2916,11 +2916,10 @@ program.command("dev").description("Start development server with UI hot-reload
|
|
|
2916
2916
|
trackCommand("dev");
|
|
2917
2917
|
devCommand();
|
|
2918
2918
|
});
|
|
2919
|
-
program.command("build").description("
|
|
2919
|
+
program.command("build").description("Build UI components and compile TypeScript for production").action(() => {
|
|
2920
2920
|
trackCommand("build");
|
|
2921
2921
|
buildCommand();
|
|
2922
2922
|
});
|
|
2923
|
-
program.command("build").description("Build UI components and compile TypeScript for production").action(buildCommand);
|
|
2924
2923
|
program.command("start").description("Build UI components and start production server").action(() => {
|
|
2925
2924
|
trackCommand("start");
|
|
2926
2925
|
startCommand();
|
package/package.json
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@leanmcp/cli",
|
|
3
|
-
"version": "0.4.
|
|
4
|
-
"description": "Command-line interface for scaffolding LeanMCP projects",
|
|
5
|
-
"bin": {
|
|
6
|
-
"leanmcp": "bin/leanmcp.js"
|
|
7
|
-
},
|
|
8
|
-
"type": "module",
|
|
9
|
-
"main": "dist/index.js",
|
|
10
|
-
"types": "dist/index.d.ts",
|
|
11
|
-
"exports": {
|
|
12
|
-
".": {
|
|
13
|
-
"types": "./dist/index.d.ts",
|
|
14
|
-
"import": "./dist/index.js"
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
"files": [
|
|
18
|
-
"bin",
|
|
19
|
-
"dist",
|
|
20
|
-
"README.md",
|
|
21
|
-
"LICENSE"
|
|
22
|
-
],
|
|
23
|
-
"scripts": {
|
|
24
|
-
"build": "tsup src/index.ts --format esm --dts",
|
|
25
|
-
"dev": "tsup src/index.ts --format esm --dts --watch",
|
|
26
|
-
"test": "echo \"No tests yet\" && exit 0",
|
|
27
|
-
"clean": "rimraf dist"
|
|
28
|
-
},
|
|
29
|
-
"dependencies": {
|
|
30
|
-
"@inquirer/prompts": "^7.0.1",
|
|
31
|
-
"@vitejs/plugin-react": "^4.3.0",
|
|
32
|
-
"archiver": "^7.0.1",
|
|
33
|
-
"autoprefixer": "^10.4.16",
|
|
34
|
-
"chalk": "^5.3.0",
|
|
35
|
-
"chokidar": "^4.0.0",
|
|
36
|
-
"commander": "^12.0.0",
|
|
37
|
-
"fs-extra": "^11.2.0",
|
|
38
|
-
"glob": "^11.0.0",
|
|
39
|
-
"ora": "^8.1.0",
|
|
40
|
-
"postcss": "^8.4.32",
|
|
41
|
-
"tailwindcss": "^3.4.0",
|
|
42
|
-
"vite": "^5.4.0",
|
|
43
|
-
"vite-plugin-singlefile": "^2.3.0"
|
|
44
|
-
},
|
|
45
|
-
"devDependencies": {
|
|
46
|
-
"@types/archiver": "^6.0.3",
|
|
47
|
-
"@types/fs-extra": "^11.0.4",
|
|
48
|
-
"@types/node": "^25.0.2",
|
|
49
|
-
"rimraf": "^6.1.2"
|
|
50
|
-
},
|
|
51
|
-
"repository": {
|
|
52
|
-
"type": "git",
|
|
53
|
-
"url": "git+https://github.com/LeanMCP/leanmcp-sdk.git",
|
|
54
|
-
"directory": "packages/cli"
|
|
55
|
-
},
|
|
56
|
-
"homepage": "https://github.com/LeanMCP/leanmcp-sdk#readme",
|
|
57
|
-
"bugs": {
|
|
58
|
-
"url": "https://github.com/LeanMCP/leanmcp-sdk/issues"
|
|
59
|
-
},
|
|
60
|
-
"keywords": [
|
|
61
|
-
"mcp",
|
|
62
|
-
"model-context-protocol",
|
|
63
|
-
"cli",
|
|
64
|
-
"scaffolding",
|
|
65
|
-
"generator",
|
|
66
|
-
"typescript"
|
|
67
|
-
],
|
|
68
|
-
"author": "LeanMCP <admin@leanmcp.com>",
|
|
69
|
-
"license": "MIT",
|
|
70
|
-
"publishConfig": {
|
|
71
|
-
"access": "public"
|
|
72
|
-
}
|
|
73
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@leanmcp/cli",
|
|
3
|
+
"version": "0.4.5",
|
|
4
|
+
"description": "Command-line interface for scaffolding LeanMCP projects",
|
|
5
|
+
"bin": {
|
|
6
|
+
"leanmcp": "bin/leanmcp.js"
|
|
7
|
+
},
|
|
8
|
+
"type": "module",
|
|
9
|
+
"main": "dist/index.js",
|
|
10
|
+
"types": "dist/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"import": "./dist/index.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"bin",
|
|
19
|
+
"dist",
|
|
20
|
+
"README.md",
|
|
21
|
+
"LICENSE"
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "tsup src/index.ts --format esm --dts",
|
|
25
|
+
"dev": "tsup src/index.ts --format esm --dts --watch",
|
|
26
|
+
"test": "echo \"No tests yet\" && exit 0",
|
|
27
|
+
"clean": "rimraf dist"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@inquirer/prompts": "^7.0.1",
|
|
31
|
+
"@vitejs/plugin-react": "^4.3.0",
|
|
32
|
+
"archiver": "^7.0.1",
|
|
33
|
+
"autoprefixer": "^10.4.16",
|
|
34
|
+
"chalk": "^5.3.0",
|
|
35
|
+
"chokidar": "^4.0.0",
|
|
36
|
+
"commander": "^12.0.0",
|
|
37
|
+
"fs-extra": "^11.2.0",
|
|
38
|
+
"glob": "^11.0.0",
|
|
39
|
+
"ora": "^8.1.0",
|
|
40
|
+
"postcss": "^8.4.32",
|
|
41
|
+
"tailwindcss": "^3.4.0",
|
|
42
|
+
"vite": "^5.4.0",
|
|
43
|
+
"vite-plugin-singlefile": "^2.3.0"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/archiver": "^6.0.3",
|
|
47
|
+
"@types/fs-extra": "^11.0.4",
|
|
48
|
+
"@types/node": "^25.0.2",
|
|
49
|
+
"rimraf": "^6.1.2"
|
|
50
|
+
},
|
|
51
|
+
"repository": {
|
|
52
|
+
"type": "git",
|
|
53
|
+
"url": "git+https://github.com/LeanMCP/leanmcp-sdk.git",
|
|
54
|
+
"directory": "packages/cli"
|
|
55
|
+
},
|
|
56
|
+
"homepage": "https://github.com/LeanMCP/leanmcp-sdk#readme",
|
|
57
|
+
"bugs": {
|
|
58
|
+
"url": "https://github.com/LeanMCP/leanmcp-sdk/issues"
|
|
59
|
+
},
|
|
60
|
+
"keywords": [
|
|
61
|
+
"mcp",
|
|
62
|
+
"model-context-protocol",
|
|
63
|
+
"cli",
|
|
64
|
+
"scaffolding",
|
|
65
|
+
"generator",
|
|
66
|
+
"typescript"
|
|
67
|
+
],
|
|
68
|
+
"author": "LeanMCP <admin@leanmcp.com>",
|
|
69
|
+
"license": "MIT",
|
|
70
|
+
"publishConfig": {
|
|
71
|
+
"access": "public"
|
|
72
|
+
}
|
|
73
|
+
}
|