@leclabs/agent-flow-navigator-mcp 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,260 @@
1
+ # @leclabs/agent-flow-navigator-mcp
2
+
3
+ [![npm](https://img.shields.io/npm/v/@leclabs/agent-flow-navigator-mcp)](https://npmjs.com/package/@leclabs/agent-flow-navigator-mcp)
4
+
5
+ A workflow state machine MCP server that navigates agents through DAG-based workflows.
6
+
7
+ Navigator tracks task state and evaluates graph edges - it tells the orchestrator _where to go next_, but doesn't drive. Think of it like a GPS: you tell it where you are and what happened, it tells you where to go.
8
+
9
+ ## Installation
10
+
11
+ Run directly with npx:
12
+
13
+ ```bash
14
+ npx -y @leclabs/agent-flow-navigator-mcp
15
+ ```
16
+
17
+ Or install globally:
18
+
19
+ ```bash
20
+ npm install -g @leclabs/agent-flow-navigator-mcp
21
+ ```
22
+
23
+ ## Claude Code Configuration
24
+
25
+ Add to your `.mcp.json`:
26
+
27
+ ```json
28
+ {
29
+ "mcpServers": {
30
+ "navigator": {
31
+ "command": "npx",
32
+ "args": ["-y", "@leclabs/agent-flow-navigator-mcp"]
33
+ }
34
+ }
35
+ }
36
+ ```
37
+
38
+ ## Quick Start
39
+
40
+ Navigator works with the [flow plugin](https://github.com/leclabs/agent-toolkit/tree/main/plugins/flow) to provide structured workflow execution:
41
+
42
+ 1. **Initialize workflows** - Copy workflow templates to your project with `CopyWorkflows`
43
+ 2. **Start a task** - Use `Navigate` with a workflow type and description
44
+ 3. **Follow the flow** - Navigator tells you the current step and what to do
45
+ 4. **Advance on completion** - Report `passed` or `failed` to move to the next step
46
+
47
+ ```
48
+ User: "Add dark mode support"
49
+
50
+ Navigate(workflowType: "feature-development", description: "Add dark mode support")
51
+
52
+ Navigator returns: Step 1 of 8 - "Create implementation plan"
53
+
54
+ Agent executes step, then calls Navigate(result: "passed")
55
+
56
+ Navigator returns: Step 2 of 8 - "Implement changes"
57
+
58
+ ... continues through workflow ...
59
+ ```
60
+
61
+ ## MCP Tools Reference
62
+
63
+ | Tool | Description |
64
+ | ---- | ----------- |
65
+ | `Navigate` | Start a workflow, get current state, or advance to next step |
66
+ | `Diagram` | Generate a mermaid flowchart for a workflow |
67
+ | `ListWorkflows` | List all available workflows |
68
+ | `SelectWorkflow` | Get workflow selection dialog for user interaction |
69
+ | `CopyWorkflows` | Copy workflows from catalog to project |
70
+ | `ListCatalog` | List workflows available in the catalog |
71
+
72
+ ### Navigate
73
+
74
+ The primary tool for workflow navigation.
75
+
76
+ | Parameter | Type | Description |
77
+ | --------- | ---- | ----------- |
78
+ | `workflowType` | string | Workflow ID (for start only, e.g., "feature-development") |
79
+ | `description` | string | User's task description (for start) |
80
+ | `taskFilePath` | string | Path to task file (for advance/current) |
81
+ | `result` | "passed" \| "failed" | Step result (for advance) |
82
+
83
+ ### Diagram
84
+
85
+ Generates a mermaid diagram for visualizing workflow structure.
86
+
87
+ | Parameter | Type | Description |
88
+ | --------- | ---- | ----------- |
89
+ | `workflowType` | string | Workflow ID to visualize (required) |
90
+ | `currentStep` | string | Optional step to highlight |
91
+
92
+ ## Architecture Overview
93
+
94
+ ```
95
+ ┌─────────────────────────────────────────────────────────────────────┐
96
+ │ ORCHESTRATOR │
97
+ │ (Source of Truth: GitHub Issues, External DB, etc.) │
98
+ │ (Executes tasks, makes decisions, drives the workflow) │
99
+ └─────────────────────────┬───────────────────────────────────────────┘
100
+
101
+ ┌───────────────┼───────────────┐
102
+ │ load_workflow │ load_task_tree│
103
+ │ │ │
104
+ ▼ ▼ │
105
+ ┌─────────────────────────────────────────┴───────────────────────────┐
106
+ │ NAVIGATOR │
107
+ │ (Workflow State Machine MCP Server) │
108
+ │ │
109
+ │ ┌──────────────────┐ ┌──────────────────┐ │
110
+ │ │ Workflow Store │ │ Task Tree │ │
111
+ │ │ (Graph Defs) │ │ (State Tracker) │ │
112
+ │ └──────────────────┘ └──────────────────┘ │
113
+ │ │
114
+ │ ┌──────────────────┐ ┌──────────────────┐ │
115
+ │ │ Edge Evaluator │ │ Sync Tracker │ │
116
+ │ │ (Next Step?) │ │ (Pending Syncs) │ │
117
+ │ └──────────────────┘ └──────────────────┘ │
118
+ │ │
119
+ └─────────────────────────┬───────────────────────────────────────────┘
120
+
121
+ ┌───────────────┼───────────────┐
122
+ │ get_next_tasks│ advance_task │
123
+ │ "What's next?"│ "I got X" │
124
+ ▼ ▼ │
125
+ ┌─────────────────────────────────────────┴───────────────────────────┐
126
+ │ ORCHESTRATOR │
127
+ │ (Receives directions, executes, persists, confirms syncs) │
128
+ └─────────────────────────────────────────────────────────────────────┘
129
+ ```
130
+
131
+ ### Key Concepts
132
+
133
+ | Concept | Description |
134
+ | ----------------------- | ------------------------------------------------------------------------------------ |
135
+ | **Workflow Definition** | A DAG blueprint describing how to execute a type of work (nodes + conditional edges) |
136
+ | **Task Tree** | A runtime priority queue of actual work items across multiple workflow types |
137
+ | **Sync Tracking** | Mutations are tracked; orchestrator is reminded to persist to primary store |
138
+ | **Conditional Edges** | Edges with `on` condition (passed/failed) - retry logic is on nodes via `maxRetries` |
139
+ | **HITL Escalation** | When retries are exhausted, tasks route to end nodes with `escalation: "hitl"` |
140
+
141
+ ## Workflow Definition Schema
142
+
143
+ ### Node Types
144
+
145
+ | Type | Description |
146
+ | --------- | ------------------------------------------------------------ |
147
+ | `start` | Workflow entry point (exactly one per workflow) |
148
+ | `end` | Exit point with `result` (success/failure/blocked/cancelled) |
149
+ | `task` | Executable work unit |
150
+ | `gate` | Quality gate / review checkpoint |
151
+ | `subflow` | Connector to another workflow |
152
+
153
+ ### End Node Properties
154
+
155
+ | Property | Description |
156
+ | ------------ | ------------------------------------------------------- |
157
+ | `result` | `"success"`, `"failure"`, `"blocked"`, or `"cancelled"` |
158
+ | `escalation` | Optional: `"hitl"`, `"alert"`, or `"ticket"` |
159
+
160
+ ### Task/Gate Node Properties
161
+
162
+ | Property | Description |
163
+ | ------------ | ---------------------------------------------------------- |
164
+ | `name` | Human-readable name (required) |
165
+ | `outputs` | Possible outcomes (default: `["passed", "failed"]`) |
166
+ | `maxRetries` | Retry count on failure before following "failed" edge |
167
+ | `agent` | Agent type to perform this task |
168
+ | `stage` | Workflow phase: planning/development/verification/delivery |
169
+
170
+ ### Edge Properties
171
+
172
+ | Property | Description |
173
+ | -------- | -------------------------------------------------------------- |
174
+ | `from` | Source node ID |
175
+ | `to` | Target node ID |
176
+ | `on` | Output value that triggers this edge (for conditional routing) |
177
+ | `label` | Human-readable edge description |
178
+
179
+ ## Advanced Usage
180
+
181
+ ### Loading Workflow Definitions
182
+
183
+ ```json
184
+ {
185
+ "tool": "load_workflow",
186
+ "arguments": {
187
+ "id": "ui-reconstruction",
188
+ "definition": {
189
+ "nodes": {
190
+ "start": { "type": "start" },
191
+ "analyze": { "type": "task", "name": "Analyze Components" },
192
+ "review": { "type": "gate", "name": "Review Analysis", "maxRetries": 3 },
193
+ "end": { "type": "end", "result": "success" },
194
+ "hitl": { "type": "end", "result": "blocked", "escalation": "hitl" }
195
+ },
196
+ "edges": [
197
+ { "from": "start", "to": "analyze" },
198
+ { "from": "analyze", "to": "review" },
199
+ { "from": "review", "to": "analyze", "on": "failed", "label": "Retry on failure" },
200
+ { "from": "review", "to": "hitl", "on": "max_retries_exceeded", "label": "Escalate after 3 failures" },
201
+ { "from": "review", "to": "end", "on": "passed" }
202
+ ]
203
+ }
204
+ }
205
+ }
206
+ ```
207
+
208
+ ### Task Tree Management
209
+
210
+ Load a priority queue of tasks:
211
+
212
+ ```json
213
+ {
214
+ "tool": "load_task_tree",
215
+ "arguments": {
216
+ "tasks": [
217
+ {
218
+ "id": "task-001",
219
+ "issueId": "ISSUE-042",
220
+ "workflowType": "ui-reconstruction",
221
+ "currentStep": "start",
222
+ "priority": 100,
223
+ "status": "PENDING",
224
+ "context": { "targetUrl": "https://example.com" }
225
+ }
226
+ ]
227
+ }
228
+ }
229
+ ```
230
+
231
+ ### Advancing Tasks
232
+
233
+ After executing a task step:
234
+
235
+ ```json
236
+ {
237
+ "tool": "advance_task",
238
+ "arguments": {
239
+ "taskId": "task-001",
240
+ "result": "passed",
241
+ "output": "Analysis complete, found 5 components"
242
+ }
243
+ }
244
+ ```
245
+
246
+ ## Testing
247
+
248
+ ```bash
249
+ npm test
250
+ ```
251
+
252
+ ## Links
253
+
254
+ - [GitHub Repository](https://github.com/leclabs/agent-toolkit)
255
+ - [Flow Plugin](https://github.com/leclabs/agent-toolkit/tree/main/plugins/flow)
256
+ - [Full Documentation](https://github.com/leclabs/agent-toolkit/tree/main/packages/agent-flow-navigator-mcp)
257
+
258
+ ## License
259
+
260
+ MIT
@@ -0,0 +1,130 @@
1
+ {
2
+ "id": "agile-task",
3
+ "name": "Agile Task",
4
+ "description": "Simple workflow for general development tasks: analyze, implement, test, review.",
5
+ "nodes": {
6
+ "start": {
7
+ "type": "start",
8
+ "name": "Start",
9
+ "description": "Task entry point"
10
+ },
11
+ "analyze": {
12
+ "type": "task",
13
+ "name": "Analyze",
14
+ "description": "Understand requirements and plan approach",
15
+ "agent": "Planner",
16
+ "stage": "planning"
17
+ },
18
+ "implement": {
19
+ "type": "task",
20
+ "name": "Implement",
21
+ "description": "Write the code or make changes",
22
+ "agent": "Developer",
23
+ "stage": "development"
24
+ },
25
+ "test": {
26
+ "type": "task",
27
+ "name": "Test",
28
+ "description": "Verify the implementation works correctly",
29
+ "agent": "Tester",
30
+ "stage": "verification"
31
+ },
32
+ "review": {
33
+ "type": "gate",
34
+ "name": "Review",
35
+ "description": "Review code quality and correctness",
36
+ "agent": "Reviewer",
37
+ "stage": "verification",
38
+ "maxRetries": 2,
39
+ "config": {
40
+ "scrutinyLevel": 2
41
+ }
42
+ },
43
+ "lint_format": {
44
+ "type": "gate",
45
+ "name": "Lint & Format",
46
+ "description": "Run lint and format checks. Auto-fix issues where possible.",
47
+ "agent": "Developer",
48
+ "stage": "delivery",
49
+ "maxRetries": 3
50
+ },
51
+ "commit": {
52
+ "type": "task",
53
+ "name": "Commit Changes",
54
+ "description": "Commit all changes with a descriptive message",
55
+ "agent": "Developer",
56
+ "stage": "delivery"
57
+ },
58
+ "end_success": {
59
+ "type": "end",
60
+ "result": "success",
61
+ "name": "Complete",
62
+ "description": "Task completed successfully"
63
+ },
64
+ "hitl_failed": {
65
+ "type": "end",
66
+ "result": "blocked",
67
+ "escalation": "hitl",
68
+ "name": "Needs Help",
69
+ "description": "Task needs human intervention"
70
+ }
71
+ },
72
+ "edges": [
73
+ {
74
+ "from": "start",
75
+ "to": "analyze"
76
+ },
77
+ {
78
+ "from": "analyze",
79
+ "to": "implement"
80
+ },
81
+ {
82
+ "from": "implement",
83
+ "to": "test"
84
+ },
85
+ {
86
+ "from": "test",
87
+ "to": "review"
88
+ },
89
+ {
90
+ "from": "review",
91
+ "to": "implement",
92
+ "on": "failed",
93
+ "label": "Fix issues found in review"
94
+ },
95
+ {
96
+ "from": "review",
97
+ "to": "hitl_failed",
98
+ "on": "failed",
99
+ "label": "Too many review failures"
100
+ },
101
+ {
102
+ "from": "review",
103
+ "to": "lint_format",
104
+ "on": "passed",
105
+ "label": "Review passed, run lint checks"
106
+ },
107
+ {
108
+ "from": "lint_format",
109
+ "to": "commit",
110
+ "on": "passed",
111
+ "label": "Lint passes, commit changes"
112
+ },
113
+ {
114
+ "from": "lint_format",
115
+ "to": "implement",
116
+ "on": "failed",
117
+ "label": "Fix lint/format issues"
118
+ },
119
+ {
120
+ "from": "lint_format",
121
+ "to": "hitl_failed",
122
+ "on": "failed",
123
+ "label": "Lint issues persist"
124
+ },
125
+ {
126
+ "from": "commit",
127
+ "to": "end_success"
128
+ }
129
+ ]
130
+ }
@@ -0,0 +1,153 @@
1
+ {
2
+ "id": "bug-fix",
3
+ "name": "Bug Fix",
4
+ "description": "Workflow for fixing bugs: reproduce, investigate, fix, verify, and create PR.",
5
+ "nodes": {
6
+ "start": {
7
+ "type": "start",
8
+ "name": "Start",
9
+ "description": "Bug fix begins"
10
+ },
11
+ "reproduce": {
12
+ "type": "task",
13
+ "name": "Reproduce Bug",
14
+ "description": "Understand the bug and create a reliable reproduction case",
15
+ "agent": "Investigator",
16
+ "stage": "investigation"
17
+ },
18
+ "investigate": {
19
+ "type": "task",
20
+ "name": "Investigate",
21
+ "description": "Find root cause by tracing code paths and debugging",
22
+ "agent": "Investigator",
23
+ "stage": "investigation"
24
+ },
25
+ "write_fix": {
26
+ "type": "task",
27
+ "name": "Write Fix",
28
+ "description": "Implement the fix with minimal changes",
29
+ "agent": "Developer",
30
+ "stage": "development"
31
+ },
32
+ "add_regression_test": {
33
+ "type": "task",
34
+ "name": "Add Regression Test",
35
+ "description": "Write a test that would have caught this bug",
36
+ "agent": "Tester",
37
+ "stage": "development"
38
+ },
39
+ "verify_fix": {
40
+ "type": "task",
41
+ "name": "Verify Fix",
42
+ "description": "Run all tests and verify the bug is fixed",
43
+ "agent": "Tester",
44
+ "stage": "verification",
45
+ "maxRetries": 3
46
+ },
47
+ "lint_format": {
48
+ "type": "gate",
49
+ "name": "Lint & Format",
50
+ "description": "Run lint and format checks. Auto-fix issues where possible.",
51
+ "agent": "Developer",
52
+ "stage": "delivery",
53
+ "maxRetries": 3
54
+ },
55
+ "commit": {
56
+ "type": "task",
57
+ "name": "Commit Changes",
58
+ "description": "Commit the fix and regression test with a descriptive message",
59
+ "agent": "Developer",
60
+ "stage": "delivery"
61
+ },
62
+ "end_success": {
63
+ "type": "end",
64
+ "result": "success",
65
+ "name": "Fixed",
66
+ "description": "Bug fixed and PR created"
67
+ },
68
+ "hitl_cannot_reproduce": {
69
+ "type": "end",
70
+ "result": "blocked",
71
+ "escalation": "hitl",
72
+ "name": "Cannot Reproduce",
73
+ "description": "Unable to reproduce the bug - need more info"
74
+ },
75
+ "hitl_fix_failed": {
76
+ "type": "end",
77
+ "result": "blocked",
78
+ "escalation": "hitl",
79
+ "name": "Fix Failed",
80
+ "description": "Unable to fix the bug - needs human help"
81
+ }
82
+ },
83
+ "edges": [
84
+ {
85
+ "from": "start",
86
+ "to": "reproduce"
87
+ },
88
+ {
89
+ "from": "reproduce",
90
+ "to": "investigate",
91
+ "on": "passed",
92
+ "label": "Bug reproduced successfully"
93
+ },
94
+ {
95
+ "from": "reproduce",
96
+ "to": "hitl_cannot_reproduce",
97
+ "on": "failed",
98
+ "label": "Could not reproduce bug"
99
+ },
100
+ {
101
+ "from": "investigate",
102
+ "to": "write_fix"
103
+ },
104
+ {
105
+ "from": "write_fix",
106
+ "to": "add_regression_test"
107
+ },
108
+ {
109
+ "from": "add_regression_test",
110
+ "to": "verify_fix"
111
+ },
112
+ {
113
+ "from": "verify_fix",
114
+ "to": "write_fix",
115
+ "on": "failed",
116
+ "label": "Fix didn't work, try again"
117
+ },
118
+ {
119
+ "from": "verify_fix",
120
+ "to": "hitl_fix_failed",
121
+ "on": "failed",
122
+ "label": "Cannot fix the bug"
123
+ },
124
+ {
125
+ "from": "verify_fix",
126
+ "to": "lint_format",
127
+ "on": "passed",
128
+ "label": "Bug verified fixed, run lint checks"
129
+ },
130
+ {
131
+ "from": "lint_format",
132
+ "to": "commit",
133
+ "on": "passed",
134
+ "label": "Lint passes, commit changes"
135
+ },
136
+ {
137
+ "from": "lint_format",
138
+ "to": "write_fix",
139
+ "on": "failed",
140
+ "label": "Fix lint/format issues"
141
+ },
142
+ {
143
+ "from": "lint_format",
144
+ "to": "hitl_fix_failed",
145
+ "on": "failed",
146
+ "label": "Lint issues persist"
147
+ },
148
+ {
149
+ "from": "commit",
150
+ "to": "end_success"
151
+ }
152
+ ]
153
+ }
@@ -0,0 +1,130 @@
1
+ {
2
+ "id": "context-optimization",
3
+ "name": "Context Optimization",
4
+ "description": "Workflow for optimizing agent context, instructions, and integration points. Use when improving how agents communicate and preserve state.",
5
+ "nodes": {
6
+ "start": {
7
+ "type": "start",
8
+ "name": "Start",
9
+ "description": "Context optimization begins"
10
+ },
11
+ "map_connections": {
12
+ "type": "task",
13
+ "name": "Map Connections",
14
+ "description": "Identify all connection points between components (MCP, skills, agents, subagents)",
15
+ "agent": "Context Engineer",
16
+ "stage": "analysis"
17
+ },
18
+ "identify_pathologies": {
19
+ "type": "task",
20
+ "name": "Identify Pathologies",
21
+ "description": "Find context pathologies: specification bloat, attention dilution, redundant framing",
22
+ "agent": "Context Engineer",
23
+ "stage": "analysis"
24
+ },
25
+ "design_improvements": {
26
+ "type": "task",
27
+ "name": "Design Improvements",
28
+ "description": "Apply compression techniques: lead with conclusions, causal chains, precise terminology",
29
+ "agent": "Context Engineer",
30
+ "stage": "design"
31
+ },
32
+ "review_design": {
33
+ "type": "gate",
34
+ "name": "Review Design",
35
+ "description": "Verify improvements don't sacrifice meaning for brevity",
36
+ "agent": "Reviewer",
37
+ "stage": "design",
38
+ "maxRetries": 2,
39
+ "config": {
40
+ "scrutinyLevel": 2
41
+ }
42
+ },
43
+ "implement": {
44
+ "type": "task",
45
+ "name": "Implement",
46
+ "description": "Apply the optimizations to actual files and configurations",
47
+ "agent": "Developer",
48
+ "stage": "implementation"
49
+ },
50
+ "verify": {
51
+ "type": "task",
52
+ "name": "Verify",
53
+ "description": "Test that agents still function correctly with optimized context",
54
+ "agent": "Tester",
55
+ "stage": "verification",
56
+ "maxRetries": 2
57
+ },
58
+ "end_success": {
59
+ "type": "end",
60
+ "result": "success",
61
+ "name": "Complete",
62
+ "description": "Context optimization complete"
63
+ },
64
+ "hitl_failed": {
65
+ "type": "end",
66
+ "result": "blocked",
67
+ "escalation": "hitl",
68
+ "name": "Needs Help",
69
+ "description": "Optimization needs human guidance"
70
+ }
71
+ },
72
+ "edges": [
73
+ {
74
+ "from": "start",
75
+ "to": "map_connections"
76
+ },
77
+ {
78
+ "from": "map_connections",
79
+ "to": "identify_pathologies"
80
+ },
81
+ {
82
+ "from": "identify_pathologies",
83
+ "to": "design_improvements"
84
+ },
85
+ {
86
+ "from": "design_improvements",
87
+ "to": "review_design"
88
+ },
89
+ {
90
+ "from": "review_design",
91
+ "to": "design_improvements",
92
+ "on": "failed",
93
+ "label": "Revise optimizations"
94
+ },
95
+ {
96
+ "from": "review_design",
97
+ "to": "hitl_failed",
98
+ "on": "failed",
99
+ "label": "Design needs human input"
100
+ },
101
+ {
102
+ "from": "review_design",
103
+ "to": "implement",
104
+ "on": "passed",
105
+ "label": "Design approved"
106
+ },
107
+ {
108
+ "from": "implement",
109
+ "to": "verify"
110
+ },
111
+ {
112
+ "from": "verify",
113
+ "to": "implement",
114
+ "on": "failed",
115
+ "label": "Fix issues"
116
+ },
117
+ {
118
+ "from": "verify",
119
+ "to": "hitl_failed",
120
+ "on": "failed",
121
+ "label": "Verification failed"
122
+ },
123
+ {
124
+ "from": "verify",
125
+ "to": "end_success",
126
+ "on": "passed",
127
+ "label": "Optimization verified"
128
+ }
129
+ ]
130
+ }