caspian-utils 0.0.9 → 0.0.11

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.
@@ -1,12 +1,13 @@
1
1
  ---
2
2
  title: Commands
3
- description: Use this Caspian CLI reference to choose the right create, starter-kit, update, and Prisma-to-Python ORM regeneration flow for the current workspace.
3
+ description: Use the current Caspian CLI reference to choose the right scaffold, starter-kit, update, and Prisma regeneration workflow for the current workspace.
4
4
  related:
5
5
  title: Related docs
6
- description: Start with installation for new apps, then use database and structure docs when commands affect schema, generated ORM files, or project layout.
6
+ description: Start with installation for new apps, then use database, MCP, and structure docs when commands affect schema, server tooling, generated ORM files, or project layout.
7
7
  links:
8
8
  - /docs/installation
9
9
  - /docs/database
10
+ - /docs/mcp
10
11
  - /docs/routing
11
12
  - /docs/project-structure
12
13
  - /docs/index
@@ -18,56 +19,155 @@ This page documents the current Caspian command families used with this workspac
18
19
 
19
20
  The current workspace includes a local `prisma` binary, but it does not include local `create-caspian-app`, `casp`, or `ppy` binaries under `node_modules/.bin`. Treat project creation, project update, and Python ORM generation as external `npx` workflows rather than project-local executables.
20
21
 
21
- Examples below use the bare package name for readability. If you want to force the latest published scaffold package, you can add `@latest`, for example `npx create-caspian-app@latest my-app`.
22
+ The current workspace also includes a local MCP run path through `npm run mcp`, which starts the app-owned FastMCP server via `settings/restart-mcp.ts`.
22
23
 
23
- Use these command families for different tasks:
24
+ Examples below use `npx create-caspian-app` for readability. If you want to force the latest published scaffold package explicitly, you can use `npx create-caspian-app@latest` instead.
24
25
 
25
- | Task | Command | When to use |
26
- | --- | --- | --- |
27
- | Create a new project | `npx create-caspian-app my-app` | First-time scaffold for a brand new Caspian app. |
28
- | Update an existing project | `npx casp update project` | Refresh framework-managed files inside an existing Caspian project. |
29
- | Create from a starter kit | `npx create-caspian-app my-app --starter-kit=fullstack` | Start from a built-in or custom template instead of the default scaffold. |
30
- | List starter kits | `npx create-caspian-app --list-starter-kits` | Inspect the starter catalog before choosing a preset. |
31
- | Regenerate ORM after schema change | `npx prisma migrate dev` then optional seed commands, then `npx ppy generate` | Keep Prisma migrations, seed flow, and generated Python ORM files aligned after `prisma/schema.prisma` changes. |
26
+ This updated reference includes the newer updater behavior and the current scaffold behavior:
27
+
28
+ - positional version or tag values such as `beta` or `1.2.3`
29
+ - named options such as `--tag beta`, `--tag=beta`, `--version 1.2.3`, and `--version=1.2.3`
30
+ - conflict detection when more than one version source is provided
31
+ - PowerShell-safe tagging syntax with `--tag beta`
32
+ - Windows-safe execution that resolves `npx.cmd` on Win32
33
+ - scaffold behavior that reuses an existing `.venv` instead of recreating it every time
34
+
35
+ Before running update commands, read `caspian.config.json` because it controls feature flags and `excludeFiles` overwrite protection. In the current workspace that config shows `backendOnly: false`, `tailwindcss: true`, `mcp: true`, `prisma: true`, `typescript: false`, and `componentScanDirs: ["src"]`.
36
+
37
+ ## 1. Main Command Families
38
+
39
+ ### Create a new project
40
+
41
+ ```bash
42
+ npx create-caspian-app my-app
43
+ ```
44
+
45
+ Use when you want to scaffold a new Caspian project from scratch.
46
+
47
+ ### Create a project from a starter kit
48
+
49
+ ```bash
50
+ npx create-caspian-app my-app --starter-kit=fullstack
51
+ npx create-caspian-app my-app --starter-kit=custom --starter-kit-source=https://github.com/user/repo
52
+ ```
53
+
54
+ Use when you want a preset structure instead of the blank default scaffold.
55
+
56
+ ### List available starter kits
57
+
58
+ ```bash
59
+ npx create-caspian-app --list-starter-kits
60
+ ```
61
+
62
+ Use when you want to inspect the built-in starter kits before choosing one.
63
+
64
+ ### Update an existing project
65
+
66
+ ```bash
67
+ npx casp update project
68
+ ```
69
+
70
+ Use when you are inside an existing Caspian project and want to refresh framework-managed files using the project's `caspian.config.json`.
71
+
72
+ ### Run the local MCP server
73
+
74
+ ```bash
75
+ npm run mcp
76
+ ```
77
+
78
+ Use when you want the workspace's app-owned FastMCP server only.
79
+
80
+ ### Run the full local stack including MCP
81
+
82
+ ```bash
83
+ npm run dev
84
+ ```
85
+
86
+ Use when you want BrowserSync, Tailwind, the Python app server, and MCP together.
87
+
88
+ ### Inspect the local MCP config directly
89
+
90
+ ```powershell
91
+ .venv\Scripts\fastmcp.exe inspect src/lib/mcp/fastmcp.json
92
+ ```
93
+
94
+ Use when you are debugging the nested FastMCP config or checking which tools the current MCP server exposes.
95
+
96
+ ### Run FastMCP directly with the nested config
97
+
98
+ ```powershell
99
+ .venv\Scripts\fastmcp.exe run src/lib/mcp/fastmcp.json --no-banner
100
+ ```
101
+
102
+ Use when you want the raw FastMCP path without the npm wrapper.
103
+
104
+ ### Regenerate ORM after schema changes
105
+
106
+ ```bash
107
+ npx prisma migrate dev
108
+
109
+ # If the change requires refreshed seed data:
110
+ npx prisma generate
111
+ npx prisma db seed
112
+
113
+ npx ppy generate
114
+ ```
115
+
116
+ Use when `prisma/schema.prisma` changes and you need migrations, seed flow, and the generated Python ORM layer to stay aligned.
32
117
 
33
- Before running `npx casp update project`, read `caspian.config.json` because it controls feature flags and `excludeFiles` overwrite protection. Before running Prisma or `ppy` commands, read [database.md](./database.md).
118
+ Because this workspace keeps `fastmcp.json` under `src/lib/mcp/`, plain `fastmcp run` from the project root does not auto-detect the config. Use `npm run mcp` or pass the explicit config path.
34
119
 
35
- ## Supported Flags
120
+ ## 2. Supported Flags And Options
36
121
 
37
- The scaffold CLI exposes these feature flags:
122
+ ### For `create-caspian-app`
38
123
 
39
124
  | Flag | Meaning | When to use |
40
125
  | --- | --- | --- |
41
- | `-y` | Non-interactive mode | Use in CI, automation, or scripted setup. |
42
- | `--backend-only` | Backend-only project | Use for APIs, services, or apps with no browser UI. |
43
- | `--tailwindcss` | Enable Tailwind CSS | Use for frontend or full-stack styling. |
44
- | `--typescript` | Enable TypeScript frontend tooling | Use when you want frontend TypeScript assets. |
45
- | `--mcp` | Enable MCP support | Use when the app needs Model Context Protocol support. |
46
- | `--prisma` | Enable Prisma setup | Use when the app needs schema, migration, and ORM tooling. |
47
- | `--starter-kit=<kit>` | Use a built-in or named starter kit | Use to bootstrap from a preset instead of the default scaffold. |
48
- | `--starter-kit-source=<url>` | Pull a starter kit from a Git source | Use when the starter kit lives in an external repository. |
126
+ | `-y` | Non-interactive mode | Use in scripts, CI, or when you want to skip prompts. |
127
+ | `--backend-only` | Backend-only project | Use for APIs or services without frontend assets. |
128
+ | `--tailwindcss` | Enable Tailwind CSS | Use for frontend or full-stack UI styling. |
129
+ | `--typescript` | Enable TypeScript frontend tooling | Use when you want the scaffold's TypeScript frontend path. |
130
+ | `--mcp` | Enable MCP support | Use when the project needs Model Context Protocol support. |
131
+ | `--prisma` | Enable Prisma-related setup | Use when the project needs ORM and database tooling. |
132
+ | `--starter-kit=<kit>` | Select a starter kit | Use when you want a built-in preset or named kit. |
133
+ | `--starter-kit-source=<url>` | External starter kit source | Use when the starter kit lives in a Git repository. |
134
+ | `--list-starter-kits` | List built-in starter kits | Use when you want to inspect the starter catalog before scaffold. |
135
+
136
+ ### For `npx casp update project`
137
+
138
+ | Option | Meaning | When to use |
139
+ | --- | --- | --- |
140
+ | `-y` | Non-interactive mode | Use for automated updates without prompts. |
141
+ | positional tag | Example: `beta` | Use for a quick tag or channel update. |
142
+ | positional version | Example: `1.2.3` | Use for exact version pinning. |
143
+ | `--tag <value>` | Named tag option | Use especially in PowerShell or other shells where explicit spacing is safer. |
144
+ | `--tag=<value>` | Inline named tag option | Same as above in inline syntax. |
145
+ | `--version <value>` | Named version option | Use for explicit version selection. |
146
+ | `--version=<value>` | Inline named version option | Same as above in inline syntax. |
147
+
148
+ The updater throws an error if conflicting version sources are provided.
49
149
 
50
- Add `-y` to most create or update examples below when you want the same flow to run without prompts.
150
+ ## 3. Create Command Combinations
51
151
 
52
- ## Create a New Project
152
+ ### 3.1 Base create command
53
153
 
54
- ### Interactive create
154
+ #### Interactive create
55
155
 
56
156
  ```bash
57
157
  npx create-caspian-app my-app
58
158
  ```
59
159
 
60
- Use when you want the normal interactive scaffold flow. The CLI can prompt for project name and feature toggles.
160
+ Use when you want the standard guided setup.
61
161
 
62
- ### Non-interactive create
162
+ #### Non-interactive create
63
163
 
64
164
  ```bash
65
165
  npx create-caspian-app my-app -y
66
166
  ```
67
167
 
68
- Use when you already know the desired feature flags or when automation should avoid prompts.
168
+ Use when you want a quick scaffold without prompts.
69
169
 
70
- Without extra flags, the non-interactive default behaves like this:
170
+ In skip-prompt mode, the default feature values are:
71
171
 
72
172
  - `backendOnly: false`
73
173
  - `tailwindcss: false`
@@ -75,20 +175,47 @@ Without extra flags, the non-interactive default behaves like this:
75
175
  - `mcp: false`
76
176
  - `prisma: false`
77
177
 
78
- ## Backend-only Create Combinations
178
+ ### 3.2 Backend-only combinations
79
179
 
80
- When `--backend-only` is enabled, the meaningful feature toggles are `--mcp` and `--prisma`. Frontend-oriented flags are not part of the normal backend-only prompt flow.
180
+ In backend-only mode, the main meaningful toggles are `--mcp` and `--prisma`. Frontend-oriented flags may still appear in raw CLI args, but they are not part of the normal backend-only feature flow.
81
181
 
82
- | Goal | Example command | When to use |
83
- | --- | --- | --- |
84
- | Minimal backend-only | `npx create-caspian-app my-app --backend-only` | Simple API or service without frontend assets. |
85
- | Backend-only + MCP | `npx create-caspian-app my-app --backend-only --mcp` | Backend service plus MCP support. |
86
- | Backend-only + Prisma | `npx create-caspian-app my-app --backend-only --prisma` | API or service with database and ORM support. |
87
- | Backend-only + MCP + Prisma | `npx create-caspian-app my-app --backend-only --mcp --prisma` | Full backend-only setup with both integrations. |
182
+ #### Minimal backend-only
183
+
184
+ ```bash
185
+ npx create-caspian-app my-app --backend-only
186
+ npx create-caspian-app my-app --backend-only -y
187
+ ```
88
188
 
89
- You can append `-y` to any backend-only example above.
189
+ Use when you want a simple backend project without frontend assets.
90
190
 
91
- ### Accepted but not recommended in backend-only mode
191
+ #### Backend-only plus MCP
192
+
193
+ ```bash
194
+ npx create-caspian-app my-app --backend-only --mcp
195
+ npx create-caspian-app my-app --backend-only --mcp -y
196
+ ```
197
+
198
+ Use when you want a backend service with MCP enabled.
199
+
200
+ #### Backend-only plus Prisma
201
+
202
+ ```bash
203
+ npx create-caspian-app my-app --backend-only --prisma
204
+ npx create-caspian-app my-app --backend-only --prisma -y
205
+ ```
206
+
207
+ Use when you want a backend or API project with database tooling.
208
+
209
+ #### Backend-only plus MCP plus Prisma
210
+
211
+ ```bash
212
+ npx create-caspian-app my-app --backend-only --mcp --prisma
213
+ npx create-caspian-app my-app --backend-only --mcp --prisma -y
214
+ ```
215
+
216
+ Use when you want the fullest backend-only setup.
217
+
218
+ #### Accepted but usually not useful for backend-only mode
92
219
 
93
220
  ```bash
94
221
  npx create-caspian-app my-app --backend-only --tailwindcss
@@ -96,59 +223,229 @@ npx create-caspian-app my-app --backend-only --typescript
96
223
  npx create-caspian-app my-app --backend-only --tailwindcss --typescript
97
224
  ```
98
225
 
99
- Avoid them in normal use. Backend-only mode strips frontend assets, so Tailwind and frontend TypeScript flags do not have a practical effect in the resulting scaffold.
226
+ These flags can be present in raw CLI args, but backend-only mode removes frontend assets and disables the normal TypeScript and frontend path, so they are not practical combinations.
100
227
 
101
- ## Full-stack and Frontend-enabled Create Combinations
228
+ ### 3.3 Full-stack combinations
102
229
 
103
- When `--backend-only` is not used, the feature flags `--tailwindcss`, `--typescript`, `--mcp`, and `--prisma` can be combined in any subset. The table below lists the common command matrix.
230
+ These apply when `--backend-only` is not used.
104
231
 
105
- | Flags | Example command | When to use |
106
- | --- | --- | --- |
107
- | none | `npx create-caspian-app my-app` | Default full-stack scaffold. |
108
- | `--tailwindcss` | `npx create-caspian-app my-app --tailwindcss` | Styled frontend with Tailwind. |
109
- | `--typescript` | `npx create-caspian-app my-app --typescript` | Frontend TypeScript assets. |
110
- | `--mcp` | `npx create-caspian-app my-app --mcp` | Full-stack app with MCP support. |
111
- | `--prisma` | `npx create-caspian-app my-app --prisma` | Full-stack app with Prisma support. |
112
- | `--tailwindcss --typescript` | `npx create-caspian-app my-app --tailwindcss --typescript` | Styled frontend with TypeScript. |
113
- | `--tailwindcss --mcp` | `npx create-caspian-app my-app --tailwindcss --mcp` | Styled UI plus MCP support. |
114
- | `--tailwindcss --prisma` | `npx create-caspian-app my-app --tailwindcss --prisma` | Styled UI plus database tooling. |
115
- | `--typescript --mcp` | `npx create-caspian-app my-app --typescript --mcp` | Frontend TypeScript plus MCP. |
116
- | `--typescript --prisma` | `npx create-caspian-app my-app --typescript --prisma` | Frontend TypeScript plus Prisma. |
117
- | `--mcp --prisma` | `npx create-caspian-app my-app --mcp --prisma` | Both major backend integrations without forcing frontend styling choices. |
118
- | `--tailwindcss --typescript --mcp` | `npx create-caspian-app my-app --tailwindcss --typescript --mcp` | Rich frontend plus MCP. |
119
- | `--tailwindcss --typescript --prisma` | `npx create-caspian-app my-app --tailwindcss --typescript --prisma` | Rich frontend plus Prisma. |
120
- | `--tailwindcss --mcp --prisma` | `npx create-caspian-app my-app --tailwindcss --mcp --prisma` | Styled UI plus both major integrations. |
121
- | `--typescript --mcp --prisma` | `npx create-caspian-app my-app --typescript --mcp --prisma` | Frontend TypeScript plus both major integrations. |
122
- | `--tailwindcss --typescript --mcp --prisma` | `npx create-caspian-app my-app --tailwindcss --typescript --mcp --prisma` | Most feature-complete default full-stack setup. |
123
-
124
- You can append `-y` to any frontend-enabled example above.
125
-
126
- ## Starter Kit Commands
232
+ #### Minimal full-stack
127
233
 
128
- ### List available starter kits
234
+ ```bash
235
+ npx create-caspian-app my-app
236
+ npx create-caspian-app my-app -y
237
+ ```
238
+
239
+ Use when you want the default scaffold and will add features later.
240
+
241
+ #### Full-stack plus Tailwind CSS
129
242
 
130
243
  ```bash
131
- npx create-caspian-app --list-starter-kits
244
+ npx create-caspian-app my-app --tailwindcss
245
+ npx create-caspian-app my-app --tailwindcss -y
246
+ ```
247
+
248
+ Use when you want Tailwind-based UI styling.
249
+
250
+ #### Full-stack plus TypeScript
251
+
252
+ ```bash
253
+ npx create-caspian-app my-app --typescript
254
+ npx create-caspian-app my-app --typescript -y
132
255
  ```
133
256
 
134
- Use when you want to inspect the built-in starter kit catalog before creating a project.
257
+ Use when you want the scaffold's TypeScript frontend tooling.
258
+
259
+ #### Full-stack plus MCP
260
+
261
+ ```bash
262
+ npx create-caspian-app my-app --mcp
263
+ npx create-caspian-app my-app --mcp -y
264
+ ```
265
+
266
+ Use when you want MCP support in a full-stack app.
267
+
268
+ #### Full-stack plus Prisma
269
+
270
+ ```bash
271
+ npx create-caspian-app my-app --prisma
272
+ npx create-caspian-app my-app --prisma -y
273
+ ```
274
+
275
+ Use when you want ORM and database support.
276
+
277
+ #### Full-stack plus Tailwind plus TypeScript
278
+
279
+ ```bash
280
+ npx create-caspian-app my-app --tailwindcss --typescript
281
+ npx create-caspian-app my-app --tailwindcss --typescript -y
282
+ ```
283
+
284
+ Use when you want the typical richer frontend setup.
285
+
286
+ #### Full-stack plus Tailwind plus MCP
287
+
288
+ ```bash
289
+ npx create-caspian-app my-app --tailwindcss --mcp
290
+ npx create-caspian-app my-app --tailwindcss --mcp -y
291
+ ```
292
+
293
+ Use when you want styled UI plus MCP.
294
+
295
+ #### Full-stack plus Tailwind plus Prisma
296
+
297
+ ```bash
298
+ npx create-caspian-app my-app --tailwindcss --prisma
299
+ npx create-caspian-app my-app --tailwindcss --prisma -y
300
+ ```
301
+
302
+ Use when you want styled UI plus database tooling.
303
+
304
+ #### Full-stack plus TypeScript plus MCP
305
+
306
+ ```bash
307
+ npx create-caspian-app my-app --typescript --mcp
308
+ npx create-caspian-app my-app --typescript --mcp -y
309
+ ```
310
+
311
+ Use when you want TypeScript assets plus MCP.
312
+
313
+ #### Full-stack plus TypeScript plus Prisma
314
+
315
+ ```bash
316
+ npx create-caspian-app my-app --typescript --prisma
317
+ npx create-caspian-app my-app --typescript --prisma -y
318
+ ```
319
+
320
+ Use when you want TypeScript assets plus database tooling.
321
+
322
+ #### Full-stack plus MCP plus Prisma
323
+
324
+ ```bash
325
+ npx create-caspian-app my-app --mcp --prisma
326
+ npx create-caspian-app my-app --mcp --prisma -y
327
+ ```
328
+
329
+ Use when you want both integration layers without forcing frontend preferences.
330
+
331
+ #### Full-stack plus Tailwind plus TypeScript plus MCP
332
+
333
+ ```bash
334
+ npx create-caspian-app my-app --tailwindcss --typescript --mcp
335
+ npx create-caspian-app my-app --tailwindcss --typescript --mcp -y
336
+ ```
337
+
338
+ Use when you want a rich frontend plus MCP.
339
+
340
+ #### Full-stack plus Tailwind plus TypeScript plus Prisma
341
+
342
+ ```bash
343
+ npx create-caspian-app my-app --tailwindcss --typescript --prisma
344
+ npx create-caspian-app my-app --tailwindcss --typescript --prisma -y
345
+ ```
346
+
347
+ Use when you want a rich frontend plus database tooling.
348
+
349
+ #### Full-stack plus Tailwind plus MCP plus Prisma
350
+
351
+ ```bash
352
+ npx create-caspian-app my-app --tailwindcss --mcp --prisma
353
+ npx create-caspian-app my-app --tailwindcss --mcp --prisma -y
354
+ ```
355
+
356
+ Use when you want styled UI and both integrations.
357
+
358
+ #### Full-stack plus TypeScript plus MCP plus Prisma
359
+
360
+ ```bash
361
+ npx create-caspian-app my-app --typescript --mcp --prisma
362
+ npx create-caspian-app my-app --typescript --mcp --prisma -y
363
+ ```
364
+
365
+ Use when you want TypeScript assets plus both integrations.
366
+
367
+ #### Full-stack plus Tailwind plus TypeScript plus MCP plus Prisma
368
+
369
+ ```bash
370
+ npx create-caspian-app my-app --tailwindcss --typescript --mcp --prisma
371
+ npx create-caspian-app my-app --tailwindcss --typescript --mcp --prisma -y
372
+ ```
373
+
374
+ Use when you want the most complete default full-stack configuration.
375
+
376
+ ## 4. Starter Kit Command Combinations
135
377
 
136
378
  ### Built-in starter kits
137
379
 
138
- The current command reference includes these built-in starter kits:
380
+ #### Basic starter kit
139
381
 
140
- | Starter kit | Example command | Preset features | When to use |
141
- | --- | --- | --- | --- |
142
- | `basic` | `npx create-caspian-app my-app --starter-kit=basic` | `backendOnly=true`, `tailwindcss=false`, `prisma=false`, `mcp=false` | Minimal backend-oriented scaffold. |
143
- | `fullstack` | `npx create-caspian-app my-app --starter-kit=fullstack` | `backendOnly=false`, `tailwindcss=true`, `prisma=true`, `mcp=false` | Complete full-stack web app preset. |
144
- | `api` | `npx create-caspian-app my-app --starter-kit=api` | `backendOnly=true`, `tailwindcss=false`, `prisma=true`, `mcp=false` | Backend API preset with Prisma. |
145
- | `realtime` | `npx create-caspian-app my-app --starter-kit=realtime` | `backendOnly=false`, `tailwindcss=true`, `prisma=true`, `mcp=true` | Realtime-oriented preset with both UI and integration support. |
382
+ ```bash
383
+ npx create-caspian-app my-app --starter-kit=basic
384
+ npx create-caspian-app my-app --starter-kit=basic -y
385
+ ```
386
+
387
+ Use when you want the minimal backend preset.
388
+
389
+ Preset features:
390
+
391
+ - `backendOnly = true`
392
+ - `tailwindcss = false`
393
+ - `prisma = false`
394
+ - `mcp = false`
395
+
396
+ #### Fullstack starter kit
397
+
398
+ ```bash
399
+ npx create-caspian-app my-app --starter-kit=fullstack
400
+ npx create-caspian-app my-app --starter-kit=fullstack -y
401
+ ```
402
+
403
+ Use when you want the built-in full-stack preset.
146
404
 
147
- If you want frontend TypeScript, add `--typescript` explicitly rather than assuming it is implied by a starter kit preset.
405
+ Preset features:
148
406
 
149
- Append `-y` to any starter kit example when you want the same preset without prompts.
407
+ - `backendOnly = false`
408
+ - `tailwindcss = true`
409
+ - `prisma = true`
410
+ - `mcp = false`
150
411
 
151
- ### Starter kit overrides
412
+ #### API starter kit
413
+
414
+ ```bash
415
+ npx create-caspian-app my-app --starter-kit=api
416
+ npx create-caspian-app my-app --starter-kit=api -y
417
+ ```
418
+
419
+ Use when you want a backend API preset with ORM and database support.
420
+
421
+ Preset features:
422
+
423
+ - `backendOnly = true`
424
+ - `tailwindcss = false`
425
+ - `prisma = true`
426
+ - `mcp = false`
427
+
428
+ #### Realtime starter kit
429
+
430
+ ```bash
431
+ npx create-caspian-app my-app --starter-kit=realtime
432
+ npx create-caspian-app my-app --starter-kit=realtime -y
433
+ ```
434
+
435
+ Use when you want the built-in realtime preset.
436
+
437
+ Preset features:
438
+
439
+ - `backendOnly = false`
440
+ - `tailwindcss = true`
441
+ - `prisma = true`
442
+ - `mcp = true`
443
+
444
+ ### Starter kit with feature overrides
445
+
446
+ Starter kit defaults can still be overridden by explicit feature flags because the CLI reapplies raw args after loading starter kit defaults.
447
+
448
+ Examples:
152
449
 
153
450
  ```bash
154
451
  npx create-caspian-app my-app --starter-kit=basic --prisma
@@ -157,83 +454,132 @@ npx create-caspian-app my-app --starter-kit=api --mcp
157
454
  npx create-caspian-app my-app --starter-kit=realtime --backend-only
158
455
  ```
159
456
 
160
- Use overrides when a starter kit is close to the target app but you need to force one or more feature flags.
457
+ Use when a starter kit is close to what you want but still needs a few forced overrides.
161
458
 
162
459
  ### Custom starter kit source
163
460
 
164
461
  ```bash
165
462
  npx create-caspian-app my-app --starter-kit=custom --starter-kit-source=https://github.com/user/repo
463
+ npx create-caspian-app my-app --starter-kit=custom --starter-kit-source=https://github.com/user/repo -y
166
464
  ```
167
465
 
168
- You can combine extra flags with the custom source:
466
+ You can combine feature overrides too:
169
467
 
170
468
  ```bash
171
469
  npx create-caspian-app my-app --starter-kit=custom --starter-kit-source=https://github.com/user/repo --typescript --prisma
172
470
  ```
173
471
 
174
- Use this flow when the scaffold should come from an external repository instead of a built-in preset.
472
+ Use when the scaffold should come from an external Git repository. The CLI clones the repository, removes `.git`, and updates project config for the new project.
175
473
 
176
- ## Update an Existing Project
474
+ ## 5. Update Command Combinations
177
475
 
178
- The updater wrapper recognizes the `update project` family:
476
+ The updater recognizes only the `update project` command family. Anything outside that family is rejected by the wrapper.
477
+
478
+ ### Update to latest
179
479
 
180
480
  ```bash
181
481
  npx casp update project
182
482
  ```
183
483
 
184
- Use this only inside an existing Caspian project that already has `caspian.config.json` in the current directory.
484
+ Use when you want the newest release and do not need a pinned tag or version.
185
485
 
186
- ### Update to latest
486
+ ### Update to a specific tag using positional syntax
187
487
 
188
488
  ```bash
189
- npx casp update project
489
+ npx casp update project beta
190
490
  ```
191
491
 
192
- Use when you want the normal refresh to the latest framework-managed files.
492
+ Use when you want a named release channel such as `beta`.
193
493
 
194
- ### Update to a specific tag
494
+ ### Update to a specific version using positional syntax
195
495
 
196
496
  ```bash
197
- npx casp update project @v4-alpha
497
+ npx casp update project 1.2.3
198
498
  ```
199
499
 
200
- Use when you want a prerelease or named tag instead of the latest stable release.
500
+ Use when you want an exact version.
201
501
 
202
- ### Update to a specific version
502
+ ### Update using named tag option
203
503
 
204
504
  ```bash
205
- npx casp update project @1.2.3
206
- npx casp update project 1.2.3
505
+ npx casp update project --tag beta
506
+ npx casp update project --tag=beta
507
+ ```
508
+
509
+ Use when you want clearer syntax or PowerShell-safe argument parsing.
510
+
511
+ ### Update using named version option
512
+
513
+ ```bash
514
+ npx casp update project --version 1.2.3
515
+ npx casp update project --version=1.2.3
207
516
  ```
208
517
 
209
- Use when you want a deterministic pinned version.
518
+ Use when you want explicit version selection with named syntax.
210
519
 
211
- ### Non-interactive update
520
+ ### Non-interactive latest update
212
521
 
213
522
  ```bash
214
523
  npx casp update project -y
215
- npx casp update project @v4-alpha -y
216
- npx casp update project @1.2.3 -y
524
+ ```
525
+
526
+ Use for scripted or CI updates to latest.
527
+
528
+ ### Non-interactive tagged update
529
+
530
+ ```bash
531
+ npx casp update project beta -y
532
+ npx casp update project --tag beta -y
533
+ npx casp update project --tag=beta -y
534
+ ```
535
+
536
+ Use for scripted or shell-safe tag-based upgrades.
537
+
538
+ ### Non-interactive versioned update
539
+
540
+ ```bash
217
541
  npx casp update project 1.2.3 -y
542
+ npx casp update project --version 1.2.3 -y
543
+ npx casp update project --version=1.2.3 -y
218
544
  ```
219
545
 
220
- Use when automation, CI, or scripted maintenance should skip confirmation prompts.
546
+ Use for automated pinned upgrades.
221
547
 
222
- ### Update safety notes
548
+ ## 6. Invalid Or Conflicting Update Cases
223
549
 
224
- The update flow is config-aware. Review `caspian.config.json` before running it, especially these areas:
550
+ These cases matter because the newer updater parsing is stricter.
225
551
 
226
- - feature flags such as backend-only, Tailwind, TypeScript, MCP, and Prisma
227
- - `componentScanDirs`
228
- - `excludeFiles`, which protects customized files from overwrite
552
+ ### Missing value
229
553
 
230
- If you exclude a file, the updater preserves it, but you are responsible for merging future framework changes into that file manually.
554
+ ```bash
555
+ npx casp update project --tag
556
+ npx casp update project --version
557
+ ```
558
+
559
+ Result: parsing error because the option is missing its value.
560
+
561
+ ### Too many positional arguments
562
+
563
+ ```bash
564
+ npx casp update project beta extra
565
+ ```
566
+
567
+ Result: parsing error because `update project` accepts at most one extra positional version or tag value.
568
+
569
+ ### Conflicting version sources
570
+
571
+ ```bash
572
+ npx casp update project beta --tag latest
573
+ npx casp update project 1.2.3 --version 2.0.0
574
+ ```
231
575
 
232
- ## Prisma and Python ORM Regeneration
576
+ Result: parsing error because more than one version source was provided.
577
+
578
+ ## 7. Prisma And Python ORM Regeneration
233
579
 
234
580
  The create and update commands above are not the whole maintenance story for this workspace. When `prisma/schema.prisma` changes, follow the ORM flow below so the TypeScript Prisma client, database state, and Python ORM layer stay aligned.
235
581
 
236
- ### Required order after `prisma/schema.prisma` changes
582
+ ### Required order after schema changes
237
583
 
238
584
  ```bash
239
585
  npx prisma migrate dev
@@ -249,7 +595,7 @@ Use this order:
249
595
 
250
596
  1. Run `npx prisma migrate dev` first so migrations and the development database stay aligned.
251
597
  2. If `prisma/seed.ts` or seed data depends on the new schema, run `npx prisma generate` and then `npx prisma db seed`.
252
- 3. Run `npx ppy generate` last so the Python ORM layer matches the updated Prisma schema.
598
+ 3. Run `npx ppy generate` last so the generated Python ORM layer matches the updated Prisma schema.
253
599
 
254
600
  Do not manually create or edit these generated files:
255
601
 
@@ -262,19 +608,50 @@ Do not manually create or edit these generated files:
262
608
 
263
609
  See [database.md](./database.md) for the full schema, migration, seed, and async usage guide.
264
610
 
265
- ## Practical Recommendation Matrix
611
+ ## 8. Practical Recommendation Matrix
266
612
 
267
613
  | Goal | Recommended command |
268
614
  | --- | --- |
269
- | Minimal backend without database | `npx create-caspian-app my-app --backend-only -y` |
270
- | Small API or service with Prisma | `npx create-caspian-app my-app --backend-only --prisma -y` |
271
- | Full-stack app with styled UI and Prisma | `npx create-caspian-app my-app --tailwindcss --prisma -y` |
272
- | Rich full-stack app with TypeScript, Tailwind, and Prisma | `npx create-caspian-app my-app --tailwindcss --typescript --prisma -y` |
615
+ | Minimal backend service | `npx create-caspian-app my-app --backend-only -y` |
616
+ | Backend API with database support | `npx create-caspian-app my-app --backend-only --prisma -y` |
617
+ | Full-stack app with styled UI and database support | `npx create-caspian-app my-app --tailwindcss --prisma -y` |
618
+ | Full-stack app with richer frontend tooling and Prisma | `npx create-caspian-app my-app --tailwindcss --typescript --prisma -y` |
273
619
  | Full-stack app with everything enabled | `npx create-caspian-app my-app --tailwindcss --typescript --mcp --prisma -y` |
274
620
  | Realtime preset | `npx create-caspian-app my-app --starter-kit=realtime -y` |
275
621
  | Update current project to latest | `npx casp update project` |
276
- | Update current project in automation | `npx casp update project -y` |
277
- | Update current project to an exact version | `npx casp update project @1.2.3 -y` |
622
+ | Update current project to beta safely in PowerShell | `npx casp update project --tag beta` |
623
+ | Update current project to an exact version | `npx casp update project --version 1.2.3 -y` |
624
+ | Regenerate Python ORM after schema changes | `npx prisma migrate dev` then optional seed commands, then `npx ppy generate` |
625
+
626
+ ## 9. Configuration Notes
627
+
628
+ The CLI reads `caspian.config.json` to decide how it should interact with the project.
629
+
630
+ Important configuration areas include:
631
+
632
+ - project identity and root path
633
+ - feature toggles such as backend-only, Tailwind, MCP, Prisma, and TypeScript
634
+ - component scan directories
635
+ - `excludeFiles`, which protects customized files from overwrite during updates
636
+
637
+ Use `excludeFiles` in `caspian.config.json` to prevent the update command from overwriting files you have customized.
638
+
639
+ This is useful for protecting:
640
+
641
+ - stylesheets
642
+ - configuration files
643
+ - entry-point files
644
+ - other locally modified framework-managed files
645
+
646
+ If you exclude a file, the updater preserves it, but you are responsible for merging future framework changes into that file manually.
647
+
648
+ ## 10. Operational Notes
649
+
650
+ 1. On Windows, the updater resolves `npx.cmd` instead of plain `npx`, which makes execution more reliable on Win32.
651
+ 2. The updater still requires `caspian.config.json` in the current directory before running an update.
652
+ 3. The creator reuses an existing `.venv` if one is already present instead of recreating it every time.
653
+ 4. Starter kits still support later overrides via explicit CLI flags.
654
+ 5. Frontend-oriented flags are only fully meaningful when `backendOnly` is false.
278
655
 
279
656
  ## AI Routing Notes
280
657
 
@@ -285,6 +662,7 @@ If an AI agent is deciding which command flow to use, apply these rules first.
285
662
  - Add `-y` when the user wants automation, CI, or a no-prompt flow.
286
663
  - Treat `--tailwindcss` and `--typescript` as frontend-oriented flags. They are not meaningful in normal backend-only scaffolds.
287
664
  - Treat starter kit defaults as a base layer that can be overridden by explicit flags.
665
+ - Read `caspian.config.json` before running update commands.
288
666
  - When `prisma/schema.prisma` changes, run `npx prisma migrate dev` first, then any required seed refresh, then `npx ppy generate`.
289
667
  - Never hand-edit generated Python ORM files under `src/lib/prisma/` or `settings/prisma-schema.json`.
290
668
  - Read [database.md](./database.md) before generating Prisma schema, migration, seed, or ORM guidance.
@@ -3,9 +3,10 @@ title: Fetch Data
3
3
  description: Fetch first-render and interactive data in Caspian with async route functions, `@rpc()` actions, `pp.rpc()`, streaming, and uploads, with RPC as the default browser-to-server data path.
4
4
  related:
5
5
  title: Related docs
6
- description: Use the routing guide to place route logic correctly, then use the auth guide for protected actions, the state guide for transient request-scoped mutation state, the cache guide for reusable first-render HTML, and the PulsePoint runtime guide for client-side `pp.rpc()` details.
6
+ description: Use the routing guide to place route logic correctly, then use the auth guide for protected actions, the MCP guide for AI-facing tools, the state guide for transient request-scoped mutation state, the cache guide for reusable first-render HTML, and the PulsePoint runtime guide for client-side `pp.rpc()` details.
7
7
  links:
8
8
  - /docs/auth
9
+ - /docs/mcp
9
10
  - /docs/state
10
11
  - /docs/database
11
12
  - /docs/cache
@@ -19,6 +20,8 @@ This page explains how data fetching works in Caspian. Use route functions for i
19
20
 
20
21
  Treat RPC as the default way for browser code to talk to Python in Caspian. Do not reach for ad hoc fetch calls to custom JSON endpoints, alternate transport layers, or older helper names unless the task explicitly requires that shape.
21
22
 
23
+ MCP is a separate integration surface. Do not place app-owned FastMCP tools in route `index.py` files or treat `@rpc()` actions as a replacement for MCP tools. In this workspace, MCP tool definitions live under `src/lib/mcp/` and are documented in `mcp.md`.
24
+
22
25
  ## Overview
23
26
 
24
27
  Caspian has two main data-loading paths:
@@ -7,6 +7,7 @@ related:
7
7
  links:
8
8
  - /docs/installation
9
9
  - /docs/commands
10
+ - /docs/mcp
10
11
  - /docs/project-structure
11
12
  - /docs/components
12
13
  ---
@@ -36,7 +37,8 @@ The packaged Caspian docs distributed by the current toolchain also live here:
36
37
  ## Available Documents
37
38
 
38
39
  - `installation.md` - First-time setup flow for creating a new Caspian application
39
- - `commands.md` - Main Caspian CLI workflows for project creation, starter kits, updates, and Prisma or ORM-aware maintenance
40
+ - `commands.md` - Main Caspian CLI workflows for project creation, generation, updates, and config-aware maintenance
41
+ - `mcp.md` - Workspace FastMCP server layout, nested config path, local launch flow, and MCP-specific AI routing rules
40
42
  - `database.md` - Prisma schema, migration, seed, and client-generation workflow for the current workspace, plus Python-side helper caveats
41
43
  - `auth.md` - Session-backed authentication with `casp.auth`, centralized `auth_config.py`, decorators, RBAC, and OAuth provider helpers
42
44
  - `components.md` - Create reusable Python components, template-backed UI, JSX-style imports, and the single-parent root rule for component HTML files
@@ -57,7 +59,7 @@ Preferred lookup order:
57
59
 
58
60
  1. Read `node_modules/caspian-utils/dist/docs/index.md` to discover available local docs.
59
61
  2. Read `./caspian.config.json` before making any feature assumption. Use it to confirm which project capabilities are enabled and which directories or tooling rules apply.
60
- 3. Read `database.md` for Prisma setup and ORM usage, `auth.md` for session auth and route protection, `components.md` for reusable UI authoring, `pulsepoint.md` for browser-side reactive runtime behavior, `fetch-data.md` for data flows, `state.md` for transient request-scoped state, `cache.md` for page caching, and `validation.md` for input boundaries.
62
+ 3. Read `database.md` for Prisma setup and ORM usage, `mcp.md` for the current FastMCP server layout and local run flow, `auth.md` for session auth and route protection, `components.md` for reusable UI authoring, `pulsepoint.md` for browser-side reactive runtime behavior, `fetch-data.md` for data flows, `state.md` for transient request-scoped state, `cache.md` for page caching, and `validation.md` for input boundaries.
61
63
  4. For authored component, route, and layout HTML files, generate exactly one top-level lowercase HTML element. Think React-style single parent wrapper: keep any owned PulsePoint logic in a plain `<script>` inside that root, do not handwrite `pp-component="..."` or `type="text/pp"` because Caspian injects those runtime attributes automatically, and treat `<!-- @import ... -->` comments as file-level directives that belong above the authored root element instead of inside `<div>`, `<section>`, or `<html>`. When several component tags come from one Python file, import them from that exact file path, for example `<!-- @import { Breadcrumb, BreadcrumbItem, BreadcrumbList } from "../components/Breadcrumb.py" -->`.
62
64
  5. Prefer local docs before generating code, commands, or migration guidance.
63
65
  6. Check `node_modules/caspian-utils/dist/docs/` for packaged Caspian docs when local docs need more detail.
@@ -3,8 +3,10 @@ title: Installation
3
3
  description: Learn how to create a new Caspian application so AI agents use the first-time setup flow instead of assuming an existing project is already in place.
4
4
  related:
5
5
  title: Related docs
6
- description: Continue with the routing and structure guides after scaffold so the new app follows Caspian conventions.
6
+ description: Continue with the routing, structure, and MCP guides after scaffold so the new app follows Caspian conventions and keeps optional FastMCP files in the right place.
7
7
  links:
8
+ - /docs/commands
9
+ - /docs/mcp
8
10
  - /docs/routing
9
11
  - /docs/project-structure
10
12
  - /docs/index
@@ -54,6 +56,8 @@ The interactive wizard walks through the main project options, including:
54
56
  - Feature toggles such as backend-only mode, Tailwind CSS, Prisma, MCP, and TypeScript
55
57
  - Other scaffold options exposed by the current CLI version
56
58
 
59
+ If the project enables MCP, use `mcp.md` after scaffold to place the app-owned FastMCP server and config files correctly for the current workspace conventions.
60
+
57
61
  ## Recommended VS Code Setup
58
62
 
59
63
  For the best development experience, use these VS Code extensions:
@@ -83,6 +87,7 @@ In this workspace, `npm run dev` is backed by BrowserSync plus PostCSS watchers,
83
87
  Once the project is scaffolded:
84
88
 
85
89
  - Read `database.md` when the app includes Prisma ORM support or needs database changes.
90
+ - Read `mcp.md` when the app includes MCP support or needs FastMCP server, config, or launch-flow changes.
86
91
  - Read `auth.md` before wiring session config, sign-in or signout routes, route guards, or OAuth providers.
87
92
  - Read `pulsepoint.md` before generating interactive frontend behavior.
88
93
  - Read `fetch-data.md` before adding browser-triggered reads, writes, uploads, or streams.
@@ -97,5 +102,6 @@ If an AI agent is reading this page, treat it as the source for new-project inst
97
102
  - Use this workflow when the user is creating a Caspian app from scratch.
98
103
  - Do not use existing-project migration or update commands unless the project already exists.
99
104
  - After scaffold, default to PulsePoint for interactive UI, RPC for browser-to-server data flow, and `casp.validate` for validation.
105
+ - If MCP is enabled, read [mcp.md](./mcp.md) before editing FastMCP files or assuming where the server config should live.
100
106
  - Once the app exists, check [routing.md](./routing.md) before creating or changing routes under `src/app/`.
101
107
  - Check [index.md](./index.md) first when deciding which local doc to follow.
@@ -0,0 +1,102 @@
1
+ ---
2
+ title: MCP
3
+ description: Use the workspace FastMCP setup through src/lib/mcp/mcp_server.py, src/lib/mcp/fastmcp.json, and settings/restart-mcp.ts, with npm-driven startup and explicit manual paths when running FastMCP directly.
4
+ related:
5
+ title: Related docs
6
+ description: Start with project structure for file placement, then use commands for local run flows and index for documentation routing.
7
+ links:
8
+ - /docs/project-structure
9
+ - /docs/commands
10
+ - /docs/fetch-data
11
+ - /docs/index
12
+ ---
13
+
14
+ This page documents the Model Context Protocol workflow present in this workspace.
15
+
16
+ The current repo enables MCP in `caspian.config.json`, keeps the app-owned FastMCP server at `src/lib/mcp/mcp_server.py`, keeps the FastMCP config at `src/lib/mcp/fastmcp.json`, and starts it through `npm run mcp`, which runs `settings/restart-mcp.ts`.
17
+
18
+ ## Overview
19
+
20
+ Use these rules as the default MCP workflow in this workspace:
21
+
22
+ 1. Read `caspian.config.json` and confirm `mcp: true` before assuming MCP files should exist or be started.
23
+ 2. Edit `src/lib/mcp/mcp_server.py` when changing FastMCP tools, server instructions, or server-owned helper logic.
24
+ 3. Edit `src/lib/mcp/fastmcp.json` when changing the transport, host, port, path, or server entrypoint.
25
+ 4. Edit `settings/restart-mcp.ts` when changing discovery order, environment overrides, or MCP log filtering.
26
+ 5. Use `npm run mcp` as the normal local launch flow.
27
+
28
+ ## Current Workspace Layout
29
+
30
+ - `src/lib/mcp/mcp_server.py` defines `mcp = FastMCP(...)` and the current workspace tools.
31
+ - `src/lib/mcp/fastmcp.json` points to `src/lib/mcp/mcp_server.py` and configures `streamable-http` on `127.0.0.1:5101/mcp`.
32
+ - `settings/restart-mcp.ts` is the npm-facing launcher. It resolves MCP config paths, starts FastMCP, and trims noisy banner or warning output down to essential lines.
33
+ - `package.json` defines `npm run mcp` as `tsx settings/restart-mcp.ts` and includes `mcp` in `npm run dev`.
34
+ - `caspian.config.json` is the feature gate. If `mcp` is false, the MCP runner exits cleanly without starting a server.
35
+
36
+ ## Current Tools
37
+
38
+ The app-owned MCP server currently exposes these read-only tools:
39
+
40
+ - `project_info` returns the project name, root path, version metadata, browser sync target, feature flags, and component scan directories.
41
+ - `workspace_files` returns the generated workspace file list, optionally filtered to `all`, `app`, or `public`.
42
+ - `component_inventory` returns the latest generated component map from `settings/component-map.json`.
43
+
44
+ Add or change tools in `src/lib/mcp/mcp_server.py`.
45
+
46
+ ## Running The Server
47
+
48
+ ### Preferred local commands
49
+
50
+ ```bash
51
+ npm run mcp
52
+ npm run dev
53
+ ```
54
+
55
+ Use `npm run mcp` when you want the MCP server only. Use `npm run dev` when you want BrowserSync, Tailwind, the Python app server, and MCP together.
56
+
57
+ ### Direct FastMCP commands
58
+
59
+ On this Windows workspace, the direct FastMCP commands are:
60
+
61
+ ```powershell
62
+ .venv\Scripts\fastmcp.exe inspect src/lib/mcp/fastmcp.json
63
+ .venv\Scripts\fastmcp.exe run src/lib/mcp/fastmcp.json --no-banner
64
+ ```
65
+
66
+ Because the config file lives under `src/lib/mcp/`, plain `fastmcp run` from the project root does not auto-detect it. Use `npm run mcp` or pass the explicit config path.
67
+
68
+ ## Config And Discovery Rules
69
+
70
+ `settings/restart-mcp.ts` currently resolves MCP server specs in this order:
71
+
72
+ 1. `MCP_SERVER_SPEC`
73
+ 2. `src/lib/mcp/fastmcp.json`
74
+ 3. `fastmcp.json`
75
+ 4. `mcp.json`
76
+
77
+ The runner also forwards these optional overrides to FastMCP:
78
+
79
+ - `MCP_TRANSPORT`
80
+ - `MCP_HOST`
81
+ - `MCP_PORT`
82
+ - `MCP_PATH`
83
+ - `MCP_LOG_LEVEL`
84
+
85
+ Keep the `source.path` value in `src/lib/mcp/fastmcp.json` root-relative as `src/lib/mcp/mcp_server.py`. Do not shorten it to `mcp_server.py` unless the launch working directory changes too, because FastMCP resolves that path from the current working directory.
86
+
87
+ ## AI Routing Notes
88
+
89
+ If an AI tool is working on MCP in this workspace, use this order:
90
+
91
+ 1. Read `caspian.config.json` to confirm `mcp: true`.
92
+ 2. Read `node_modules/caspian-utils/dist/docs/mcp.md` for the current workspace MCP rules.
93
+ 3. Read `src/lib/mcp/mcp_server.py` for tool definitions and server instructions.
94
+ 4. Read `src/lib/mcp/fastmcp.json` for transport and entrypoint configuration.
95
+ 5. Read `settings/restart-mcp.ts` and `package.json` for local start behavior.
96
+
97
+ Default placement rules:
98
+
99
+ - Put app-owned FastMCP tools in `src/lib/mcp/mcp_server.py`.
100
+ - Keep the default FastMCP config in `src/lib/mcp/fastmcp.json`.
101
+ - Keep npm-facing launch behavior in `settings/restart-mcp.ts`.
102
+ - If the MCP file layout changes, update this page, `AGENTS.md`, `.github/copilot-instructions.md`, and any workspace runner logic together.
@@ -1,13 +1,14 @@
1
1
  ---
2
2
  title: Project Structure
3
- description: Understand the default Caspian project layout so AI agents place routes, reusable components, PulsePoint templates, RPC actions, validation helpers, auth code, configuration, and database changes in the correct directories.
3
+ description: Understand the default Caspian project layout so AI agents place routes, reusable components, PulsePoint templates, RPC actions, validation helpers, auth code, MCP files, configuration, and database changes in the correct directories.
4
4
  related:
5
5
  title: Related docs
6
- description: Start with installation for new apps, then use the component guide for reusable UI, the auth guide for bootstrap and session wiring, the routing guide to map URLs correctly, and the cache guide when route HTML should be reused safely.
6
+ description: Start with installation for new apps, then use the component guide for reusable UI, the auth guide for bootstrap and session wiring, the MCP guide for server layout, the routing guide to map URLs correctly, and the cache guide when route HTML should be reused safely.
7
7
  links:
8
8
  - /docs/installation
9
9
  - /docs/components
10
10
  - /docs/auth
11
+ - /docs/mcp
11
12
  - /docs/routing
12
13
  - /docs/cache
13
14
  - /docs/database
@@ -31,6 +32,7 @@ Before an AI agent decides which Caspian features are available in a workspace,
31
32
  - `src/` contains routes, page templates, styles, and shared libraries.
32
33
  - `src/components/` contains reusable Python components and optional same-name HTML templates.
33
34
  - `src/lib/auth/auth_config.py` contains auth-specific configuration for the app.
35
+ - `src/lib/mcp/` contains the app-owned FastMCP server and nested FastMCP config when MCP is enabled.
34
36
  - `prisma/` contains the Prisma schema and seed scripts.
35
37
  - `public/` contains static assets served directly.
36
38
  - `main.py` is the application entry point.
@@ -62,6 +64,9 @@ my-app/
62
64
  lib/
63
65
  auth/
64
66
  auth_config.py
67
+ mcp/
68
+ fastmcp.json
69
+ mcp_server.py
65
70
  prisma/
66
71
  __init__.py
67
72
  db.py
@@ -112,6 +117,8 @@ Use this folder for shared helpers, reusable validators, RPC-facing service wrap
112
117
 
113
118
  This workspace already includes an app-owned Python database layer under `src/lib/prisma/`. Reuse that package for Python-side data access and keep any additional shared database helpers in `src/lib/`.
114
119
 
120
+ When MCP is enabled in the current workspace, this folder also contains the app-owned FastMCP server under `src/lib/mcp/`.
121
+
115
122
  ### Shared Database Helpers
116
123
 
117
124
  If your Python routes or RPC actions need reusable database access code, keep that helper layer under `src/lib/` and extend the existing `src/lib/prisma/` package.
@@ -122,6 +129,17 @@ In this workspace, Prisma schema and seed files live under `prisma/`, while the
122
129
 
123
130
  Use this folder for authentication-specific project code. The main auth configuration file lives at `src/lib/auth/auth_config.py`.
124
131
 
132
+ ### `src/lib/mcp/`
133
+
134
+ Use this folder for app-owned Model Context Protocol server files.
135
+
136
+ In the current workspace:
137
+
138
+ - `src/lib/mcp/mcp_server.py` defines `mcp = FastMCP(...)` and the current tool set.
139
+ - `src/lib/mcp/fastmcp.json` is the default FastMCP config used by `npm run mcp`.
140
+
141
+ Keep MCP tool definitions here instead of placing them in route files, `main.py`, or framework internals.
142
+
125
143
  ### `prisma/`
126
144
 
127
145
  This folder contains your database model definitions in `schema.prisma` and any seed logic such as `seed.ts`.
@@ -153,12 +171,22 @@ The core feature configuration file for the application.
153
171
 
154
172
  AI agents should read this file before making almost any feature-level decision. Use it to confirm which capabilities are enabled, which code generation paths make sense, and which directories should be scanned for components or other project assets.
155
173
 
156
- In the current workspace, `caspian.config.json` shows `backendOnly: false`, `tailwindcss: true`, `mcp: false`, `prisma: true`, `typescript: false`, and `componentScanDirs: ["src"]`.
174
+ In the current workspace, `caspian.config.json` shows `backendOnly: false`, `tailwindcss: true`, `mcp: true`, `prisma: true`, `typescript: false`, and `componentScanDirs: ["src"]`.
157
175
 
158
176
  ### `src/lib/auth/auth_config.py`
159
177
 
160
178
  The project auth configuration file. Use this path when changing authentication behavior.
161
179
 
180
+ ### `src/lib/mcp/mcp_server.py`
181
+
182
+ The app-owned FastMCP server module for this workspace. It exports the `mcp` server instance and should be the default place for workspace MCP tools.
183
+
184
+ ### `src/lib/mcp/fastmcp.json`
185
+
186
+ The default FastMCP config file for this workspace.
187
+
188
+ Because this file is nested under `src/lib/mcp/`, direct FastMCP commands should pass the explicit path, for example `fastmcp run src/lib/mcp/fastmcp.json`, unless the launch working directory changes.
189
+
162
190
  ### `src/app/layout.html`
163
191
 
164
192
  The root layout shared across pages.
@@ -204,9 +232,11 @@ If an AI agent is deciding where to make changes, use these rules first.
204
232
  - Put route templates and route-specific backend logic in `src/app/`.
205
233
  - Check [routing.md](./routing.md) when you need URL segment rules, layout nesting behavior, or dynamic route conventions.
206
234
  - Put reusable component files in `src/components/` and check [components.md](./components.md) for `@component`, `render_html(__file__)`, import comments, and single-root template rules.
235
+ - Use [mcp.md](./mcp.md) when the task involves FastMCP tool definitions, nested config discovery, or local MCP commands.
207
236
  - Keep `<!-- @import ... -->` comments above the single authored root element in route, layout, and component HTML files.
208
237
  - For route and component HTML files, always emit one top-level lowercase HTML element. Good: one wrapper containing the content and a plain `<script>` when needed. Bad: a wrapper element followed by a sibling top-level `<script>`, or handwritten `pp-component="..."` and `type="text/pp"` attributes in source.
209
238
  - Put shared helpers and reusable libraries in `src/lib/`.
239
+ - Put app-owned FastMCP code in `src/lib/mcp/`.
210
240
  - Use PulsePoint conventions in route templates for reactive frontend behavior.
211
241
  - Use `@rpc()` in route/backend code and `pp.rpc()` in client code for browser-triggered data flows.
212
242
  - Use `casp.cache_handler` when a route's first-render HTML should be reused safely across requests.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "caspian-utils",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "description": "Caspian tooling",
5
5
  "main": "index.js",
6
6
  "scripts": {