@leanmcp/cli 0.2.8 → 0.2.9

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 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,428 +1,428 @@
1
- # @leanmcp/cli
2
-
3
- Command-line tool for creating LeanMCP projects with production-ready templates.
4
-
5
- ## Features
6
-
7
- - **Interactive setup** - Guided prompts for dependency installation and dev server
8
- - **Quick project scaffolding** - Create new MCP servers in seconds
9
- - **Complete setup** - Includes TypeScript, dependencies, and configuration
10
- - **Best practices** - Generated projects follow MCP standards
11
- - **Ready to run** - Start developing immediately with hot reload
12
- - **Example service** - Includes working examples to get started
13
- - **Pure ESM** - Modern ES modules with full TypeScript support
14
-
15
- ## Installation
16
-
17
- ```bash
18
- # npm
19
- npm install -g @leanmcp/cli
20
-
21
- # GitHub Packages
22
- npm install -g @leanmcp/cli --registry=https://npm.pkg.github.com
23
- ```
24
-
25
- Or use without installing:
26
- ```bash
27
- npx @leanmcp/cli create my-mcp-server
28
- ```
29
-
30
- ## Usage
31
-
32
- ### Create a New Project
33
-
34
- ```bash
35
- leanmcp create <project-name>
36
- ```
37
-
38
- Or with npx:
39
- ```bash
40
- npx @leanmcp/cli create my-mcp-server
41
- ```
42
-
43
- ### Example
44
-
45
- ```bash
46
- $ leanmcp create my-sentiment-tool
47
- ✔ Project my-sentiment-tool created!
48
-
49
- Success! Your MCP server is ready.
50
-
51
- Next, navigate to your project:
52
- cd my-sentiment-tool
53
-
54
- ? Would you like to install dependencies now? (Y/n) Yes
55
- ✔ Dependencies installed successfully!
56
- ? Would you like to start the development server? (Y/n) Yes
57
-
58
- Starting development server...
59
-
60
- > my-sentiment-tool@1.0.0 dev
61
- > tsx watch main.ts
62
-
63
- [HTTP][INFO] Starting LeanMCP HTTP Server...
64
- [HTTP][INFO] Server running on http://localhost:3001
65
- [HTTP][INFO] MCP endpoint: http://localhost:3001/mcp
66
- ```
67
-
68
- ### Add a New Service
69
-
70
- After creating a project, you can quickly add new services:
71
-
72
- ```bash
73
- leanmcp add <service-name>
74
- ```
75
-
76
- This command:
77
- - Creates a new service file in `mcp/<service-name>.ts`
78
- - Includes example Tool, Prompt, and Resource decorators
79
- - Automatically registers the service in `main.ts`
80
- - Includes schema validation examples
81
-
82
- **Example:**
83
-
84
- ```bash
85
- $ leanmcp add weather
86
- ✔ Created new service: weather
87
- File: mcp/weather.ts
88
- Tool: greet
89
- Prompt: welcomePrompt
90
- Resource: getStatus
91
-
92
- Service automatically registered in main.ts!
93
- ```
94
-
95
- The generated service includes:
96
- - **Tool** - `greet()`: A callable function with schema validation
97
- - **Prompt** - `welcomePrompt()`: A reusable prompt template
98
- - **Resource** - `getStatus()`: A data endpoint
99
-
100
- You can then customize these to fit your needs.
101
-
102
- ## Generated Project Structure
103
-
104
- ```
105
- my-mcp-server/
106
- ├── main.ts # Entry point with HTTP server
107
- ├── package.json # Dependencies and scripts
108
- ├── tsconfig.json # TypeScript configuration
109
- └── mcp/ # Services directory
110
- └── example.ts # Example service with tools
111
- ```
112
-
113
- ## Generated Files
114
-
115
- ### main.ts
116
- Entry point that:
117
- - Loads environment variables
118
- - Creates MCP server instance
119
- - Registers services
120
- - Starts HTTP server with session management
121
-
122
- ### mcp/example.ts
123
- Example service demonstrating:
124
- - `@Tool` decorator for callable functions
125
- - `@Resource` decorator for data sources
126
- - `@Prompt` decorator for prompt templates
127
- - Class-based schema validation with `@SchemaConstraint`
128
- - Input/output type safety
129
-
130
- ### package.json
131
- Includes:
132
- - `@leanmcp/core` - Core MCP functionality
133
- - `@modelcontextprotocol/sdk` - Official MCP SDK
134
- - `express` - HTTP server
135
- - `tsx` - TypeScript execution with hot reload
136
- - All type definitions
137
-
138
- ### tsconfig.json
139
- Configured with:
140
- - ESNext modules
141
- - Decorator support
142
- - Strict type checking
143
- - Source maps
144
-
145
- ## NPM Scripts
146
-
147
- Generated projects include:
148
-
149
- ```bash
150
- npm run dev # Start with hot reload (tsx watch)
151
- npm run build # Build for production
152
- npm run start # Run production build
153
- npm run clean # Remove build artifacts
154
- ```
155
-
156
- ## Development Workflow
157
-
158
- ### Interactive Setup (Recommended)
159
-
160
- The CLI provides an interactive setup experience:
161
-
162
- ```bash
163
- # Create project
164
- leanmcp create my-mcp-server
165
-
166
- # The CLI will:
167
- # 1. Create project structure
168
- # 2. Ask if you want to install dependencies (Y/n)
169
- # 3. If yes, ask if you want to start dev server (Y/n)
170
- # 4. If yes, start server with hot reload
171
-
172
- # If you choose "No" to installation:
173
- cd my-mcp-server
174
- npm install
175
- npm run dev
176
- ```
177
-
178
- ### Manual Setup
179
-
180
- If you prefer manual control:
181
-
182
- ```bash
183
- # 1. Create project (answer "No" to prompts)
184
- leanmcp create my-mcp-server
185
-
186
- # 2. Navigate to project
187
- cd my-mcp-server
188
-
189
- # 3. Install dependencies
190
- npm install
191
-
192
- # 4. Start development server
193
- npm run dev
194
-
195
- # 5. Server starts on http://localhost:3001
196
- # - Endpoint: http://localhost:3001/mcp
197
- # - Health check: http://localhost:3001/health
198
- # - Hot reload enabled
199
-
200
- # 6. Edit files in mcp/ directory
201
- # Server automatically reloads on changes
202
- ```
203
-
204
- ## Testing Your Server
205
-
206
- Test with curl:
207
- ```bash
208
- # List available tools
209
- curl http://localhost:3001/mcp \
210
- -X POST \
211
- -H "Content-Type: application/json" \
212
- -d '{
213
- "jsonrpc": "2.0",
214
- "id": 1,
215
- "method": "tools/list"
216
- }'
217
-
218
- # Call a tool
219
- curl http://localhost:3001/mcp \
220
- -X POST \
221
- -H "Content-Type: application/json" \
222
- -d '{
223
- "jsonrpc": "2.0",
224
- "id": 1,
225
- "method": "tools/call",
226
- "params": {
227
- "name": "calculate",
228
- "arguments": {
229
- "a": 10,
230
- "b": 5,
231
- "operation": "add"
232
- }
233
- }
234
- }'
235
- ```
236
-
237
- ## Customizing Generated Projects
238
-
239
- ### Add New Services
240
-
241
- **Quick Way (Recommended):**
242
-
243
- Use the `add` command to automatically generate and register a new service:
244
-
245
- ```bash
246
- leanmcp add weather
247
- ```
248
-
249
- This creates `mcp/weather.ts` with example Tool, Prompt, and Resource decorators, and automatically registers it in `main.ts`.
250
-
251
- **Manual Way:**
252
-
253
- Create a new file in `mcp/`:
254
-
255
- ```typescript
256
- // mcp/weather.ts
257
- import { Tool } from "@leanmcp/core";
258
-
259
- export class WeatherService {
260
- @Tool({ description: 'Get weather for a city' })
261
- async getWeather(input: { city: string }) {
262
- // Your implementation
263
- return { temperature: 72, condition: 'sunny' };
264
- }
265
- }
266
- ```
267
-
268
- Register in `main.ts`:
269
- ```typescript
270
- import { WeatherService } from "./mcp/weather.js";
271
-
272
- server.registerService(new WeatherService());
273
- ```
274
-
275
- ### Add Authentication
276
-
277
- Install auth package:
278
- ```bash
279
- npm install @leanmcp/auth
280
- ```
281
-
282
- See [@leanmcp/auth](../auth) documentation for details.
283
-
284
- ### Configure Port
285
-
286
- Set in environment variable:
287
- ```bash
288
- PORT=4000 npm run dev
289
- ```
290
-
291
- Or in `.env` file:
292
- ```bash
293
- PORT=4000
294
- ```
295
-
296
- ## Advanced Options
297
-
298
- ### Custom Project Location
299
-
300
- ```bash
301
- leanmcp create my-project
302
- cd my-project
303
- ```
304
-
305
- Project is created in current directory with the specified name.
306
-
307
- ### Modify Template
308
-
309
- The generated project is fully customizable:
310
- - Edit `main.ts` for server configuration
311
- - Add/remove services in `mcp/` directory
312
- - Modify `package.json` for additional dependencies
313
- - Update `tsconfig.json` for compiler options
314
-
315
- ## Troubleshooting
316
-
317
- ### Port Already in Use
318
-
319
- Change the port in `.env`:
320
- ```bash
321
- PORT=3002
322
- ```
323
-
324
- ### Module Not Found Errors
325
-
326
- Ensure you've installed dependencies:
327
- ```bash
328
- npm install
329
- ```
330
-
331
- ### TypeScript Errors
332
-
333
- Check your `tsconfig.json` and ensure:
334
- - `experimentalDecorators: true`
335
- - `emitDecoratorMetadata: true`
336
-
337
- ### Hot Reload Not Working
338
-
339
- Try restarting the dev server:
340
- ```bash
341
- npm run dev
342
- ```
343
-
344
- ## Project Types
345
-
346
- Currently supports:
347
- - **MCP Server** - Standard MCP server with HTTP transport
348
-
349
- Coming soon:
350
- - MCP Server with Auth
351
- - MCP Server with Database
352
- - MCP Server with File Storage
353
-
354
- ## Examples
355
-
356
- See the [examples](../../examples) directory for complete working examples:
357
- - [basic-sentiment-tool](../../examples/basic-sentiment-tool) - Simple sentiment analysis
358
- - [slack-with-auth](../../examples/slack-with-auth) - Slack integration with Cognito auth
359
-
360
- ## Requirements
361
-
362
- - Node.js >= 18.0.0
363
- - npm >= 9.0.0
364
-
365
- ## CLI Commands
366
-
367
- ```bash
368
- leanmcp create <name> # Create new project
369
- leanmcp add <service> # Add new service to existing project
370
- leanmcp --version # Show version
371
- leanmcp --help # Show help
372
- ```
373
-
374
- ### Command Details
375
-
376
- #### `create <project-name>`
377
- Creates a complete MCP server project with:
378
- - Entry point (`main.ts`)
379
- - Example service with Tool, Resource, and Prompt decorators
380
- - TypeScript configuration
381
- - Package.json with all dependencies
382
- - Development and build scripts
383
-
384
- **Interactive Prompts:**
385
- - Asks if you want to install dependencies
386
- - If installed, asks if you want to start dev server
387
- - Runs commands in the project directory automatically
388
-
389
- #### `add <service-name>`
390
- Adds a new service to an existing project:
391
- - Must be run inside a LeanMCP project directory
392
- - Creates `mcp/<service-name>.ts` with template code
393
- - Automatically imports and registers in `main.ts`
394
- - Includes example Tool, Prompt, and Resource implementations
395
- - Uses schema validation with `@SchemaConstraint` decorators
396
-
397
- ## 🌟 Showcase Your MCP Server
398
-
399
- Built something cool with LeanMCP? We'd love to feature it!
400
-
401
- ### How to Get Featured
402
-
403
- 1. **Build** an awesome MCP server using LeanMCP
404
- 2. **Share** your project on GitHub
405
- 3. **Submit** for showcase:
406
- - Open an issue: [Request Showcase](https://github.com/LeanMCP/leanmcp-sdk/issues/new?title=[Showcase]%20Your%20Project%20Name)
407
- - Include:
408
- - Project name and description
409
- - GitHub repository link
410
- - What makes it unique
411
- - Screenshots or demo
412
-
413
-
414
- ## License
415
-
416
- MIT
417
-
418
- ## Related Packages
419
-
420
- - [@leanmcp/core](../core) - Core MCP server functionality
421
- - [@leanmcp/auth](../auth) - Authentication decorators
422
- - [@leanmcp/utils](../utils) - Utility functions
423
-
424
- ## Links
425
-
426
- - [GitHub Repository](https://github.com/LeanMCP/leanmcp-sdk)
427
- - [Documentation](https://github.com/LeanMCP/leanmcp-sdk#readme)
428
- - [MCP Specification](https://spec.modelcontextprotocol.io/)
1
+ # @leanmcp/cli
2
+
3
+ Command-line tool for creating LeanMCP projects with production-ready templates.
4
+
5
+ ## Features
6
+
7
+ - **Interactive setup** - Guided prompts for dependency installation and dev server
8
+ - **Quick project scaffolding** - Create new MCP servers in seconds
9
+ - **Complete setup** - Includes TypeScript, dependencies, and configuration
10
+ - **Best practices** - Generated projects follow MCP standards
11
+ - **Ready to run** - Start developing immediately with hot reload
12
+ - **Example service** - Includes working examples to get started
13
+ - **Pure ESM** - Modern ES modules with full TypeScript support
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ # npm
19
+ npm install -g @leanmcp/cli
20
+
21
+ # GitHub Packages
22
+ npm install -g @leanmcp/cli --registry=https://npm.pkg.github.com
23
+ ```
24
+
25
+ Or use without installing:
26
+ ```bash
27
+ npx @leanmcp/cli create my-mcp-server
28
+ ```
29
+
30
+ ## Usage
31
+
32
+ ### Create a New Project
33
+
34
+ ```bash
35
+ leanmcp create <project-name>
36
+ ```
37
+
38
+ Or with npx:
39
+ ```bash
40
+ npx @leanmcp/cli create my-mcp-server
41
+ ```
42
+
43
+ ### Example
44
+
45
+ ```bash
46
+ $ leanmcp create my-sentiment-tool
47
+ ✔ Project my-sentiment-tool created!
48
+
49
+ Success! Your MCP server is ready.
50
+
51
+ Next, navigate to your project:
52
+ cd my-sentiment-tool
53
+
54
+ ? Would you like to install dependencies now? (Y/n) Yes
55
+ ✔ Dependencies installed successfully!
56
+ ? Would you like to start the development server? (Y/n) Yes
57
+
58
+ Starting development server...
59
+
60
+ > my-sentiment-tool@1.0.0 dev
61
+ > tsx watch main.ts
62
+
63
+ [HTTP][INFO] Starting LeanMCP HTTP Server...
64
+ [HTTP][INFO] Server running on http://localhost:3001
65
+ [HTTP][INFO] MCP endpoint: http://localhost:3001/mcp
66
+ ```
67
+
68
+ ### Add a New Service
69
+
70
+ After creating a project, you can quickly add new services:
71
+
72
+ ```bash
73
+ leanmcp add <service-name>
74
+ ```
75
+
76
+ This command:
77
+ - Creates a new service file in `mcp/<service-name>.ts`
78
+ - Includes example Tool, Prompt, and Resource decorators
79
+ - Automatically registers the service in `main.ts`
80
+ - Includes schema validation examples
81
+
82
+ **Example:**
83
+
84
+ ```bash
85
+ $ leanmcp add weather
86
+ ✔ Created new service: weather
87
+ File: mcp/weather.ts
88
+ Tool: greet
89
+ Prompt: welcomePrompt
90
+ Resource: getStatus
91
+
92
+ Service automatically registered in main.ts!
93
+ ```
94
+
95
+ The generated service includes:
96
+ - **Tool** - `greet()`: A callable function with schema validation
97
+ - **Prompt** - `welcomePrompt()`: A reusable prompt template
98
+ - **Resource** - `getStatus()`: A data endpoint
99
+
100
+ You can then customize these to fit your needs.
101
+
102
+ ## Generated Project Structure
103
+
104
+ ```
105
+ my-mcp-server/
106
+ ├── main.ts # Entry point with HTTP server
107
+ ├── package.json # Dependencies and scripts
108
+ ├── tsconfig.json # TypeScript configuration
109
+ └── mcp/ # Services directory
110
+ └── example.ts # Example service with tools
111
+ ```
112
+
113
+ ## Generated Files
114
+
115
+ ### main.ts
116
+ Entry point that:
117
+ - Loads environment variables
118
+ - Creates MCP server instance
119
+ - Registers services
120
+ - Starts HTTP server with session management
121
+
122
+ ### mcp/example.ts
123
+ Example service demonstrating:
124
+ - `@Tool` decorator for callable functions
125
+ - `@Resource` decorator for data sources
126
+ - `@Prompt` decorator for prompt templates
127
+ - Class-based schema validation with `@SchemaConstraint`
128
+ - Input/output type safety
129
+
130
+ ### package.json
131
+ Includes:
132
+ - `@leanmcp/core` - Core MCP functionality
133
+ - `@modelcontextprotocol/sdk` - Official MCP SDK
134
+ - `express` - HTTP server
135
+ - `tsx` - TypeScript execution with hot reload
136
+ - All type definitions
137
+
138
+ ### tsconfig.json
139
+ Configured with:
140
+ - ESNext modules
141
+ - Decorator support
142
+ - Strict type checking
143
+ - Source maps
144
+
145
+ ## NPM Scripts
146
+
147
+ Generated projects include:
148
+
149
+ ```bash
150
+ npm run dev # Start with hot reload (tsx watch)
151
+ npm run build # Build for production
152
+ npm run start # Run production build
153
+ npm run clean # Remove build artifacts
154
+ ```
155
+
156
+ ## Development Workflow
157
+
158
+ ### Interactive Setup (Recommended)
159
+
160
+ The CLI provides an interactive setup experience:
161
+
162
+ ```bash
163
+ # Create project
164
+ leanmcp create my-mcp-server
165
+
166
+ # The CLI will:
167
+ # 1. Create project structure
168
+ # 2. Ask if you want to install dependencies (Y/n)
169
+ # 3. If yes, ask if you want to start dev server (Y/n)
170
+ # 4. If yes, start server with hot reload
171
+
172
+ # If you choose "No" to installation:
173
+ cd my-mcp-server
174
+ npm install
175
+ npm run dev
176
+ ```
177
+
178
+ ### Manual Setup
179
+
180
+ If you prefer manual control:
181
+
182
+ ```bash
183
+ # 1. Create project (answer "No" to prompts)
184
+ leanmcp create my-mcp-server
185
+
186
+ # 2. Navigate to project
187
+ cd my-mcp-server
188
+
189
+ # 3. Install dependencies
190
+ npm install
191
+
192
+ # 4. Start development server
193
+ npm run dev
194
+
195
+ # 5. Server starts on http://localhost:3001
196
+ # - Endpoint: http://localhost:3001/mcp
197
+ # - Health check: http://localhost:3001/health
198
+ # - Hot reload enabled
199
+
200
+ # 6. Edit files in mcp/ directory
201
+ # Server automatically reloads on changes
202
+ ```
203
+
204
+ ## Testing Your Server
205
+
206
+ Test with curl:
207
+ ```bash
208
+ # List available tools
209
+ curl http://localhost:3001/mcp \
210
+ -X POST \
211
+ -H "Content-Type: application/json" \
212
+ -d '{
213
+ "jsonrpc": "2.0",
214
+ "id": 1,
215
+ "method": "tools/list"
216
+ }'
217
+
218
+ # Call a tool
219
+ curl http://localhost:3001/mcp \
220
+ -X POST \
221
+ -H "Content-Type: application/json" \
222
+ -d '{
223
+ "jsonrpc": "2.0",
224
+ "id": 1,
225
+ "method": "tools/call",
226
+ "params": {
227
+ "name": "calculate",
228
+ "arguments": {
229
+ "a": 10,
230
+ "b": 5,
231
+ "operation": "add"
232
+ }
233
+ }
234
+ }'
235
+ ```
236
+
237
+ ## Customizing Generated Projects
238
+
239
+ ### Add New Services
240
+
241
+ **Quick Way (Recommended):**
242
+
243
+ Use the `add` command to automatically generate and register a new service:
244
+
245
+ ```bash
246
+ leanmcp add weather
247
+ ```
248
+
249
+ This creates `mcp/weather.ts` with example Tool, Prompt, and Resource decorators, and automatically registers it in `main.ts`.
250
+
251
+ **Manual Way:**
252
+
253
+ Create a new file in `mcp/`:
254
+
255
+ ```typescript
256
+ // mcp/weather.ts
257
+ import { Tool } from "@leanmcp/core";
258
+
259
+ export class WeatherService {
260
+ @Tool({ description: 'Get weather for a city' })
261
+ async getWeather(input: { city: string }) {
262
+ // Your implementation
263
+ return { temperature: 72, condition: 'sunny' };
264
+ }
265
+ }
266
+ ```
267
+
268
+ Register in `main.ts`:
269
+ ```typescript
270
+ import { WeatherService } from "./mcp/weather.js";
271
+
272
+ server.registerService(new WeatherService());
273
+ ```
274
+
275
+ ### Add Authentication
276
+
277
+ Install auth package:
278
+ ```bash
279
+ npm install @leanmcp/auth
280
+ ```
281
+
282
+ See [@leanmcp/auth](../auth) documentation for details.
283
+
284
+ ### Configure Port
285
+
286
+ Set in environment variable:
287
+ ```bash
288
+ PORT=4000 npm run dev
289
+ ```
290
+
291
+ Or in `.env` file:
292
+ ```bash
293
+ PORT=4000
294
+ ```
295
+
296
+ ## Advanced Options
297
+
298
+ ### Custom Project Location
299
+
300
+ ```bash
301
+ leanmcp create my-project
302
+ cd my-project
303
+ ```
304
+
305
+ Project is created in current directory with the specified name.
306
+
307
+ ### Modify Template
308
+
309
+ The generated project is fully customizable:
310
+ - Edit `main.ts` for server configuration
311
+ - Add/remove services in `mcp/` directory
312
+ - Modify `package.json` for additional dependencies
313
+ - Update `tsconfig.json` for compiler options
314
+
315
+ ## Troubleshooting
316
+
317
+ ### Port Already in Use
318
+
319
+ Change the port in `.env`:
320
+ ```bash
321
+ PORT=3002
322
+ ```
323
+
324
+ ### Module Not Found Errors
325
+
326
+ Ensure you've installed dependencies:
327
+ ```bash
328
+ npm install
329
+ ```
330
+
331
+ ### TypeScript Errors
332
+
333
+ Check your `tsconfig.json` and ensure:
334
+ - `experimentalDecorators: true`
335
+ - `emitDecoratorMetadata: true`
336
+
337
+ ### Hot Reload Not Working
338
+
339
+ Try restarting the dev server:
340
+ ```bash
341
+ npm run dev
342
+ ```
343
+
344
+ ## Project Types
345
+
346
+ Currently supports:
347
+ - **MCP Server** - Standard MCP server with HTTP transport
348
+
349
+ Coming soon:
350
+ - MCP Server with Auth
351
+ - MCP Server with Database
352
+ - MCP Server with File Storage
353
+
354
+ ## Examples
355
+
356
+ See the [examples](../../examples) directory for complete working examples:
357
+ - [basic-sentiment-tool](../../examples/basic-sentiment-tool) - Simple sentiment analysis
358
+ - [slack-with-auth](../../examples/slack-with-auth) - Slack integration with Cognito auth
359
+
360
+ ## Requirements
361
+
362
+ - Node.js >= 18.0.0
363
+ - npm >= 9.0.0
364
+
365
+ ## CLI Commands
366
+
367
+ ```bash
368
+ leanmcp create <name> # Create new project
369
+ leanmcp add <service> # Add new service to existing project
370
+ leanmcp --version # Show version
371
+ leanmcp --help # Show help
372
+ ```
373
+
374
+ ### Command Details
375
+
376
+ #### `create <project-name>`
377
+ Creates a complete MCP server project with:
378
+ - Entry point (`main.ts`)
379
+ - Example service with Tool, Resource, and Prompt decorators
380
+ - TypeScript configuration
381
+ - Package.json with all dependencies
382
+ - Development and build scripts
383
+
384
+ **Interactive Prompts:**
385
+ - Asks if you want to install dependencies
386
+ - If installed, asks if you want to start dev server
387
+ - Runs commands in the project directory automatically
388
+
389
+ #### `add <service-name>`
390
+ Adds a new service to an existing project:
391
+ - Must be run inside a LeanMCP project directory
392
+ - Creates `mcp/<service-name>.ts` with template code
393
+ - Automatically imports and registers in `main.ts`
394
+ - Includes example Tool, Prompt, and Resource implementations
395
+ - Uses schema validation with `@SchemaConstraint` decorators
396
+
397
+ ## 🌟 Showcase Your MCP Server
398
+
399
+ Built something cool with LeanMCP? We'd love to feature it!
400
+
401
+ ### How to Get Featured
402
+
403
+ 1. **Build** an awesome MCP server using LeanMCP
404
+ 2. **Share** your project on GitHub
405
+ 3. **Submit** for showcase:
406
+ - Open an issue: [Request Showcase](https://github.com/LeanMCP/leanmcp-sdk/issues/new?title=[Showcase]%20Your%20Project%20Name)
407
+ - Include:
408
+ - Project name and description
409
+ - GitHub repository link
410
+ - What makes it unique
411
+ - Screenshots or demo
412
+
413
+
414
+ ## License
415
+
416
+ MIT
417
+
418
+ ## Related Packages
419
+
420
+ - [@leanmcp/core](../core) - Core MCP server functionality
421
+ - [@leanmcp/auth](../auth) - Authentication decorators
422
+ - [@leanmcp/utils](../utils) - Utility functions
423
+
424
+ ## Links
425
+
426
+ - [GitHub Repository](https://github.com/LeanMCP/leanmcp-sdk)
427
+ - [Documentation](https://github.com/LeanMCP/leanmcp-sdk#readme)
428
+ - [MCP Specification](https://spec.modelcontextprotocol.io/)
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
@@ -618,11 +618,147 @@ export class ExampleService {
618
618
  }
619
619
  `;
620
620
  await fs5.writeFile(path5.join(targetDir, "mcp", "example", "index.ts"), exampleServiceTs);
621
- const gitignore = `node_modules
622
- dist
623
- .env
624
- .env.local
621
+ const gitignore = `# Logs
622
+ logs
625
623
  *.log
624
+ npm-debug.log*
625
+ yarn-debug.log*
626
+ yarn-error.log*
627
+ lerna-debug.log*
628
+
629
+ # Diagnostic reports (https://nodejs.org/api/report.html)
630
+ report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
631
+
632
+ # Runtime data
633
+ pids
634
+ *.pid
635
+ *.seed
636
+ *.pid.lock
637
+
638
+ # Directory for instrumented libs generated by jscoverage/JSCover
639
+ lib-cov
640
+
641
+ # Coverage directory used by tools like istanbul
642
+ coverage
643
+ *.lcov
644
+
645
+ # nyc test coverage
646
+ .nyc_output
647
+
648
+ # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
649
+ .grunt
650
+
651
+ # Bower dependency directory (https://bower.io/)
652
+ bower_components
653
+
654
+ # node-waf configuration
655
+ .lock-wscript
656
+
657
+ # Compiled binary addons (https://nodejs.org/api/addons.html)
658
+ build/Release
659
+
660
+ # Dependency directories
661
+ node_modules/
662
+ jspm_packages/
663
+
664
+ # Snowpack dependency directory (https://snowpack.dev/)
665
+ web_modules/
666
+
667
+ # TypeScript cache
668
+ *.tsbuildinfo
669
+
670
+ # Optional npm cache directory
671
+ .npm
672
+
673
+ # Optional eslint cache
674
+ .eslintcache
675
+
676
+ # Optional stylelint cache
677
+ .stylelintcache
678
+
679
+ # Optional REPL history
680
+ .node_repl_history
681
+
682
+ # Output of 'npm pack'
683
+ *.tgz
684
+
685
+ # Yarn Integrity file
686
+ .yarn-integrity
687
+
688
+ # dotenv environment variable files
689
+ .env
690
+ .env.*
691
+ !.env.example
692
+
693
+ # parcel-bundler cache (https://parceljs.org/)
694
+ .cache
695
+ .parcel-cache
696
+
697
+ # Next.js build output
698
+ .next
699
+ out
700
+
701
+ # Nuxt.js build / generate output
702
+ .nuxt
703
+ dist
704
+ .output
705
+
706
+ # Gatsby files
707
+ .cache/
708
+ # Comment in the public line in if your project uses Gatsby and not Next.js
709
+ # https://nextjs.org/blog/next-9-1#public-directory-support
710
+ # public
711
+
712
+ # vuepress build output
713
+ .vuepress/dist
714
+
715
+ # vuepress v2.x temp and cache directory
716
+ .temp
717
+ .cache
718
+
719
+ # Sveltekit cache directory
720
+ .svelte-kit/
721
+
722
+ # vitepress build output
723
+ **/.vitepress/dist
724
+
725
+ # vitepress cache directory
726
+ **/.vitepress/cache
727
+
728
+ # Docusaurus cache and generated files
729
+ .docusaurus
730
+
731
+ # Serverless directories
732
+ .serverless/
733
+
734
+ # FuseBox cache
735
+ .fusebox/
736
+
737
+ # DynamoDB Local files
738
+ .dynamodb/
739
+
740
+ # Firebase cache directory
741
+ .firebase/
742
+
743
+ # TernJS port file
744
+ .tern-port
745
+
746
+ # Stores VSCode versions used for testing VSCode extensions
747
+ .vscode-test
748
+
749
+ # yarn v3
750
+ .pnp.*
751
+ .yarn/*
752
+ !.yarn/patches
753
+ !.yarn/plugins
754
+ !.yarn/releases
755
+ !.yarn/sdks
756
+ !.yarn/versions
757
+
758
+ # Vite files
759
+ vite.config.js.timestamp-*
760
+ vite.config.ts.timestamp-*
761
+ .vite/
626
762
  `;
627
763
  const env = `# Server Configuration
628
764
  PORT=3001
package/package.json CHANGED
@@ -1,68 +1,68 @@
1
- {
2
- "name": "@leanmcp/cli",
3
- "version": "0.2.8",
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
- "chalk": "^5.3.0",
33
- "chokidar": "^4.0.0",
34
- "commander": "^12.0.0",
35
- "fs-extra": "^11.2.0",
36
- "glob": "^11.0.0",
37
- "ora": "^8.1.0",
38
- "vite": "^5.4.0",
39
- "vite-plugin-singlefile": "^2.3.0"
40
- },
41
- "devDependencies": {
42
- "@types/fs-extra": "^11.0.4",
43
- "@types/node": "^25.0.2",
44
- "rimraf": "^6.1.2"
45
- },
46
- "repository": {
47
- "type": "git",
48
- "url": "git+https://github.com/LeanMCP/leanmcp-sdk.git",
49
- "directory": "packages/cli"
50
- },
51
- "homepage": "https://github.com/LeanMCP/leanmcp-sdk#readme",
52
- "bugs": {
53
- "url": "https://github.com/LeanMCP/leanmcp-sdk/issues"
54
- },
55
- "keywords": [
56
- "mcp",
57
- "model-context-protocol",
58
- "cli",
59
- "scaffolding",
60
- "generator",
61
- "typescript"
62
- ],
63
- "author": "LeanMCP <admin@leanmcp.com>",
64
- "license": "MIT",
65
- "publishConfig": {
66
- "access": "public"
67
- }
68
- }
1
+ {
2
+ "name": "@leanmcp/cli",
3
+ "version": "0.2.9",
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
+ "chalk": "^5.3.0",
33
+ "chokidar": "^4.0.0",
34
+ "commander": "^12.0.0",
35
+ "fs-extra": "^11.2.0",
36
+ "glob": "^11.0.0",
37
+ "ora": "^8.1.0",
38
+ "vite": "^5.4.0",
39
+ "vite-plugin-singlefile": "^2.3.0"
40
+ },
41
+ "devDependencies": {
42
+ "@types/fs-extra": "^11.0.4",
43
+ "@types/node": "^25.0.2",
44
+ "rimraf": "^6.1.2"
45
+ },
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "git+https://github.com/LeanMCP/leanmcp-sdk.git",
49
+ "directory": "packages/cli"
50
+ },
51
+ "homepage": "https://github.com/LeanMCP/leanmcp-sdk#readme",
52
+ "bugs": {
53
+ "url": "https://github.com/LeanMCP/leanmcp-sdk/issues"
54
+ },
55
+ "keywords": [
56
+ "mcp",
57
+ "model-context-protocol",
58
+ "cli",
59
+ "scaffolding",
60
+ "generator",
61
+ "typescript"
62
+ ],
63
+ "author": "LeanMCP <admin@leanmcp.com>",
64
+ "license": "MIT",
65
+ "publishConfig": {
66
+ "access": "public"
67
+ }
68
+ }