overture-mcp 0.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.
@@ -0,0 +1,832 @@
1
+ # Overture Integration for Claude Code
2
+
3
+ You have access to **Overture**, an MCP server that visualizes your execution plans as interactive flowcharts before you write any code.
4
+
5
+ ## Why Overture Exists
6
+
7
+ Every AI coding agent shares the same fundamental problem: the developer types a prompt, you start working, and they have **no visibility** into what you're planning. By the time they realize you went in the wrong direction, you've already written 200+ lines of code that needs to be discarded.
8
+
9
+ **Overture solves this by making your plan visible, editable, and approvable before execution begins.**
10
+
11
+ ---
12
+
13
+ ## When to Use Overture
14
+
15
+ **USE** Overture for any task involving:
16
+ - Multiple steps or files to create/modify
17
+ - Architectural decisions the user should weigh in on
18
+ - User configuration (API keys, preferences, settings)
19
+ - Complex implementations with multiple valid approaches
20
+ - Tasks where getting alignment upfront saves significant rework
21
+
22
+ **DO NOT USE** Overture for:
23
+ - Simple questions or explanations
24
+ - Single-file, small edits
25
+ - Quick bug fixes with obvious solutions
26
+ - Research or exploration tasks
27
+
28
+ ---
29
+
30
+ ## Critical: Extended Planning Mode
31
+
32
+ **Your plans must be comprehensive, deeply detailed, and broken down to the atomic level.**
33
+
34
+ Unlike simple 5-10 step outlines, Overture expects you to generate **fully decomposed plans** where every task is broken into its smallest meaningful units. This is not optional — thorough planning prevents wasted tokens, wasted time, and developer frustration.
35
+
36
+ ### Planning Requirements
37
+
38
+ For every task you receive, your plan must include:
39
+
40
+ 1. **Atomic Decomposition**: Break every task into its smallest executable steps
41
+ 2. **Rich Node Details**: Every node needs title, description, complexity, expected output, and risks
42
+ 3. **Decision Points**: Use `decision` nodes whenever multiple valid approaches exist
43
+ 4. **Dynamic Fields**: Declare any inputs needed from the user (API keys, config, preferences)
44
+ 5. **Logical Dependencies**: Edges should reflect true execution order
45
+
46
+ ### Example: Proper Decomposition
47
+
48
+ If a user asks for "a full-stack e-commerce app with Stripe integration," your plan should include nodes like:
49
+
50
+ **Project Setup Phase:**
51
+ - Initialize Next.js project with TypeScript and App Router
52
+ - Configure Tailwind CSS and component library
53
+ - Set up ESLint and Prettier configuration
54
+ - Initialize Git repository with .gitignore
55
+
56
+ **Database Phase:**
57
+ - Decision node: Choose database (PostgreSQL vs Planetscale vs Supabase)
58
+ - Configure Prisma ORM with selected database
59
+ - Create database schema (products, users, orders, cart)
60
+ - Set up database migrations
61
+
62
+ **Authentication Phase:**
63
+ - Decision node: Choose auth approach (NextAuth vs Clerk vs custom)
64
+ - Implement sign up flow with email verification
65
+ - Implement login flow with session management
66
+ - Add password reset functionality
67
+
68
+ **Product Catalog:**
69
+ - Create Product model and API routes
70
+ - Build product listing page with filters
71
+ - Build product detail page
72
+ - Implement search functionality
73
+
74
+ **Shopping Cart:**
75
+ - Create Cart context/store
76
+ - Build cart drawer/page component
77
+ - Implement add/remove/update quantity
78
+ - Add cart persistence (localStorage + database sync)
79
+
80
+ **Stripe Integration:**
81
+ - Configure Stripe API keys
82
+ - Create checkout session endpoint
83
+ - Build checkout page with Stripe Elements
84
+ - Implement webhook handler for payment events
85
+ - Handle success/failure states
86
+
87
+ **Order Management:**
88
+ - Create Order model and API routes
89
+ - Build order confirmation page
90
+ - Implement order history page
91
+ - Add email notifications
92
+
93
+ **Deployment:**
94
+ - Decision node: Choose platform (Vercel vs Railway vs custom)
95
+ - Configure environment variables
96
+ - Set up CI/CD pipeline
97
+ - Configure production database
98
+
99
+ Each of these becomes a node on the visual canvas with full details, risks, and expected outputs.
100
+
101
+ ---
102
+
103
+ ## MCP Tools
104
+
105
+ | Tool | Input | Purpose |
106
+ |------|-------|---------|
107
+ | `submit_plan` | `{ plan_xml, workspace_path?, agent_type? }` | Submit complete XML plan |
108
+ | `stream_plan_chunk` | `{ xml_chunk, workspace_path?, agent_type? }` | Stream XML incrementally for real-time display |
109
+ | `get_approval` | `{ project_id? }` | Wait for user approval (may return "pending" — call again) |
110
+ | `update_node_status` | `{ node_id, status, output?, project_id? }` | Update execution progress |
111
+ | `plan_completed` | `{ project_id? }` | Mark plan done |
112
+ | `plan_failed` | `{ error, project_id? }` | Mark plan failed |
113
+ | `check_rerun` | `{ timeout_ms?, project_id? }` | Check if user wants to re-run nodes (call after plan_completed) |
114
+ | `check_pause` | `{ wait?, project_id? }` | Check if user paused execution (call before each node) |
115
+ | `get_resume_info` | `{ project_id? }` | Get state info for resuming a paused/failed plan |
116
+ | `request_plan_update` | `{ operations, project_id? }` | Apply incremental updates to the plan (insert, delete, replace) |
117
+ | `create_new_plan` | `{ project_id? }` | Signal you're creating a new unrelated plan (adds alongside existing) |
118
+
119
+ ### Multi-Project Support
120
+
121
+ Overture supports multiple projects running simultaneously. Each project gets its own tab in the UI.
122
+
123
+ - **`workspace_path`**: Pass the absolute path to your project directory when calling `submit_plan` or `stream_plan_chunk`. This enables project isolation and history tracking.
124
+ - **`agent_type`**: Identify yourself (e.g., "claude-code") so the UI shows the correct agent name.
125
+ - **`project_id`** / **`expected_project_id`**: **CRITICAL** - These are returned in the response from `submit_plan` and `stream_plan_chunk`. **YOU MUST use this exact value** in ALL subsequent calls (`get_approval`, `update_node_status`, `plan_completed`, etc.). The frontend uses this ID to match your approval request.
126
+
127
+ **Example workflow:**
128
+ ```
129
+ 1. Call submit_plan({ plan_xml, workspace_path: "/path/to/project" })
130
+ 2. Response: { success: true, projectId: "84393059027d", expected_project_id: "84393059027d" }
131
+ 3. Call get_approval({ project_id: "84393059027d" }) ← MUST match!
132
+ 4. Call update_node_status({ node_id: "n1", status: "active", project_id: "84393059027d" })
133
+ ```
134
+
135
+ If you don't pass `workspace_path`, Overture uses a default project which works fine for single-project scenarios.
136
+
137
+ ### Updating an Existing Plan
138
+
139
+ When the user requests changes to an existing plan, use `request_plan_update` with an array of operations. This applies incremental updates with smooth animations instead of regenerating the entire plan.
140
+
141
+ **Supported operations:**
142
+ - `insert_after` - Insert a node after a reference node
143
+ - `insert_before` - Insert a node before a reference node
144
+ - `delete` - Delete a node (edges auto-reconnect)
145
+ - `replace` - Replace a node's content in-place
146
+
147
+ **Example - Adding a testing step:**
148
+ ```json
149
+ request_plan_update({
150
+ "operations": [
151
+ {
152
+ "op": "insert_after",
153
+ "reference_node_id": "node_api",
154
+ "node": {
155
+ "id": "node_test",
156
+ "type": "task",
157
+ "title": "Run unit tests",
158
+ "description": "Execute test suite and verify all tests pass"
159
+ }
160
+ }
161
+ ]
162
+ })
163
+ ```
164
+
165
+ **Example - Multiple operations at once:**
166
+ ```json
167
+ request_plan_update({
168
+ "operations": [
169
+ { "op": "delete", "node_id": "node_deploy" },
170
+ {
171
+ "op": "replace",
172
+ "node_id": "node_5",
173
+ "node": {
174
+ "title": "Updated title",
175
+ "description": "Updated description with more detail"
176
+ }
177
+ },
178
+ {
179
+ "op": "insert_before",
180
+ "reference_node_id": "node_final",
181
+ "node": {
182
+ "id": "node_review",
183
+ "type": "task",
184
+ "title": "Code review",
185
+ "description": "Review all changes before finalizing"
186
+ }
187
+ }
188
+ ]
189
+ })
190
+ ```
191
+
192
+ After calling `request_plan_update`, call `get_approval()` to confirm changes with the user.
193
+
194
+ ### Creating a New Unrelated Plan
195
+
196
+ If the user asks for something completely unrelated to the current plan (e.g., "forget that, let's build X instead"):
197
+
198
+ 1. **Call `create_new_plan`** — This clears the current plan state
199
+ 2. **Call `submit_plan` or `stream_plan_chunk`** with the new plan XML
200
+ 3. **Call `get_approval`** to wait for user approval
201
+ 4. Proceed with execution once approved
202
+
203
+ **Example workflow:**
204
+ ```
205
+ 1. User: "Actually, let's work on the authentication system instead"
206
+ 2. You call: create_new_plan({ project_id })
207
+ 3. You call: submit_plan({ plan_xml: "<new auth system plan>" })
208
+ 4. You call: get_approval({ project_id })
209
+ 5. Execute nodes as normal
210
+ ```
211
+
212
+ ---
213
+
214
+ ## XML Plan Schema
215
+
216
+ ```xml
217
+ <plan id="plan_001" title="Comprehensive Plan Title" agent="claude-code">
218
+ <nodes>
219
+ <!-- Task node with full details -->
220
+ <node id="n1" type="task" status="pending">
221
+ <title>Clear, specific step title</title>
222
+ <description>
223
+ Detailed explanation of what this step accomplishes.
224
+ Include context about why this step is necessary.
225
+ Explain the technical approach you'll take.
226
+ </description>
227
+ <complexity>low|medium|high</complexity>
228
+ <expected_output>
229
+ Specific deliverables:
230
+ - Files created: src/components/Button.tsx
231
+ - APIs integrated: Stripe checkout session
232
+ - Database changes: New User table
233
+ </expected_output>
234
+ <risks>
235
+ What could go wrong? Edge cases to handle?
236
+ - Risk: API rate limiting
237
+ - Mitigation: Implement exponential backoff
238
+ </risks>
239
+
240
+ <!-- Dynamic fields for user input -->
241
+ <dynamic_field
242
+ id="f1"
243
+ name="stripe_secret_key"
244
+ type="secret"
245
+ required="true"
246
+ title="Stripe Secret Key"
247
+ description="Your Stripe secret API key for payment processing"
248
+ setup_instructions="Get from dashboard.stripe.com/apikeys. Use test key (sk_test_...) for development."
249
+ />
250
+
251
+ <dynamic_field
252
+ id="f2"
253
+ name="enable_typescript"
254
+ type="boolean"
255
+ required="false"
256
+ title="Enable TypeScript"
257
+ description="Use TypeScript for type safety"
258
+ value="true"
259
+ />
260
+
261
+ <dynamic_field
262
+ id="f3"
263
+ name="css_framework"
264
+ type="select"
265
+ required="true"
266
+ title="CSS Framework"
267
+ description="Choose your styling approach"
268
+ options="Tailwind CSS,CSS Modules,Styled Components,Plain CSS"
269
+ value="Tailwind CSS"
270
+ />
271
+ </node>
272
+
273
+ <!-- Decision node when multiple approaches are valid -->
274
+ <node id="n2" type="decision" status="pending">
275
+ <title>Select Authentication Strategy</title>
276
+ <description>
277
+ Choose how users will authenticate with your application.
278
+ This affects security model, user experience, and maintenance burden.
279
+ </description>
280
+
281
+ <branch id="b1" label="NextAuth.js">
282
+ <description>Full-featured auth library with provider support</description>
283
+ <pros>Many OAuth providers, session management, database adapters</pros>
284
+ <cons>Can be complex to customize, learning curve</cons>
285
+ </branch>
286
+
287
+ <branch id="b2" label="Clerk">
288
+ <description>Managed authentication service</description>
289
+ <pros>Beautiful UI components, easy setup, handles edge cases</pros>
290
+ <cons>Third-party dependency, potential vendor lock-in, costs at scale</cons>
291
+ </branch>
292
+
293
+ <branch id="b3" label="Custom JWT">
294
+ <description>Build authentication from scratch</description>
295
+ <pros>Full control, no dependencies, deep understanding</pros>
296
+ <cons>Security risks if done wrong, more code to maintain</cons>
297
+ </branch>
298
+ </node>
299
+
300
+ <!-- Task linked to a specific branch -->
301
+ <node id="n3" type="task" status="pending" branch_parent="n2" branch_id="b1">
302
+ <title>Configure NextAuth.js</title>
303
+ <description>
304
+ Set up NextAuth.js with email/password and OAuth providers.
305
+ Configure session strategy and database adapter.
306
+ </description>
307
+ <complexity>medium</complexity>
308
+ <expected_output>
309
+ - /app/api/auth/[...nextauth]/route.ts configured
310
+ - Prisma adapter connected
311
+ - Google OAuth provider enabled
312
+ - Session callback customized
313
+ </expected_output>
314
+ <risks>
315
+ - OAuth redirect URLs must match exactly
316
+ - Database session table must exist
317
+ </risks>
318
+
319
+ <dynamic_field
320
+ id="f4"
321
+ name="google_client_id"
322
+ type="string"
323
+ required="true"
324
+ title="Google OAuth Client ID"
325
+ setup_instructions="Create at console.cloud.google.com/apis/credentials"
326
+ />
327
+
328
+ <dynamic_field
329
+ id="f5"
330
+ name="google_client_secret"
331
+ type="secret"
332
+ required="true"
333
+ title="Google OAuth Client Secret"
334
+ setup_instructions="From the same OAuth 2.0 Client ID"
335
+ />
336
+ </node>
337
+ </nodes>
338
+
339
+ <edges>
340
+ <edge id="e1" from="n1" to="n2" />
341
+ <edge id="e2" from="n2" to="n3" />
342
+ </edges>
343
+ </plan>
344
+ ```
345
+
346
+ ---
347
+
348
+ ## Dynamic Field Types
349
+
350
+ | Type | Use Case | Required Attributes |
351
+ |------|----------|---------------------|
352
+ | `string` | Text input | `name`, `title` |
353
+ | `secret` | Masked input for sensitive data | `name`, `title`, `setup_instructions` |
354
+ | `select` | Dropdown options | `name`, `title`, `options` (comma-separated) |
355
+ | `boolean` | Toggle switch | `name`, `title` |
356
+ | `number` | Numeric input | `name`, `title` |
357
+
358
+ **Always include `setup_instructions`** when the user needs to obtain a value from an external service.
359
+
360
+ ---
361
+
362
+ ## CRITICAL: Node-by-Node Execution (DO NOT OVER-IMPLEMENT)
363
+
364
+ **YOU MUST ONLY IMPLEMENT THE CURRENT NODE.** This is non-negotiable.
365
+
366
+ When you receive a node (via `firstNode` from `get_approval` or `nextNode` from `update_node_status`), you must:
367
+
368
+ ### DO:
369
+ - **ONLY** implement what is described in that specific node's `title` and `description`
370
+ - **CONSUME ALL** fields in `fieldValues` — every single one must be used
371
+ - **READ AND USE ALL** files in `attachments` — do not ignore any attached file
372
+ - **FOLLOW EXACTLY** the `metaInstructions` if present — these are user directives
373
+ - **USE THE MCP SERVER** as specified in `mcpServers.formattedInstructions` if present
374
+ - **RESPECT** the node's `complexity`, `expectedOutput`, and `risks`
375
+
376
+ ### DO NOT:
377
+ - Implement tasks from future nodes
378
+ - "Get ahead" by doing work not specified in the current node
379
+ - Skip any field, attachment, or instruction in the current node
380
+ - Assume what comes next — wait for the next node
381
+ - Add features or functionality not explicitly in the node description
382
+
383
+ ### Why This Matters
384
+
385
+ Each node is a contract. The user approved a specific plan with specific nodes. If you over-implement:
386
+ - You break the visual progress tracking (nodes won't match actual work)
387
+ - You may contradict decisions the user will make in future nodes
388
+ - You waste tokens on work that might need to be redone
389
+ - You violate the user's trust in the plan they approved
390
+
391
+ ### Checklist Before Completing a Node
392
+
393
+ Before calling `update_node_status(node_id, "completed", output)`, verify:
394
+ - [ ] **Did I check for `mcpServers` FIRST?** (If present, did I install it if needed?)
395
+ - [ ] **Did I USE the `mcpServers` tools** as specified in `formattedInstructions`? (if present)
396
+ - [ ] Did I implement ONLY what this node's description specified?
397
+ - [ ] Did I use EVERY value in `fieldValues`?
398
+ - [ ] Did I read and incorporate EVERY file in `attachments`?
399
+ - [ ] Did I follow the `metaInstructions` exactly?
400
+ - [ ] Did I NOT do any work belonging to other nodes?
401
+
402
+ ---
403
+
404
+ ## Execution Workflow
405
+
406
+ ```
407
+ 1. Receive task from user
408
+ 2. Analyze task complexity
409
+ - If simple (single file, obvious fix): execute directly without Overture
410
+ - If complex (multiple files, decisions, config needed): use Overture
411
+ 3. Generate comprehensive XML plan
412
+ 4. Call submit_plan (or stream_plan_chunk for incremental display)
413
+ 5. Call get_approval and handle response:
414
+ - status: "pending" → call get_approval again (user is still reviewing)
415
+ - status: "approved" → you receive firstNode with all its config
416
+ - status: "cancelled" → stop and inform user
417
+ 6. FOR EACH NODE (starting with firstNode), execute in this EXACT order:
418
+ a. Call update_node_status(node_id, "active")
419
+
420
+ b. **FIRST: CHECK FOR MCP SERVER** ← THIS IS MANDATORY
421
+ - If node.mcpServers exists:
422
+ 1. Check if MCP server is already installed/configured
423
+ 2. If NOT installed: STOP and install it following mcpServers.readmeContent
424
+ 3. Verify installation by calling one of the MCP server's tools
425
+ 4. Only then proceed to use it for the node's task
426
+
427
+ c. Execute the node's task using:
428
+ - node.fieldValues (use ALL of them)
429
+ - node.attachments (read and use ALL files)
430
+ - node.metaInstructions (follow EXACTLY)
431
+ - node.mcpServers tools (if present, use as specified in formattedInstructions)
432
+
433
+ d. Call update_node_status(node_id, "completed", output)
434
+ e. Check response: if isPaused is true, call check_pause({ wait: true })
435
+ f. Get nextNode from response, or isLastNode: true
436
+ g. If error: update_node_status(node_id, "failed", error) and plan_failed(error)
437
+
438
+ 7. Repeat step 6 for each nextNode until isLastNode is true
439
+ 8. Call plan_completed when all nodes succeed
440
+ ```
441
+
442
+ ### ⚠️ MCP SERVER CHECK IS STEP 6b - DO NOT SKIP
443
+
444
+ When you receive ANY node (firstNode or nextNode), your **FIRST ACTION** after marking it active must be:
445
+
446
+ ```
447
+ IF node.mcpServers EXISTS:
448
+ → STOP everything else
449
+ → Try to use one of the MCP server's tools to check if it's installed
450
+ → If you get "No connection found" or similar error:
451
+ ╔══════════════════════════════════════════════════════════════╗
452
+ ║ DO NOT SKIP TO THE NEXT NODE ║
453
+ ║ DO NOT IGNORE THIS ERROR ║
454
+ ║ YOU MUST INSTALL THE MCP SERVER NOW ║
455
+ ╚══════════════════════════════════════════════════════════════╝
456
+ 1. Read mcpServers.readmeContent for installation instructions
457
+ 2. Install the MCP server (uvx, pip, docker, etc.)
458
+ 3. Configure it in the MCP settings file
459
+ 4. Retry the tool call to verify installation
460
+ → Once working, use the MCP server for the node's task
461
+ ```
462
+
463
+ ### 🚨 CRITICAL: "No connection found" Error Handling
464
+
465
+ If you attempt to use an MCP tool and receive an error like:
466
+ ```
467
+ Error executing MCP tool: No connection found for server: [server-name]
468
+ ```
469
+
470
+ **THIS IS NOT A REASON TO SKIP THE NODE OR PROCEED WITHOUT THE MCP SERVER.**
471
+
472
+ You MUST:
473
+ 1. **STOP** - Do not continue with the node's task
474
+ 2. **INSTALL** - Follow the installation instructions in `mcpServers.readmeContent`
475
+ 3. **CONFIGURE** - Add the server to the MCP settings file
476
+ 4. **VERIFY** - Call the tool again to confirm it works
477
+ 5. **THEN CONTINUE** - Only after successful verification, proceed with the node's task
478
+
479
+ **The user attached this MCP server because they NEED it for this node. Skipping it defeats the entire purpose.**
480
+
481
+ ## Response Payloads
482
+
483
+ ### get_approval (when approved)
484
+ ```json
485
+ {
486
+ "status": "approved",
487
+ "firstNode": {
488
+ "id": "n1",
489
+ "title": "Initialize Project",
490
+ "type": "task",
491
+ "description": "Set up the project structure",
492
+ "fieldValues": { "api_key": "sk-..." },
493
+ "attachments": [{ "path": "/path/to/file", "name": "spec.md", "type": "document" }],
494
+ "metaInstructions": "Use TypeScript strict mode",
495
+ "mcpServers": { ... }
496
+ },
497
+ "message": "Plan approved by user. Execute firstNode, then call update_node_status to get the next node."
498
+ }
499
+ ```
500
+
501
+ **Note:** Each node's configuration is included directly in the node object. You receive nodes one at a time — `firstNode` from `get_approval`, then `nextNode` from each `update_node_status` call.
502
+
503
+ ### update_node_status (when completed)
504
+ ```json
505
+ {
506
+ "success": true,
507
+ "message": "Node n1 status updated to completed",
508
+ "nextNode": {
509
+ "id": "n2",
510
+ "title": "Configure Database",
511
+ "type": "task",
512
+ "description": "Set up database connection",
513
+ "fieldValues": { "database_url": "postgres://..." },
514
+ "attachments": [],
515
+ "metaInstructions": "Use connection pooling"
516
+ }
517
+ }
518
+ ```
519
+
520
+ When it's the last node:
521
+ ```json
522
+ {
523
+ "success": true,
524
+ "message": "Node n5 status updated to completed. This was the last node.",
525
+ "isLastNode": true
526
+ }
527
+ ```
528
+
529
+ ### check_rerun (after plan_completed)
530
+ ```json
531
+ {
532
+ "hasRerun": true,
533
+ "nodeId": "n3",
534
+ "mode": "single", // or "to-bottom"
535
+ "nodeInfo": { ... },
536
+ "message": "Rerun requested from node n3 (single)"
537
+ }
538
+ ```
539
+
540
+ ## Pause/Resume Workflow
541
+
542
+ Users can pause execution at any time by clicking the pause button or pressing Space. The `isPaused` flag is included in every `update_node_status` response, so you don't need to poll.
543
+
544
+ ```
545
+ After completing a node:
546
+ 1. Call update_node_status(node_id, "completed", output)
547
+ 2. Check response.isPaused:
548
+ - If false → proceed to nextNode
549
+ - If true → call check_pause({ wait: true }) to block until resumed
550
+ 3. Continue execution
551
+ ```
552
+
553
+ ### update_node_status Response (with pause)
554
+ ```json
555
+ {
556
+ "success": true,
557
+ "message": "Node n1 status updated to completed",
558
+ "nextNode": { ... },
559
+ "isPaused": true
560
+ }
561
+ ```
562
+
563
+ ### check_pause Response (after waiting)
564
+ ```json
565
+ {
566
+ "isPaused": false,
567
+ "wasResumed": true,
568
+ "message": "Execution was paused and has now been resumed"
569
+ }
570
+ ```
571
+
572
+ ---
573
+
574
+ ## Resume Plan Workflow
575
+
576
+ When a plan was paused, failed, or loaded from history, use `get_resume_info` to understand where execution stopped and continue from there.
577
+
578
+ ### get_resume_info Response
579
+ ```json
580
+ {
581
+ "success": true,
582
+ "resumeInfo": {
583
+ "planId": "plan_123",
584
+ "planTitle": "Build Authentication System",
585
+ "agent": "claude-code",
586
+ "status": "paused",
587
+ "projectId": "abc123",
588
+ "workspacePath": "/Users/dev/my-project",
589
+
590
+ "currentNodeId": "n3",
591
+ "currentNodeTitle": "Configure Database",
592
+ "currentNodeStatus": "active",
593
+
594
+ "completedNodes": [
595
+ { "id": "n1", "title": "Initialize Project", "output": "Created package.json..." },
596
+ { "id": "n2", "title": "Install Dependencies", "output": "Installed 15 packages" }
597
+ ],
598
+ "pendingNodes": [
599
+ { "id": "n4", "title": "Create User Model", "description": "Define user schema..." },
600
+ { "id": "n5", "title": "Implement Auth Routes", "description": "Create login/signup..." }
601
+ ],
602
+ "failedNodes": [],
603
+
604
+ "fieldValues": { "n3.database_url": "postgres://..." },
605
+ "selectedBranches": { "n2": "branch_prisma" },
606
+ "nodeConfigs": { ... },
607
+
608
+ "createdAt": "2024-01-15T10:30:00Z",
609
+ "pausedAt": "2024-01-15T11:45:00Z"
610
+ },
611
+ "message": "Resume info retrieved. Plan is at status 'paused'. Current node: Configure Database (active). Completed: 2, Pending: 2, Failed: 0"
612
+ }
613
+ ```
614
+
615
+ ### Resume Workflow
616
+
617
+ ```
618
+ 1. Call get_resume_info to understand the current state
619
+ 2. Identify the current node (resumeInfo.currentNodeId)
620
+ 3. If currentNodeStatus is "active" or "failed":
621
+ - Resume execution from that node
622
+ - Use the fieldValues, selectedBranches, and nodeConfigs
623
+ 4. Call update_node_status to continue the normal execution flow
624
+ 5. Proceed with subsequent nodes until isLastNode is true
625
+ 6. Call plan_completed when done
626
+ ```
627
+
628
+ ### When to Use get_resume_info
629
+
630
+ - After a plan was **paused** by the user and you need to resume
631
+ - After a plan **failed** and you want to retry from the failed node
632
+ - When loading a plan from **history** to continue where it left off
633
+ - When you lose context and need to understand the current execution state
634
+
635
+ ---
636
+
637
+ ## Re-run Workflow
638
+
639
+ After `plan_completed`, users can click re-run buttons on any node:
640
+ - **Play icon**: Re-run just that single node
641
+ - **Play + down arrow**: Re-run from that node to the end of the plan
642
+
643
+ This allows users to:
644
+ 1. Fix a failed node and re-run it
645
+ 2. Try an alternative branch after completing the initial branch
646
+ 3. Re-execute part of the plan with different inputs
647
+
648
+ ```
649
+ 1. Call plan_completed when done
650
+ 2. Loop: call check_rerun (with short timeout)
651
+ - If hasRerun is false, continue checking or exit
652
+ - If hasRerun is true:
653
+ a. Execute nodeInfo (same as normal node execution)
654
+ b. If mode is "to-bottom", continue to subsequent nodes
655
+ c. Call plan_completed again
656
+ d. Return to step 2
657
+ ```
658
+
659
+ ---
660
+
661
+ ## Handling User Additions
662
+
663
+ Each node you receive (via `firstNode` or `nextNode`) includes all user customizations directly:
664
+
665
+ ```json
666
+ {
667
+ "id": "n1",
668
+ "title": "Initialize Project",
669
+ "fieldValues": { "api_key": "sk_test_..." },
670
+ "attachments": [
671
+ { "path": "/Users/dev/project/design.figma", "name": "design.figma", "type": "other" },
672
+ { "path": "/Users/dev/project/api-spec.yaml", "name": "api-spec.yaml", "type": "code" }
673
+ ],
674
+ "metaInstructions": "Use the exact colors from the Figma file. Follow the API spec strictly.",
675
+ "mcpServers": { ... }
676
+ }
677
+ ```
678
+
679
+ **Attachments**: Read these files and incorporate their content into your work for that node.
680
+
681
+ **Meta Instructions**: These are specific directives from the user for how to execute this node. Follow them precisely.
682
+
683
+ **MCP Server**: If present, use the MCP server as specified in `formattedInstructions`. See the MCP Server Integration section below.
684
+
685
+ ---
686
+
687
+ ## MCP Server Integration (CRITICAL)
688
+
689
+ Users can attach **MCP servers** to individual nodes to extend your capabilities. When a node has an MCP server attached, the `nextNode` response will include an `mcpServers` object with a `formattedInstructions` field.
690
+
691
+ ### Example Response with MCP Server
692
+ ```json
693
+ {
694
+ "success": true,
695
+ "nextNode": {
696
+ "id": "n5",
697
+ "title": "Generate product images",
698
+ "fieldValues": { ... },
699
+ "attachments": [],
700
+ "mcpServers": {
701
+ "name": "replicate-mcp",
702
+ "author": "replicate",
703
+ "description": "Generate images using Replicate AI models",
704
+ "githubUrl": "https://github.com/replicate/replicate-mcp",
705
+ "requiresApiKey": true,
706
+ "readmeContent": "# replicate-mcp\n\n## Installation\n...",
707
+ "formattedInstructions": "=== MCP SERVER INTEGRATION ===\n..."
708
+ }
709
+ }
710
+ }
711
+ ```
712
+
713
+ ### MANDATORY Requirements
714
+
715
+ When `mcpServers` is present on a node:
716
+
717
+ 1. **YOU MUST** use the MCP server exactly as described by the user in `formattedInstructions`
718
+ 2. **YOU MUST** follow the user's intended usage precisely — they specified why they attached this MCP
719
+ 3. **IF THE MCP SERVER IS NOT AVAILABLE OR NOT CONFIGURED**, follow the Setup Instructions below
720
+
721
+ ### Setup Instructions (When MCP Server Not Available)
722
+
723
+ The `mcpServers.formattedInstructions` field now includes **provider-specific setup instructions** tailored for Claude Code. Follow them exactly.
724
+
725
+ **Claude Code MCP Configuration:**
726
+
727
+ **Option 1: Using CLI (Recommended)**
728
+ ```bash
729
+ claude mcp add server-name --scope user
730
+ ```
731
+
732
+ **Option 2: Direct Configuration**
733
+ - **User scope:** `~/.claude.json`
734
+ - **Project scope:** `.mcp.json` (in project root)
735
+
736
+ **Setup Steps:**
737
+ 1. **Use CLI** or open the config file
738
+ 2. **Read existing config** if it exists — DO NOT overwrite other servers
739
+ 3. **Add the new server** configuration
740
+ 4. **Save the file**
741
+ 5. **Verify** using `claude mcp list` or by calling one of the MCP server's tools
742
+
743
+ **Example Configuration:**
744
+ ```json
745
+ {
746
+ "mcpServers": {
747
+ "server-name": {
748
+ "type": "stdio",
749
+ "command": "uvx",
750
+ "args": ["mcp-server-name"]
751
+ }
752
+ }
753
+ }
754
+ ```
755
+
756
+ **Verification Commands:**
757
+ ```bash
758
+ claude mcp list
759
+ claude mcp get server-name
760
+ ```
761
+
762
+ ### Setup Workflow
763
+
764
+ ```
765
+ 1. Try to use the MCP server
766
+ 2. If you get "No connection found" error:
767
+ a. Read mcpServers.formattedInstructions for provider-specific setup
768
+ b. Read mcpServers.readmeContent for installation commands
769
+ c. Use `claude mcp add` or edit config file directly
770
+ d. Read existing config (DO NOT OVERWRITE existing servers)
771
+ e. Add the new server configuration
772
+ f. Install dependencies (uvx, pip, etc.)
773
+ g. Verify with `claude mcp list`
774
+ h. Retry the MCP tool call to verify installation
775
+ 3. Once working, use the MCP server for the node's task
776
+ ```
777
+
778
+ ### Why This Matters
779
+
780
+ Users attach MCP servers because they want specific capabilities for specific nodes. Ignoring this is equivalent to ignoring their explicit instructions. The `mcpServers` object contains everything you need:
781
+ - `name`, `author`, `description` — Server identification
782
+ - `githubUrl` — Source repository for documentation
783
+ - `readmeContent` — Installation and usage instructions
784
+ - `requiresApiKey` — Whether API key configuration is needed
785
+ - `formattedInstructions` — User's intended usage and critical compliance instructions
786
+
787
+ **Always check for `mcpServers` on every node and honor its instructions.**
788
+
789
+ ---
790
+
791
+ ## Best Practices
792
+
793
+ 1. **Decompose thoroughly**: One action per node. "Set up project" is too vague; "Initialize Vite with React and TypeScript" is specific.
794
+
795
+ 2. **Use decision nodes liberally**: Whenever you'd normally make an assumption about approach, create a decision node instead.
796
+
797
+ 3. **Declare all inputs upfront**: Every API key, credential, or config value needed at runtime should be a dynamic field.
798
+
799
+ 4. **Be specific in descriptions**: Users should understand exactly what will happen without ambiguity.
800
+
801
+ 5. **Document expected outputs**: List specific files, functions, or changes that will result from each node.
802
+
803
+ 6. **Include risks and mitigations**: Show you've thought about what could go wrong.
804
+
805
+ 7. **Update status in real-time**: Call `update_node_status("active")` before starting and `update_node_status("completed", output)` when done.
806
+
807
+ 8. **Honor user additions**: Always check for and follow `metaInstructions`. Always read and use `attachments`.
808
+
809
+ 9. **Stream for long plans**: Use `stream_plan_chunk` for plans with many nodes so users see progress immediately.
810
+
811
+ 10. **Honor MCP servers**: When a node has `mcpServers`, follow its `formattedInstructions` precisely — this is the user's explicit request for extended capabilities.
812
+
813
+ ---
814
+
815
+ ## The Value Proposition
816
+
817
+ **Without Overture:**
818
+ - User: "Build me an e-commerce site"
819
+ - You: Start coding immediately
820
+ - 20 minutes later: User realizes you used MongoDB when they wanted PostgreSQL
821
+ - Result: Wasted tokens, wasted time, frustrated user
822
+
823
+ **With Overture:**
824
+ - User: "Build me an e-commerce site"
825
+ - You: Generate detailed plan with database decision node
826
+ - User: Reviews plan, selects PostgreSQL, adds Stripe API key, attaches design file
827
+ - You: Execute exactly what they approved with their exact inputs
828
+ - Result: Perfect alignment, happy user
829
+
830
+ ---
831
+
832
+ > "The best time to shape the plan is before the first line of code is written." — Overture by Sixth