@nitrostack/cli 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/README.md +131 -0
  2. package/dist/commands/build.d.ts +6 -0
  3. package/dist/commands/build.d.ts.map +1 -0
  4. package/dist/commands/build.js +185 -0
  5. package/dist/commands/dev.d.ts +7 -0
  6. package/dist/commands/dev.d.ts.map +1 -0
  7. package/dist/commands/dev.js +365 -0
  8. package/dist/commands/generate-types.d.ts +8 -0
  9. package/dist/commands/generate-types.d.ts.map +1 -0
  10. package/dist/commands/generate-types.js +219 -0
  11. package/dist/commands/generate.d.ts +12 -0
  12. package/dist/commands/generate.d.ts.map +1 -0
  13. package/dist/commands/generate.js +375 -0
  14. package/dist/commands/init.d.ts +7 -0
  15. package/dist/commands/init.d.ts.map +1 -0
  16. package/dist/commands/init.js +324 -0
  17. package/dist/commands/install.d.ts +10 -0
  18. package/dist/commands/install.d.ts.map +1 -0
  19. package/dist/commands/install.js +80 -0
  20. package/dist/commands/start.d.ts +6 -0
  21. package/dist/commands/start.d.ts.map +1 -0
  22. package/dist/commands/start.js +70 -0
  23. package/dist/commands/upgrade.d.ts +10 -0
  24. package/dist/commands/upgrade.d.ts.map +1 -0
  25. package/dist/commands/upgrade.js +214 -0
  26. package/dist/index.d.ts +11 -0
  27. package/dist/index.d.ts.map +1 -0
  28. package/dist/index.js +94 -0
  29. package/dist/mcp-dev-wrapper.d.ts +15 -0
  30. package/dist/mcp-dev-wrapper.d.ts.map +1 -0
  31. package/dist/mcp-dev-wrapper.js +187 -0
  32. package/dist/ui/branding.d.ts +31 -0
  33. package/dist/ui/branding.d.ts.map +1 -0
  34. package/dist/ui/branding.js +136 -0
  35. package/package.json +69 -0
  36. package/templates/typescript-oauth/.env.example +27 -0
  37. package/templates/typescript-oauth/OAUTH_SETUP.md +592 -0
  38. package/templates/typescript-oauth/README.md +263 -0
  39. package/templates/typescript-oauth/package.json +29 -0
  40. package/templates/typescript-oauth/src/app.module.ts +92 -0
  41. package/templates/typescript-oauth/src/guards/oauth.guard.ts +126 -0
  42. package/templates/typescript-oauth/src/health/system.health.ts +55 -0
  43. package/templates/typescript-oauth/src/index.ts +63 -0
  44. package/templates/typescript-oauth/src/modules/flights/booking.tools.ts +323 -0
  45. package/templates/typescript-oauth/src/modules/flights/flights.module.ts +14 -0
  46. package/templates/typescript-oauth/src/modules/flights/flights.prompts.ts +228 -0
  47. package/templates/typescript-oauth/src/modules/flights/flights.resources.ts +215 -0
  48. package/templates/typescript-oauth/src/modules/flights/flights.tools.ts +457 -0
  49. package/templates/typescript-oauth/src/services/duffel.service.ts +285 -0
  50. package/templates/typescript-oauth/src/widgets/app/airport-search/page.tsx +270 -0
  51. package/templates/typescript-oauth/src/widgets/app/flight-details/page.tsx +261 -0
  52. package/templates/typescript-oauth/src/widgets/app/flight-search-results/page.tsx +378 -0
  53. package/templates/typescript-oauth/src/widgets/app/globals.css +167 -0
  54. package/templates/typescript-oauth/src/widgets/app/layout.tsx +18 -0
  55. package/templates/typescript-oauth/src/widgets/app/order-cancellation/page.tsx +207 -0
  56. package/templates/typescript-oauth/src/widgets/app/order-summary/page.tsx +245 -0
  57. package/templates/typescript-oauth/src/widgets/app/payment-confirmation/page.tsx +152 -0
  58. package/templates/typescript-oauth/src/widgets/app/seat-selection/page.tsx +486 -0
  59. package/templates/typescript-oauth/src/widgets/next-env.d.ts +5 -0
  60. package/templates/typescript-oauth/src/widgets/next.config.js +45 -0
  61. package/templates/typescript-oauth/src/widgets/package-lock.json +4493 -0
  62. package/templates/typescript-oauth/src/widgets/package.json +24 -0
  63. package/templates/typescript-oauth/src/widgets/tsconfig.json +28 -0
  64. package/templates/typescript-oauth/src/widgets/widget-manifest.json +395 -0
  65. package/templates/typescript-oauth/tsconfig.json +23 -0
  66. package/templates/typescript-pizzaz/README.md +252 -0
  67. package/templates/typescript-pizzaz/package.json +34 -0
  68. package/templates/typescript-pizzaz/src/app.module.ts +28 -0
  69. package/templates/typescript-pizzaz/src/index.ts +30 -0
  70. package/templates/typescript-pizzaz/src/modules/pizzaz/pizzaz.data.ts +106 -0
  71. package/templates/typescript-pizzaz/src/modules/pizzaz/pizzaz.module.ts +11 -0
  72. package/templates/typescript-pizzaz/src/modules/pizzaz/pizzaz.service.ts +60 -0
  73. package/templates/typescript-pizzaz/src/modules/pizzaz/pizzaz.tools.ts +197 -0
  74. package/templates/typescript-pizzaz/src/widgets/app/layout.tsx +18 -0
  75. package/templates/typescript-pizzaz/src/widgets/app/pizza-list/page.tsx +272 -0
  76. package/templates/typescript-pizzaz/src/widgets/app/pizza-map/page.tsx +216 -0
  77. package/templates/typescript-pizzaz/src/widgets/app/pizza-shop/page.tsx +374 -0
  78. package/templates/typescript-pizzaz/src/widgets/components/CompactShopCard.tsx +144 -0
  79. package/templates/typescript-pizzaz/src/widgets/components/PizzaCard.tsx +191 -0
  80. package/templates/typescript-pizzaz/src/widgets/next.config.js +45 -0
  81. package/templates/typescript-pizzaz/src/widgets/package.json +30 -0
  82. package/templates/typescript-pizzaz/src/widgets/tsconfig.json +28 -0
  83. package/templates/typescript-pizzaz/src/widgets/widget-manifest.json +253 -0
  84. package/templates/typescript-pizzaz/tsconfig.json +30 -0
  85. package/templates/typescript-starter/README.md +320 -0
  86. package/templates/typescript-starter/package.json +25 -0
  87. package/templates/typescript-starter/src/app.module.ts +34 -0
  88. package/templates/typescript-starter/src/health/system.health.ts +55 -0
  89. package/templates/typescript-starter/src/index.ts +29 -0
  90. package/templates/typescript-starter/src/modules/calculator/calculator.module.ts +12 -0
  91. package/templates/typescript-starter/src/modules/calculator/calculator.prompts.ts +73 -0
  92. package/templates/typescript-starter/src/modules/calculator/calculator.resources.ts +59 -0
  93. package/templates/typescript-starter/src/modules/calculator/calculator.tools.ts +166 -0
  94. package/templates/typescript-starter/src/widgets/app/calculator-result/page.tsx +180 -0
  95. package/templates/typescript-starter/src/widgets/app/layout.tsx +18 -0
  96. package/templates/typescript-starter/src/widgets/next.config.js +45 -0
  97. package/templates/typescript-starter/src/widgets/package.json +24 -0
  98. package/templates/typescript-starter/src/widgets/tsconfig.json +28 -0
  99. package/templates/typescript-starter/src/widgets/widget-manifest.json +48 -0
  100. package/templates/typescript-starter/tsconfig.json +23 -0
@@ -0,0 +1,253 @@
1
+ {
2
+ "version": "1.0.0",
3
+ "widgets": [
4
+ {
5
+ "uri": "/pizza-map",
6
+ "name": "Pizza Map",
7
+ "description": "Interactive map showing pizza shop locations",
8
+ "examples": [
9
+ {
10
+ "name": "All Shops",
11
+ "description": "Display all pizza shops on the map",
12
+ "data": {
13
+ "shops": [
14
+ {
15
+ "id": "tonys-pizza",
16
+ "name": "Tony's New York Pizza",
17
+ "description": "Authentic New York-style pizza with a crispy thin crust",
18
+ "address": "1570 Stockton St, San Francisco, CA 94133",
19
+ "coords": [
20
+ -122.4106,
21
+ 37.8006
22
+ ],
23
+ "rating": 4.5,
24
+ "reviews": 1250,
25
+ "priceLevel": 2,
26
+ "cuisine": [
27
+ "Italian",
28
+ "Pizza",
29
+ "New York Style"
30
+ ],
31
+ "hours": {
32
+ "open": "11:00 AM",
33
+ "close": "10:00 PM"
34
+ },
35
+ "phone": "(415) 835-9888",
36
+ "website": "https://tonyspizzasf.com",
37
+ "image": "https://images.unsplash.com/photo-1513104890138-7c749659a591",
38
+ "specialties": [
39
+ "Margherita",
40
+ "Pepperoni",
41
+ "White Pizza"
42
+ ],
43
+ "openNow": true
44
+ },
45
+ {
46
+ "id": "bella-napoli",
47
+ "name": "Bella Napoli",
48
+ "description": "Traditional Neapolitan pizza baked in a wood-fired oven",
49
+ "address": "3854 Geary Blvd, San Francisco, CA 94118",
50
+ "coords": [
51
+ -122.4603,
52
+ 37.7808
53
+ ],
54
+ "rating": 4.7,
55
+ "reviews": 890,
56
+ "priceLevel": 3,
57
+ "cuisine": [
58
+ "Italian",
59
+ "Pizza",
60
+ "Neapolitan"
61
+ ],
62
+ "hours": {
63
+ "open": "12:00 PM",
64
+ "close": "9:00 PM"
65
+ },
66
+ "phone": "(415) 221-0305",
67
+ "image": "https://images.unsplash.com/photo-1574071318508-1cdbab80d002",
68
+ "specialties": [
69
+ "Marinara",
70
+ "Quattro Formaggi",
71
+ "Prosciutto e Funghi"
72
+ ],
73
+ "openNow": true
74
+ }
75
+ ],
76
+ "filter": "all",
77
+ "totalShops": 2
78
+ }
79
+ }
80
+ ],
81
+ "tags": [
82
+ "map",
83
+ "location",
84
+ "interactive"
85
+ ]
86
+ },
87
+ {
88
+ "uri": "/pizza-list",
89
+ "name": "Pizza List",
90
+ "description": "List view of pizza shops with filtering and sorting",
91
+ "examples": [
92
+ {
93
+ "name": "All Shops List",
94
+ "description": "Display all shops in a list",
95
+ "data": {
96
+ "shops": [
97
+ {
98
+ "id": "tonys-pizza",
99
+ "name": "Tony's New York Pizza",
100
+ "description": "Authentic New York-style pizza with a crispy thin crust",
101
+ "address": "1570 Stockton St, San Francisco, CA 94133",
102
+ "coords": [
103
+ -122.4106,
104
+ 37.8006
105
+ ],
106
+ "rating": 4.5,
107
+ "reviews": 1250,
108
+ "priceLevel": 2,
109
+ "cuisine": [
110
+ "Italian",
111
+ "Pizza",
112
+ "New York Style"
113
+ ],
114
+ "hours": {
115
+ "open": "11:00 AM",
116
+ "close": "10:00 PM"
117
+ },
118
+ "phone": "(415) 835-9888",
119
+ "website": "https://tonyspizzasf.com",
120
+ "image": "https://images.unsplash.com/photo-1513104890138-7c749659a591",
121
+ "specialties": [
122
+ "Margherita",
123
+ "Pepperoni",
124
+ "White Pizza"
125
+ ],
126
+ "openNow": true
127
+ },
128
+ {
129
+ "id": "bella-napoli",
130
+ "name": "Bella Napoli",
131
+ "description": "Traditional Neapolitan pizza baked in a wood-fired oven",
132
+ "address": "3854 Geary Blvd, San Francisco, CA 94118",
133
+ "coords": [
134
+ -122.4603,
135
+ 37.7808
136
+ ],
137
+ "rating": 4.7,
138
+ "reviews": 890,
139
+ "priceLevel": 3,
140
+ "cuisine": [
141
+ "Italian",
142
+ "Pizza",
143
+ "Neapolitan"
144
+ ],
145
+ "hours": {
146
+ "open": "12:00 PM",
147
+ "close": "9:00 PM"
148
+ },
149
+ "phone": "(415) 221-0305",
150
+ "image": "https://images.unsplash.com/photo-1574071318508-1cdbab80d002",
151
+ "specialties": [
152
+ "Marinara",
153
+ "Quattro Formaggi",
154
+ "Prosciutto e Funghi"
155
+ ],
156
+ "openNow": true
157
+ }
158
+ ],
159
+ "filters": {},
160
+ "totalShops": 2
161
+ }
162
+ }
163
+ ],
164
+ "tags": [
165
+ "list",
166
+ "filter",
167
+ "sort"
168
+ ]
169
+ },
170
+ {
171
+ "uri": "/pizza-shop",
172
+ "name": "Pizza Shop Details",
173
+ "description": "Detailed information about a specific pizza shop",
174
+ "examples": [
175
+ {
176
+ "name": "Shop Detail",
177
+ "description": "Show details for a specific shop",
178
+ "data": {
179
+ "shop": {
180
+ "id": "tonys-pizza",
181
+ "name": "Tony's New York Pizza",
182
+ "description": "Authentic New York-style pizza with a crispy thin crust",
183
+ "address": "1570 Stockton St, San Francisco, CA 94133",
184
+ "coords": [
185
+ -122.4106,
186
+ 37.8006
187
+ ],
188
+ "rating": 4.5,
189
+ "reviews": 1250,
190
+ "priceLevel": 2,
191
+ "cuisine": [
192
+ "Italian",
193
+ "Pizza",
194
+ "New York Style"
195
+ ],
196
+ "hours": {
197
+ "open": "11:00 AM",
198
+ "close": "10:00 PM"
199
+ },
200
+ "phone": "(415) 835-9888",
201
+ "website": "https://tonyspizzasf.com",
202
+ "image": "https://images.unsplash.com/photo-1513104890138-7c749659a591",
203
+ "specialties": [
204
+ "Margherita",
205
+ "Pepperoni",
206
+ "White Pizza"
207
+ ],
208
+ "openNow": true
209
+ },
210
+ "relatedShops": [
211
+ {
212
+ "id": "bella-napoli",
213
+ "name": "Bella Napoli",
214
+ "description": "Traditional Neapolitan pizza baked in a wood-fired oven",
215
+ "address": "3854 Geary Blvd, San Francisco, CA 94118",
216
+ "coords": [
217
+ -122.4603,
218
+ 37.7808
219
+ ],
220
+ "rating": 4.7,
221
+ "reviews": 890,
222
+ "priceLevel": 3,
223
+ "cuisine": [
224
+ "Italian",
225
+ "Pizza",
226
+ "Neapolitan"
227
+ ],
228
+ "hours": {
229
+ "open": "12:00 PM",
230
+ "close": "9:00 PM"
231
+ },
232
+ "phone": "(415) 221-0305",
233
+ "image": "https://images.unsplash.com/photo-1574071318508-1cdbab80d002",
234
+ "specialties": [
235
+ "Marinara",
236
+ "Quattro Formaggi",
237
+ "Prosciutto e Funghi"
238
+ ],
239
+ "openNow": true
240
+ }
241
+ ]
242
+ }
243
+ }
244
+ ],
245
+ "tags": [
246
+ "detail",
247
+ "info",
248
+ "contact"
249
+ ]
250
+ }
251
+ ],
252
+ "generatedAt": "2025-12-03T00:00:00.000Z"
253
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ES2022",
5
+ "lib": [
6
+ "ES2022"
7
+ ],
8
+ "moduleResolution": "node",
9
+ "rootDir": "./src",
10
+ "outDir": "./dist",
11
+ "esModuleInterop": true,
12
+ "forceConsistentCasingInFileNames": true,
13
+ "strict": true,
14
+ "skipLibCheck": true,
15
+ "resolveJsonModule": true,
16
+ "declaration": true,
17
+ "declarationMap": true,
18
+ "sourceMap": true,
19
+ "experimentalDecorators": true,
20
+ "emitDecoratorMetadata": true
21
+ },
22
+ "include": [
23
+ "src/**/*"
24
+ ],
25
+ "exclude": [
26
+ "node_modules",
27
+ "dist",
28
+ "src/widgets"
29
+ ]
30
+ }
@@ -0,0 +1,320 @@
1
+ # NitroStack Starter Template
2
+
3
+ **The simple starter template** - Learn NitroStack fundamentals with a clean calculator example.
4
+
5
+ ## 🎯 What's Inside
6
+
7
+ This template demonstrates core NitroStack features:
8
+
9
+ - **One Module** - Calculator module with all features
10
+ - **One Tool** - `calculate` - Perform arithmetic operations
11
+ - **One Resource** - `calculator://operations` - List of operations
12
+ - **One Prompt** - `calculator_help` - Get usage help
13
+ - **Two Widgets** - Beautiful UI for results and operations list
14
+ - **No Authentication** - Focus on learning the basics
15
+ - **No Database** - Pure computation example
16
+
17
+ ## 🚀 Quick Start
18
+
19
+ ### Prerequisites
20
+
21
+ ```bash
22
+ # Install NitroStack CLI globally
23
+ npm install -g nitrostack
24
+
25
+ # Or use npx
26
+ npx nitrostack --version
27
+ ```
28
+
29
+ ### Setup Your Project
30
+
31
+ ```bash
32
+ # Create a new project
33
+ nitrostack init my-calculator --template typescript-starter
34
+ cd my-calculator
35
+
36
+ # Install all dependencies (root + widgets)
37
+ nitrostack install
38
+ ```
39
+
40
+ That's it! The CLI automatically:
41
+ - ✅ Installs all root dependencies
42
+ - ✅ Installs widget dependencies
43
+ - ✅ Sets up the project structure
44
+
45
+ ### Run the Project
46
+
47
+ ```bash
48
+ npm run dev
49
+ ```
50
+
51
+ This starts:
52
+ - **MCP Server** (dual transport: STDIO + HTTP) - Hot reloads on code changes
53
+ - **Studio** on http://localhost:3000 - Visual testing environment
54
+ - **Widget Dev Server** on http://localhost:3001 - Hot module replacement
55
+
56
+ > 💡 **Dual Transport**: Your server exposes tools via both STDIO (for direct connections) and HTTP (for remote access). Switch between transports in Studio → Settings.
57
+
58
+ The `nitrostack dev` command handles everything automatically:
59
+ - ✅ Auto-detects widget directory
60
+ - ✅ Installs dependencies (if needed)
61
+ - ✅ Builds widgets (on first run)
62
+ - ✅ Starts all services concurrently
63
+ - ✅ Hot reload for TypeScript and widgets
64
+
65
+ ## 📁 Project Structure
66
+
67
+ ```
68
+ src/
69
+ ├── modules/
70
+ │ └── calculator/
71
+ │ ├── calculator.module.ts # @Module definition
72
+ │ ├── calculator.tools.ts # @Tool with examples
73
+ │ ├── calculator.resources.ts # @Resource
74
+ │ └── calculator.prompts.ts # @Prompt
75
+ ├── widgets/ # Next.js UI widgets
76
+ │ └── app/
77
+ │ ├── calculator-result/ # Tool result widget
78
+ │ └── calculator-operations/ # Resource widget
79
+ ├── app.module.ts # Root @McpApp module
80
+ └── index.ts # Application bootstrap
81
+ ```
82
+
83
+ ## 🛠️ Available Features
84
+
85
+ ### Health Check: `system`
86
+
87
+ Monitors server health and resources:
88
+
89
+ - **Uptime**: Server running time
90
+ - **Memory Usage**: Heap memory consumption
91
+ - **Process Info**: PID and Node.js version
92
+ - **Status**: `up`, `degraded`, or `down`
93
+
94
+ Check health status in Studio's Health Checks tab!
95
+
96
+ ### Tool: `calculate`
97
+
98
+ Perform basic arithmetic operations:
99
+
100
+ ```typescript
101
+ @Tool({
102
+ name: 'calculate',
103
+ description: 'Perform basic arithmetic calculations',
104
+ inputSchema: z.object({
105
+ operation: z.enum(['add', 'subtract', 'multiply', 'divide']),
106
+ a: z.number(),
107
+ b: z.number()
108
+ }),
109
+ examples: {
110
+ request: { operation: 'add', a: 5, b: 3 },
111
+ response: { result: 8, expression: '5 + 3 = 8' }
112
+ }
113
+ })
114
+ ```
115
+
116
+ **Usage:**
117
+ ```
118
+ User: "Calculate 5 + 3"
119
+ AI: [Calls calculate tool]
120
+ Result: Beautiful widget showing "5 + 3 = 8"
121
+ ```
122
+
123
+ ### Resource: `calculator://operations`
124
+
125
+ Lists all available operations with examples.
126
+
127
+ ### Prompt: `calculator_help`
128
+
129
+ Get help on how to use the calculator.
130
+
131
+ ## 🎨 Widgets
132
+
133
+ ### Calculator Result Widget
134
+ - Gradient background
135
+ - Operation icon
136
+ - Breakdown of numbers
137
+ - Beautiful animations
138
+
139
+ ### Calculator Operations Widget
140
+ - Grid of all operations
141
+ - Color-coded by type
142
+ - Examples for each operation
143
+
144
+ ## 💡 Learning Path
145
+
146
+ This template is perfect for learning:
147
+
148
+ 1. **Module Organization** - How to structure a feature module
149
+ 2. **Tools** - How to create a tool with `@Tool` decorator
150
+ 3. **Resources** - How to expose data with `@Resource`
151
+ 4. **Prompts** - How to create conversation templates
152
+ 5. **Widgets** - How to build UI components
153
+ 6. **Examples** - How to include request/response examples
154
+ 7. **Validation** - How to use Zod schemas
155
+
156
+ ## 🔧 Commands
157
+
158
+ ```bash
159
+ # Installation
160
+ npm install # Install all dependencies (root + widgets)
161
+ nitrostack install # Same as above
162
+
163
+ # Development
164
+ npm run dev # Start dev server with Studio
165
+ npm run build # Build TypeScript and widgets for production
166
+ npm start # Run production server
167
+
168
+ # Upgrade
169
+ npm run upgrade # Upgrade nitrostack to latest version
170
+
171
+ # Widget Management
172
+ npm run widget <command> # Run npm command in widgets directory
173
+ npm run widget add <pkg> # Add a widget dependency (e.g., @mui/material)
174
+ ```
175
+
176
+ ## 📝 Example Interactions
177
+
178
+ ### Basic Calculation
179
+ ```
180
+ User: "What's 12 times 8?"
181
+ AI: Calls calculate(operation="multiply", a=12, b=8)
182
+ Result: Widget showing "12 × 8 = 96"
183
+ ```
184
+
185
+ ### Get Help
186
+ ```
187
+ User: "How do I use the calculator?"
188
+ AI: Uses calculator_help prompt
189
+ Result: Complete usage instructions
190
+ ```
191
+
192
+ ### List Operations
193
+ ```
194
+ User: "What operations are available?"
195
+ AI: Fetches calculator://operations resource
196
+ Result: Widget showing all 4 operations with examples
197
+ ```
198
+
199
+ ## 🎓 Code Walkthrough
200
+
201
+ ### 1. Tool Definition
202
+
203
+ ```typescript
204
+ @Tool({
205
+ name: 'calculate',
206
+ description: 'Perform basic arithmetic calculations',
207
+ inputSchema: z.object({...}),
208
+ examples: {...}
209
+ })
210
+ @Widget('calculator-result') // Link UI widget
211
+ async calculate(input: any, ctx: ExecutionContext) {
212
+ // Your logic here
213
+ return { result, expression };
214
+ }
215
+ ```
216
+
217
+ **Key Points:**
218
+ - `@Tool` decorator defines the tool
219
+ - `inputSchema` validates input with Zod
220
+ - `examples` help AI understand usage
221
+ - `@Widget` links the UI component
222
+ - `ExecutionContext` provides logger, metadata
223
+
224
+ ### 2. Resource Definition
225
+
226
+ ```typescript
227
+ @Resource({
228
+ uri: 'calculator://operations',
229
+ name: 'Calculator Operations',
230
+ mimeType: 'application/json',
231
+ examples: {...}
232
+ })
233
+ @Widget('calculator-operations')
234
+ async getOperations(uri: string, ctx: ExecutionContext) {
235
+ return { contents: [{...}] };
236
+ }
237
+ ```
238
+
239
+ ### 3. Prompt Definition
240
+
241
+ ```typescript
242
+ @Prompt({
243
+ name: 'calculator_help',
244
+ arguments: [...]
245
+ })
246
+ async getHelp(args: any, ctx: ExecutionContext) {
247
+ return { messages: [...] };
248
+ }
249
+ ```
250
+
251
+ ### 4. Module Definition
252
+
253
+ ```typescript
254
+ @Module({
255
+ name: 'calculator',
256
+ controllers: [CalculatorTools, CalculatorResources, CalculatorPrompts]
257
+ })
258
+ export class CalculatorModule {}
259
+ ```
260
+
261
+ ### 5. Root Module
262
+
263
+ ```typescript
264
+ @McpApp({
265
+ server: { name: 'calculator-server', version: '1.0.0' }
266
+ })
267
+ @Module({
268
+ imports: [ConfigModule.forRoot(), CalculatorModule]
269
+ })
270
+ export class AppModule {}
271
+ ```
272
+
273
+ ## 🚀 Extend This Template
274
+
275
+ ### Add More Operations
276
+
277
+ Edit `calculator.tools.ts` and add new operations to the enum and switch statement.
278
+
279
+ ### Add History Feature
280
+
281
+ 1. Create a service to store calculations
282
+ 2. Add a `get_history` tool
283
+ 3. Create a history widget
284
+
285
+ ### Add More Modules
286
+
287
+ ```bash
288
+ nitrostack generate module converter
289
+ ```
290
+
291
+ ## 📚 Next Steps
292
+
293
+ Once you understand this template:
294
+
295
+ 1. Try the **Pizza Shop Template** - Interactive maps and widgets
296
+ 2. Try the **Flight Booking Template** - API integration with Duffel
297
+ 3. Read the [NitroStack Documentation](https://nitrostack.ai/docs)
298
+
299
+ ## 💡 Tips
300
+
301
+ - **Keep it Simple** - This template shows the minimum needed
302
+ - **Study the Code** - Each file has clear examples
303
+ - **Test in Studio** - Use the chat to test your tools
304
+ - **Check Examples** - The `examples` field helps AI understand your tools
305
+
306
+ ## 🎉 What to Build
307
+
308
+ Use this as a starting point for:
309
+
310
+ - **Unit Converters** - Temperature, currency, etc.
311
+ - **Text Tools** - String manipulation, formatting
312
+ - **Data Processors** - JSON, CSV, XML parsing
313
+ - **Simple APIs** - Weather, jokes, facts
314
+ - **Utilities** - Date/time, UUID generation
315
+
316
+ ---
317
+
318
+ **Happy Learning! 📖**
319
+
320
+ Start simple, learn the patterns, then build something amazing!
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "nitrostack-starter",
3
+ "version": "1.0.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "description": "NitroStack starter template - Learn MCP server basics with a simple calculator example",
7
+ "scripts": {
8
+ "dev": "nitrostack-cli dev",
9
+ "build": "nitrostack-cli build",
10
+ "start": "npm run build && nitrostack-cli start",
11
+ "start:prod": "nitrostack-cli start",
12
+ "upgrade": "nitrostack-cli upgrade",
13
+ "install:all": "nitrostack-cli install",
14
+ "widget": "npm --prefix src/widgets"
15
+ },
16
+ "dependencies": {
17
+ "dotenv": "^16.3.1",
18
+ "nitrostack": "^1",
19
+ "zod": "^3.22.4"
20
+ },
21
+ "devDependencies": {
22
+ "@nitrostack/cli": "^1",
23
+ "typescript": "^5.3.3"
24
+ }
25
+ }
@@ -0,0 +1,34 @@
1
+ import { McpApp, Module, ConfigModule } from 'nitrostack';
2
+ import { CalculatorModule } from './modules/calculator/calculator.module.js';
3
+ import { SystemHealthCheck } from './health/system.health.js';
4
+
5
+ /**
6
+ * Root Application Module
7
+ *
8
+ * This is the main module that bootstraps the MCP server.
9
+ * It registers all feature modules and health checks.
10
+ */
11
+ @McpApp({
12
+ module: AppModule,
13
+ server: {
14
+ name: 'calculator-server',
15
+ version: '1.0.0'
16
+ },
17
+ logging: {
18
+ level: 'info'
19
+ }
20
+ })
21
+ @Module({
22
+ name: 'app',
23
+ description: 'Root application module',
24
+ imports: [
25
+ ConfigModule.forRoot(),
26
+ CalculatorModule
27
+ ],
28
+ providers: [
29
+ // Health Checks
30
+ SystemHealthCheck,
31
+ ]
32
+ })
33
+ export class AppModule {}
34
+