@polymorphism-tech/morph-spec 7.0.0 → 7.1.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.
- package/README.md +367 -367
- package/framework/agents.json +132 -127
- package/framework/rubrics/backend.json +41 -36
- package/framework/rules/ai-agents-standards.md +45 -15
- package/framework/rules/neon-standards.md +25 -26
- package/framework/standards/STANDARDS.json +1729 -1133
- package/framework/standards/ai-agents/agent-session.md +160 -0
- package/framework/standards/ai-agents/batching.md +193 -0
- package/framework/standards/ai-agents/context-providers.md +188 -0
- package/framework/standards/ai-agents/mcp-server.md +250 -0
- package/framework/standards/ai-agents/mcp-tools.md +197 -0
- package/framework/standards/ai-agents/middleware-patterns.md +207 -0
- package/framework/standards/ai-agents/modalities-image-gen.md +173 -0
- package/framework/standards/ai-agents/modalities-speech-to-text.md +171 -0
- package/framework/standards/ai-agents/modalities-text-to-speech.md +181 -0
- package/framework/standards/ai-agents/modalities-vision.md +201 -0
- package/framework/standards/ai-agents/multi-agent-patterns.md +155 -0
- package/framework/standards/ai-agents/production.md +114 -258
- package/framework/standards/ai-agents/prompts-in-db.md +214 -0
- package/framework/standards/ai-agents/providers/model-registry.md +158 -0
- package/framework/standards/ai-agents/rag-custom-pgvector.md +243 -0
- package/framework/standards/ai-agents/service-tier-flex.md +135 -0
- package/framework/standards/ai-agents/setup.md +142 -316
- package/framework/standards/ai-agents/structured-output.md +249 -0
- package/framework/standards/ai-agents/sweet-spot.md +109 -0
- package/framework/standards/ai-agents/workflows.md +114 -284
- package/framework/standards/architecture/vertical-slice/vertical-slice.md +433 -429
- package/framework/standards/backend/api/validation.md +92 -88
- package/framework/standards/backend/database/postgresql/database.md +336 -332
- package/framework/standards/backend/database/vector-search-rag.md +599 -541
- package/framework/standards/backend/dotnet/fluent-validation-vsa.md +4 -0
- package/framework/standards/backend/dotnet/result-pattern.md +4 -0
- package/framework/standards/backend/dotnet/scalar-ui.md +176 -172
- package/framework/standards/backend/dotnet/scrutor.md +4 -0
- package/framework/standards/backend/dotnet/vsa-handler-patterns.md +278 -274
- package/framework/standards/backend/integrations/asaas/asaas-api.md +260 -216
- package/framework/standards/backend/integrations/hangfire/hangfire-jobs.md +354 -350
- package/framework/standards/backend/integrations/neon-auth/neon-auth.md +30 -19
- package/framework/standards/backend/integrations/resend/resend-email.md +400 -385
- package/framework/standards/data/nosql/cache/redis.md +106 -97
- package/framework/standards/data/nosql/cosmos-db.md +127 -118
- package/framework/standards/data/vector-search/rag-chunking.md +113 -104
- package/framework/standards/frontend/design-system/ai-image-generation.md +4 -0
- package/framework/standards/frontend/design-system/animations.md +164 -160
- package/framework/standards/frontend/design-system/naming.md +68 -64
- package/framework/standards/frontend/gsap/gsap-core.md +14 -8
- package/framework/standards/frontend/gsap/gsap-plugins.md +26 -21
- package/framework/standards/frontend/gsap/gsap-scrolltrigger.md +9 -7
- package/framework/standards/frontend/nextjs/app-router.md +127 -123
- package/framework/standards/frontend/nextjs/components.md +136 -132
- package/framework/standards/frontend/nextjs/data-fetching.md +130 -126
- package/framework/standards/frontend/nextjs/forms.md +134 -128
- package/framework/standards/frontend/nextjs/motion-patterns.md +328 -322
- package/framework/standards/frontend/nextjs/naming-conventions.md +71 -67
- package/framework/standards/frontend/nextjs/nextjs-patterns.md +229 -225
- package/framework/standards/frontend/nextjs/project-structure.md +106 -102
- package/framework/standards/frontend/nextjs/state-management.md +76 -72
- package/framework/standards/frontend/nextjs/testing.md +115 -111
- package/framework/standards/infrastructure/docker/easypanel-deploy.md +196 -192
- package/framework/standards/infrastructure/neon/neon-pgrag.md +6 -2
- package/framework/standards/infrastructure/neon/neon-pgvector.md +4 -0
- package/framework/standards/infrastructure/neon/neon-setup.md +5 -1
- package/framework/standards/integration/mcp/mcp-tools.md +471 -462
- package/framework/templates/REGISTRY.json +1745 -1239
- package/framework/templates/code/dotnet/ai-agents/AgentBootstrap.cs.template +39 -0
- package/framework/templates/code/dotnet/ai-agents/EmbeddingService.cs.template +68 -0
- package/framework/templates/code/dotnet/ai-agents/ModelRegistry.cs.template +117 -0
- package/framework/templates/code/dotnet/ai-agents/PromptRepository.cs.template +95 -0
- package/framework/templates/code/dotnet/ai-agents/ResilientToolMiddleware.cs.template +61 -0
- package/framework/templates/code/dotnet/ai-agents/VectorSearchTool.cs.template +107 -0
- package/framework/templates/code/dotnet/ai-agents/model-registry.json.template +58 -0
- package/framework/templates/code/sql/ai-agents/agent-prompts-migration.sql.template +58 -0
- package/framework/templates/code/sql/ai-agents/pgvector-embeddings-migration.sql.template +91 -0
- package/package.json +89 -83
- package/src/core/templates/template-registry.js +289 -256
- package/src/lib/generators/context-generator.js +516 -518
- package/src/lib/generators/scaffold-generator.js +23 -26
- package/framework/standards/infrastructure/neon/neon-semantic-kernel.md +0 -310
- package/framework/templates/integrations/semantic-kernel-neon.cs +0 -125
|
@@ -1,462 +1,471 @@
|
|
|
1
|
-
# Integration Standard: MCP Tools in MORPH Workflows
|
|
2
|
-
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
//
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
//
|
|
67
|
-
await
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
})
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
#
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
#
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
4.
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
#
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
//
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
//
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
//
|
|
260
|
-
|
|
261
|
-
//
|
|
262
|
-
const
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
const
|
|
267
|
-
|
|
268
|
-
//
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
});
|
|
276
|
-
|
|
277
|
-
//
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
|
294
|
-
|
|
295
|
-
|
|
|
296
|
-
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
//
|
|
318
|
-
|
|
319
|
-
//
|
|
320
|
-
|
|
321
|
-
//
|
|
322
|
-
|
|
323
|
-
//
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
//
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
//
|
|
337
|
-
await
|
|
338
|
-
|
|
339
|
-
//
|
|
340
|
-
await
|
|
341
|
-
|
|
342
|
-
//
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
//
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
//
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
//
|
|
373
|
-
await
|
|
374
|
-
|
|
375
|
-
//
|
|
376
|
-
await
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
#
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
---
|
|
461
|
-
|
|
462
|
-
|
|
1
|
+
# Integration Standard: MCP Tools in MORPH Workflows
|
|
2
|
+
|
|
3
|
+
> **Scope:** integration-mcp
|
|
4
|
+
> **Layer:** 2
|
|
5
|
+
> **Keywords:** mcp, model-context-protocol, mcp-tools, context7, playwright, mcp-client
|
|
6
|
+
> **Load When:** an MCP tool is used in any morph-spec phase
|
|
7
|
+
|
|
8
|
+
**Verified against:** Claude Code MCP tooling — context7, Playwright, GitHub, Neon CLI. Last-verified: 2026-05-20.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
Reference for using Model Context Protocol (MCP) tools across morph-spec phases. Each phase benefits from different MCPs depending on what data is needed.
|
|
13
|
+
|
|
14
|
+
## MCP Availability Detection
|
|
15
|
+
|
|
16
|
+
Before using any MCP tool, check if it's available in the current session:
|
|
17
|
+
|
|
18
|
+
```javascript
|
|
19
|
+
// Pattern: Attempt the call — if the tool doesn't exist, Claude Code will report it
|
|
20
|
+
// There is no "list MCPs" command; just try the most common operation
|
|
21
|
+
|
|
22
|
+
// GitHub MCP
|
|
23
|
+
await mcp__github__get_repo();
|
|
24
|
+
|
|
25
|
+
// Context7 (library docs)
|
|
26
|
+
await mcp__context7__resolve_library_id({ libraryName: "react" });
|
|
27
|
+
|
|
28
|
+
// Playwright (browser automation)
|
|
29
|
+
await mcp__playwright__browser_navigate({ url: "https://example.com" });
|
|
30
|
+
|
|
31
|
+
// Neon — use `neonctl` CLI + `psql`
|
|
32
|
+
// neonctl connection-string → get DB URL
|
|
33
|
+
// psql <DB_URL> -c "SELECT ..."
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Fallback rule:** If an MCP is not available, every phase has a manual alternative using Claude Code native tools (Read, Grep, Glob, Bash).
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## MCP Providers by Phase
|
|
41
|
+
|
|
42
|
+
### Phase 1 (Setup) — Project Discovery
|
|
43
|
+
|
|
44
|
+
| MCP | Use Case | Example |
|
|
45
|
+
|-----|----------|---------|
|
|
46
|
+
| **GitHub** | Repo info, recent PRs, issues | `mcp__github__get_repo()` |
|
|
47
|
+
| **Filesystem** | Scan project structure | Native Glob/Read preferred |
|
|
48
|
+
|
|
49
|
+
```javascript
|
|
50
|
+
// Detect project type from repo metadata
|
|
51
|
+
const repo = await mcp__github__get_repo();
|
|
52
|
+
// → language, default_branch, topics
|
|
53
|
+
|
|
54
|
+
// Fallback: use Glob to detect stack
|
|
55
|
+
// Glob: "**/{package.json,*.csproj,*.sln,go.mod,Cargo.toml}"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Phase 2 (UI/UX) — Design References
|
|
59
|
+
|
|
60
|
+
| MCP | Use Case | Example |
|
|
61
|
+
|-----|----------|---------|
|
|
62
|
+
| **Playwright** | Navigate, screenshot, inspect live pages | `mcp__playwright__browser_navigate({ url })` |
|
|
63
|
+
| **Context7** | Component library documentation | `mcp__context7__query_docs({ libraryId, query })` |
|
|
64
|
+
|
|
65
|
+
```javascript
|
|
66
|
+
// Screenshot existing app for design reference
|
|
67
|
+
await mcp__playwright__browser_navigate({ url: "https://app.example.com/dashboard" });
|
|
68
|
+
const screenshot = await mcp__playwright__browser_take_screenshot();
|
|
69
|
+
// → Visual reference for UI/UX design
|
|
70
|
+
|
|
71
|
+
// Inspect page structure via accessibility tree
|
|
72
|
+
const snapshot = await mcp__playwright__browser_snapshot();
|
|
73
|
+
// → Structured element tree (headings, buttons, inputs, etc.)
|
|
74
|
+
|
|
75
|
+
// Test responsive layout
|
|
76
|
+
await mcp__playwright__browser_resize({ width: 375, height: 812 });
|
|
77
|
+
const mobileScreenshot = await mcp__playwright__browser_take_screenshot();
|
|
78
|
+
|
|
79
|
+
// Get MudBlazor component docs for UI specs
|
|
80
|
+
const libId = await mcp__context7__resolve_library_id({
|
|
81
|
+
libraryName: "mudblazor",
|
|
82
|
+
query: "data grid with sorting and filtering"
|
|
83
|
+
});
|
|
84
|
+
const docs = await mcp__context7__query_docs({
|
|
85
|
+
libraryId: libId,
|
|
86
|
+
query: "DataGrid component props and events"
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// Fallback: WebSearch for component documentation
|
|
90
|
+
// WebFetch for specific component API pages
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Gemini Image MCP — AI Image Generation
|
|
94
|
+
|
|
95
|
+
> Available in: **UI/UX** (preview generation), **Implement** (production assets)
|
|
96
|
+
|
|
97
|
+
| Tool | Use Case | Example |
|
|
98
|
+
|------|----------|---------|
|
|
99
|
+
| `generate_image` | Create new image from text prompt | `mcp__gemini-image-mcp__generate_image({ prompt, aspectRatio, outputPath })` |
|
|
100
|
+
| `edit_image` | Modify existing image | `mcp__gemini-image-mcp__edit_image({ imageSource, prompt })` |
|
|
101
|
+
| `continue_editing` | Iterate on last generated/edited image | `mcp__gemini-image-mcp__continue_editing({ prompt })` |
|
|
102
|
+
| `list_images` | Browse image generation history | `mcp__gemini-image-mcp__list_images({ type: "all" })` |
|
|
103
|
+
| `get_image_info` | Get metadata about a specific image | `mcp__gemini-image-mcp__get_image_info({ imageId })` |
|
|
104
|
+
|
|
105
|
+
```javascript
|
|
106
|
+
// Generate a hero image using design system tokens
|
|
107
|
+
// Read design-system.md first to get project colors and aesthetic direction
|
|
108
|
+
const image = await mcp__gemini_image_mcp__generate_image({
|
|
109
|
+
prompt: "A floating tablet showing a modern dashboard interface on a dark charcoal background with copper and gold accent lighting. Premium luxury aesthetic, photorealistic, cinematic lighting with warm rim light.",
|
|
110
|
+
aspectRatio: "16:9",
|
|
111
|
+
outputPath: "public/images/my-feature/hero-mockup.png"
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
// Edit an existing image (keep edits short and targeted)
|
|
115
|
+
await mcp__gemini_image_mcp__edit_image({
|
|
116
|
+
imageSource: "public/images/my-feature/hero-mockup.png",
|
|
117
|
+
prompt: "Make the lighting warmer and add a subtle copper glow around the tablet edges."
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
// Iterate with continue_editing (one change at a time)
|
|
121
|
+
await mcp__gemini_image_mcp__continue_editing({
|
|
122
|
+
prompt: "More contrast in the shadows."
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
// Fallback: Manual image creation, stock photos, or placeholder divs
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**Use cases by phase:**
|
|
129
|
+
|
|
130
|
+
| Phase | Use Case | Tool |
|
|
131
|
+
|-------|----------|------|
|
|
132
|
+
| UI/UX (2) | Generate preview images for design approval | `generate_image` |
|
|
133
|
+
| Implement (7) | Generate production assets from assets.md specs | `generate_image` + `edit_image` |
|
|
134
|
+
| Implement (7) | Iterate on generated images for quality | `continue_editing` |
|
|
135
|
+
|
|
136
|
+
> **Standard:** See `frontend/design-system/ai-image-generation.md` for prompt engineering patterns, aspect ratio guide, and `assets.md` format.
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
### Phase 3 (Design) — Schema & Architecture
|
|
141
|
+
|
|
142
|
+
| Tool | Use Case | Example |
|
|
143
|
+
|------|----------|---------|
|
|
144
|
+
| **Neon CLI (`neonctl`) / psql** | Database schema, tables, relationships, RLS | `psql <DB_URL> -c "SELECT ..."` |
|
|
145
|
+
| **Context7** | Library docs for architecture decisions | `mcp__context7__query_docs()` |
|
|
146
|
+
| **GitHub** | Check existing code patterns, PRs | `mcp__github__search_code()` |
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
# === SCHEMA ANALYSIS (Critical for contracts.cs) ===
|
|
150
|
+
|
|
151
|
+
# 0. Get Neon DB connection string
|
|
152
|
+
neonctl connection-string
|
|
153
|
+
# → e.g.: postgresql://user:pass@ep-xxx.us-east-2.aws.neon.tech/neondb?sslmode=require
|
|
154
|
+
|
|
155
|
+
# 1. List all tables
|
|
156
|
+
pg_dump $(neonctl connection-string) --schema-only --schema public 2>/dev/null | grep "CREATE TABLE"
|
|
157
|
+
|
|
158
|
+
# 2. Get schema for each relevant table
|
|
159
|
+
psql $(neonctl connection-string) -c "SELECT column_name, data_type, is_nullable, column_default \
|
|
160
|
+
FROM information_schema.columns WHERE table_name = 'leads' ORDER BY ordinal_position"
|
|
161
|
+
|
|
162
|
+
# 3. Get foreign key relationships
|
|
163
|
+
psql $(neonctl connection-string) -c "SELECT tc.table_name, kcu.column_name, ccu.table_name AS foreign_table, \
|
|
164
|
+
ccu.column_name AS foreign_column FROM information_schema.table_constraints tc \
|
|
165
|
+
JOIN information_schema.key_column_usage kcu ON tc.constraint_name = kcu.constraint_name \
|
|
166
|
+
JOIN information_schema.constraint_column_usage ccu ON tc.constraint_name = ccu.constraint_name \
|
|
167
|
+
WHERE tc.constraint_type = 'FOREIGN KEY' AND tc.table_name = 'leads'"
|
|
168
|
+
|
|
169
|
+
# 4. Check RLS policies (security-critical)
|
|
170
|
+
psql $(neonctl connection-string) -c "SELECT tablename, policyname, cmd, qual FROM pg_policies WHERE tablename = 'leads'"
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
**Fallback (Neon database not accessible):**
|
|
174
|
+
```
|
|
175
|
+
1. Grep: "\.from\(|\.select\(|SELECT |DbSet<" → find query files
|
|
176
|
+
2. Read each query file → extract table/column names
|
|
177
|
+
3. Glob: "src/**/types/**/*.ts" or "**/Entities/**/*.cs" → find type definitions
|
|
178
|
+
4. Read type files → map properties to database columns
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Phase 4 (Clarify) — Validation & Research
|
|
182
|
+
|
|
183
|
+
| MCP | Use Case | Example |
|
|
184
|
+
|-----|----------|---------|
|
|
185
|
+
| **Context7** | Verify library capabilities, API limits | `mcp__context7__query_docs()` |
|
|
186
|
+
| **GitHub** | Check issue discussions, known limitations | `mcp__github__search_issues()` |
|
|
187
|
+
|
|
188
|
+
```javascript
|
|
189
|
+
// Verify if library supports a required feature
|
|
190
|
+
const docs = await mcp__context7__query_docs({
|
|
191
|
+
libraryId: "/mudblazor/mudblazor",
|
|
192
|
+
query: "DataGrid server-side pagination with virtual scrolling"
|
|
193
|
+
});
|
|
194
|
+
// → Confirms capability or identifies limitation for spec update
|
|
195
|
+
|
|
196
|
+
// Fallback: WebSearch for library capabilities
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Phase 6 (Tasks) — Planning & Organization
|
|
200
|
+
|
|
201
|
+
| MCP | Use Case | Example |
|
|
202
|
+
|-----|----------|---------|
|
|
203
|
+
| **GitHub** | Create issues from tasks, link to milestone | `mcp__github__create_issue()` |
|
|
204
|
+
| **Context7** | Estimate complexity based on library docs | `mcp__context7__query_docs()` |
|
|
205
|
+
|
|
206
|
+
```javascript
|
|
207
|
+
// Create GitHub issues from tasks.json (if team uses GitHub Projects)
|
|
208
|
+
for (const task of tasks) {
|
|
209
|
+
await mcp__github__create_issue({
|
|
210
|
+
title: task.title,
|
|
211
|
+
body: task.description,
|
|
212
|
+
labels: [task.category],
|
|
213
|
+
milestone: featureMilestone
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// Fallback: Bash with gh CLI
|
|
218
|
+
// gh issue create --title "T001: Create Entity Lead" --label "domain"
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Phase 7 (Implement) — Build & Deploy
|
|
222
|
+
|
|
223
|
+
| Tool | Use Case | Example |
|
|
224
|
+
|------|----------|---------|
|
|
225
|
+
| **Neon CLI (`neonctl`) / psql** | Run migrations, create RLS policies | `dotnet ef database update` |
|
|
226
|
+
| **GitHub** | Create PR, push branches | `mcp__github__create_pull_request()` |
|
|
227
|
+
| **Context7** | Look up API usage during coding | `mcp__context7__query_docs()` |
|
|
228
|
+
| **Playwright** | Smoke test deployed features, verify UI | `mcp__playwright__browser_navigate()` |
|
|
229
|
+
| **Vercel** | Deploy, check logs, manage env vars | `mcp__vercel__list_projects()` |
|
|
230
|
+
| **Azure CLI** | Resource management, deployments | `az` commands |
|
|
231
|
+
| **Docker CLI** | Build, run, compose, logs (local) | `docker` commands |
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
# === NEON (Migrations & RLS via EF Core) ===
|
|
235
|
+
|
|
236
|
+
# Create migration
|
|
237
|
+
dotnet ef migrations add AddStatusToLeads
|
|
238
|
+
|
|
239
|
+
# Apply migration to Neon database
|
|
240
|
+
dotnet ef database update
|
|
241
|
+
|
|
242
|
+
# Verify schema after migration
|
|
243
|
+
psql $(neonctl connection-string) -c "SELECT column_name, data_type FROM information_schema.columns WHERE table_name = 'leads'"
|
|
244
|
+
|
|
245
|
+
# Verify RLS policies
|
|
246
|
+
psql $(neonctl connection-string) -c "SELECT policyname, cmd, qual FROM pg_policies WHERE tablename = 'leads'"
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
```javascript
|
|
250
|
+
// Lookup API during implementation
|
|
251
|
+
const docs = await mcp__context7__query_docs({
|
|
252
|
+
libraryId: "/dotnet/efcore",
|
|
253
|
+
query: "owned entity types configuration"
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
// Smoke test deployed feature via browser
|
|
257
|
+
await mcp__playwright__browser_navigate({ url: "https://localhost:5001/leads" });
|
|
258
|
+
const snapshot = await mcp__playwright__browser_snapshot();
|
|
259
|
+
// → Verify page renders correctly, check for errors
|
|
260
|
+
|
|
261
|
+
// Check for console errors after deploy
|
|
262
|
+
const logs = await mcp__playwright__browser_console_messages();
|
|
263
|
+
// → Catch JavaScript errors, failed API calls
|
|
264
|
+
|
|
265
|
+
// Screenshot for recap.md documentation
|
|
266
|
+
const screenshot = await mcp__playwright__browser_take_screenshot();
|
|
267
|
+
|
|
268
|
+
// === VERCEL (Deployment & Environment) ===
|
|
269
|
+
|
|
270
|
+
// List projects
|
|
271
|
+
const projects = await mcp__vercel__list_projects();
|
|
272
|
+
|
|
273
|
+
// Check deployment status and logs
|
|
274
|
+
const deployments = await mcp__vercel__get_deployments({ projectId: 'my-project' });
|
|
275
|
+
const logs = await mcp__vercel__get_deployment_logs({ deploymentId: deployments[0].uid });
|
|
276
|
+
|
|
277
|
+
// Manage environment variables
|
|
278
|
+
await mcp__vercel__manage_env_vars({
|
|
279
|
+
projectId: 'my-project',
|
|
280
|
+
action: 'set',
|
|
281
|
+
key: 'DATABASE_URL',
|
|
282
|
+
value: process.env.DATABASE_URL,
|
|
283
|
+
target: ['production', 'preview']
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
// Fallback: Bash for gh CLI for PRs, vercel CLI for deployments
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
## MCP vs Native Tools Decision
|
|
292
|
+
|
|
293
|
+
| Need | MCP Tool | Native Alternative |
|
|
294
|
+
|------|----------|--------------------|
|
|
295
|
+
| Database schema | Neon CLI (`neonctl`) / psql | Grep queries + Read types |
|
|
296
|
+
| Repo metadata | GitHub MCP | Bash `gh` CLI |
|
|
297
|
+
| Library docs | Context7 | WebSearch + WebFetch |
|
|
298
|
+
| Live page preview | Playwright MCP | WebFetch URL |
|
|
299
|
+
| Page interaction (click, type, navigate) | Playwright MCP | Manual testing |
|
|
300
|
+
| Responsive layout testing | Playwright MCP (`browser_resize`) | Manual testing |
|
|
301
|
+
| Console error checking | Playwright MCP (`browser_console_messages`) | Browser DevTools |
|
|
302
|
+
| Container ops | Docker CLI (`docker ps`, `docker logs`, `docker compose`) | — |
|
|
303
|
+
| Cloud resources | Azure CLI (`az resource`, `az deployment`) | — |
|
|
304
|
+
| Vercel deployments | Vercel MCP | Bash `vercel` CLI |
|
|
305
|
+
| AI image generation | Gemini Image MCP | Manual creation or stock photos |
|
|
306
|
+
|
|
307
|
+
**Rule:** MCP tools provide structured data (JSON responses). Native tools require manual parsing. **Always prefer MCP when available** — fall back to native when not. **Exceptions:** Neon, Docker, and Azure always use their respective CLIs directly — never MCP.
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
## Common MCP Patterns
|
|
312
|
+
|
|
313
|
+
### Browser (Playwright): Page Automation & Analysis
|
|
314
|
+
|
|
315
|
+
```javascript
|
|
316
|
+
// === SETUP ===
|
|
317
|
+
// Playwright MCP: npx @playwright/mcp@latest
|
|
318
|
+
// Config in .claude/settings.json or claude_desktop_config.json:
|
|
319
|
+
// { "mcpServers": { "playwright": { "command": "npx", "args": ["@playwright/mcp@latest"] } } }
|
|
320
|
+
|
|
321
|
+
// === NAVIGATION & SNAPSHOT ===
|
|
322
|
+
|
|
323
|
+
// 1. Navigate to a page
|
|
324
|
+
await mcp__playwright__browser_navigate({ url: "https://app.example.com/dashboard" });
|
|
325
|
+
|
|
326
|
+
// 2. Take accessibility snapshot (preferred — structured, LLM-friendly)
|
|
327
|
+
const snapshot = await mcp__playwright__browser_snapshot();
|
|
328
|
+
// → Returns accessibility tree with element refs for interaction
|
|
329
|
+
|
|
330
|
+
// 3. Take visual screenshot (requires --caps vision)
|
|
331
|
+
const screenshot = await mcp__playwright__browser_take_screenshot();
|
|
332
|
+
// → Returns PNG image of current page
|
|
333
|
+
|
|
334
|
+
// === INTERACTION ===
|
|
335
|
+
|
|
336
|
+
// 4. Click an element (use ref from snapshot)
|
|
337
|
+
await mcp__playwright__browser_click({ element: "Submit button", ref: "s1e15" });
|
|
338
|
+
|
|
339
|
+
// 5. Type into an input field
|
|
340
|
+
await mcp__playwright__browser_type({ element: "Search input", ref: "s1e8", text: "query" });
|
|
341
|
+
|
|
342
|
+
// 6. Fill a form field (replaces existing value)
|
|
343
|
+
await mcp__playwright__browser_fill_form({ ref: "s1e8", value: "new value" });
|
|
344
|
+
|
|
345
|
+
// 7. Select dropdown option
|
|
346
|
+
await mcp__playwright__browser_select_option({ element: "Status", ref: "s1e12", values: ["active"] });
|
|
347
|
+
|
|
348
|
+
// 8. Press keyboard key
|
|
349
|
+
await mcp__playwright__browser_press_key({ key: "Enter" });
|
|
350
|
+
|
|
351
|
+
// === TABS & NAVIGATION ===
|
|
352
|
+
|
|
353
|
+
// 9. List open tabs
|
|
354
|
+
const tabs = await mcp__playwright__browser_tabs();
|
|
355
|
+
|
|
356
|
+
// 10. Navigate back
|
|
357
|
+
await mcp__playwright__browser_navigate_back();
|
|
358
|
+
|
|
359
|
+
// 11. Close current tab
|
|
360
|
+
await mcp__playwright__browser_close();
|
|
361
|
+
|
|
362
|
+
// === ADVANCED ===
|
|
363
|
+
|
|
364
|
+
// 12. Evaluate JavaScript in page context
|
|
365
|
+
const result = await mcp__playwright__browser_evaluate({
|
|
366
|
+
expression: "document.querySelectorAll('.error').length"
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
// 13. Get console messages (debug)
|
|
370
|
+
const logs = await mcp__playwright__browser_console_messages();
|
|
371
|
+
|
|
372
|
+
// 14. Get network requests
|
|
373
|
+
const requests = await mcp__playwright__browser_network_requests();
|
|
374
|
+
|
|
375
|
+
// 15. Handle dialog (alert, confirm, prompt)
|
|
376
|
+
await mcp__playwright__browser_handle_dialog({ accept: true });
|
|
377
|
+
|
|
378
|
+
// 16. Resize viewport
|
|
379
|
+
await mcp__playwright__browser_resize({ width: 375, height: 812 }); // iPhone viewport
|
|
380
|
+
|
|
381
|
+
// 17. Save page as PDF (requires --caps pdf)
|
|
382
|
+
await mcp__playwright__browser_pdf_save();
|
|
383
|
+
|
|
384
|
+
// 18. Upload file
|
|
385
|
+
await mcp__playwright__browser_file_upload({ ref: "s1e20", paths: ["/path/to/file.png"] });
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
**Use cases by phase:**
|
|
389
|
+
|
|
390
|
+
| Phase | Use Case | Tool |
|
|
391
|
+
|-------|----------|------|
|
|
392
|
+
| UI/UX (2) | Screenshot reference pages for design | `browser_navigate` + `browser_take_screenshot` |
|
|
393
|
+
| UI/UX (2) | Inspect existing app structure | `browser_navigate` + `browser_snapshot` |
|
|
394
|
+
| UI/UX (2) | Test responsive layouts | `browser_resize` + `browser_take_screenshot` |
|
|
395
|
+
| Clarify (4) | Verify existing UI behavior | `browser_navigate` + `browser_snapshot` |
|
|
396
|
+
| Implement (7) | Smoke test deployed features | `browser_navigate` + `browser_click` + `browser_snapshot` |
|
|
397
|
+
| Implement (7) | Verify form flows end-to-end | `browser_fill_form` + `browser_click` + `browser_snapshot` |
|
|
398
|
+
| Implement (7) | Check console errors after deploy | `browser_navigate` + `browser_console_messages` |
|
|
399
|
+
| Implement (7) | Screenshot for recap.md | `browser_take_screenshot` |
|
|
400
|
+
|
|
401
|
+
---
|
|
402
|
+
|
|
403
|
+
### Neon: Full Schema Discovery (via neonctl + psql)
|
|
404
|
+
|
|
405
|
+
> **Primary:** Neon CLI (`neonctl`) + psql connecting to Neon database.
|
|
406
|
+
> **Connection:** Always use `neonctl connection-string` to get the DB URL.
|
|
407
|
+
|
|
408
|
+
```bash
|
|
409
|
+
# Complete workflow for Phase 3 schema analysis
|
|
410
|
+
|
|
411
|
+
# 1. Get Neon DB URL
|
|
412
|
+
neonctl connection-string # → pooled connection string
|
|
413
|
+
|
|
414
|
+
# 2. List all tables
|
|
415
|
+
pg_dump $(neonctl connection-string) --schema-only --schema public 2>/dev/null | grep "CREATE TABLE"
|
|
416
|
+
|
|
417
|
+
# 3. For each relevant table:
|
|
418
|
+
psql $(neonctl connection-string) -c "SELECT column_name, data_type, is_nullable, column_default \
|
|
419
|
+
FROM information_schema.columns WHERE table_name = 'TABLE_NAME' ORDER BY ordinal_position"
|
|
420
|
+
|
|
421
|
+
# 4. Get relationships
|
|
422
|
+
psql $(neonctl connection-string) -c "SELECT tc.table_name, kcu.column_name, ccu.table_name AS foreign_table \
|
|
423
|
+
FROM information_schema.table_constraints tc \
|
|
424
|
+
JOIN information_schema.key_column_usage kcu ON tc.constraint_name = kcu.constraint_name \
|
|
425
|
+
JOIN information_schema.constraint_column_usage ccu ON tc.constraint_name = ccu.constraint_name \
|
|
426
|
+
WHERE tc.constraint_type = 'FOREIGN KEY' AND tc.table_name = 'TABLE_NAME'"
|
|
427
|
+
|
|
428
|
+
# → Write findings to schema-analysis.md
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
### Context7: Library Research
|
|
432
|
+
|
|
433
|
+
```javascript
|
|
434
|
+
// Workflow for any phase needing library documentation
|
|
435
|
+
// Step 1: Resolve library ID
|
|
436
|
+
const lib = await mcp__context7__resolve_library_id({
|
|
437
|
+
libraryName: "fluent-ui-blazor",
|
|
438
|
+
query: "dialog component with form validation"
|
|
439
|
+
});
|
|
440
|
+
|
|
441
|
+
// Step 2: Query specific documentation
|
|
442
|
+
const docs = await mcp__context7__query_docs({
|
|
443
|
+
libraryId: lib.id,
|
|
444
|
+
query: "FluentDialog component usage with EditForm validation"
|
|
445
|
+
});
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
### GitHub: Code Search Across Repo
|
|
449
|
+
|
|
450
|
+
> **v4 config:** Docker — `{ "command": "docker", "args": ["run", "-i", "--rm", "-e", "GITHUB_PERSONAL_ACCESS_TOKEN", "ghcr.io/github/github-mcp-server"] }`. Requires Docker Desktop.
|
|
451
|
+
|
|
452
|
+
```javascript
|
|
453
|
+
// Find patterns in large codebase during Phase 2
|
|
454
|
+
const results = await mcp__github__search_code({
|
|
455
|
+
query: "DbSet leads repo:myorg/myrepo",
|
|
456
|
+
});
|
|
457
|
+
// → Find all places that query the leads table
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
---
|
|
461
|
+
|
|
462
|
+
## Security Considerations
|
|
463
|
+
|
|
464
|
+
- **Never pass secrets** in MCP tool parameters (API keys, tokens, passwords)
|
|
465
|
+
- **Neon** uses neonctl/psql — use database branches for development, not production
|
|
466
|
+
- **GitHub MCP** inherits the configured token's permissions
|
|
467
|
+
- **Always validate tool responses** before using in contracts or code generation
|
|
468
|
+
|
|
469
|
+
---
|
|
470
|
+
|
|
471
|
+
*MORPH-SPEC by Polymorphism Tech*
|