Skip to content

Commit 0df2269

Browse files
bricefclaude
andcommitted
Update docs for MCP completion
- Move MCP plan to done - Update README: MCP is a feature, fix endpoint count (42), update architecture description - Update ARCHITECTURE.md: add MCP to diagrams, package structure, dependency flow, and derivation table - Update docs/mcp.md: add whoami, task_ref, notifications, revised tips - Update NOTES.md: mark MCP as complete Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 0932b5f commit 0df2269

5 files changed

Lines changed: 50 additions & 17 deletions

File tree

ARCHITECTURE.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This document describes the current architecture of TaskFlow for developers work
44

55
## Overview
66

7-
TaskFlow is a task tracker with kanban boards and workflow state machines. The server is the single source of truth; all clients (CLI, TUI, simulator, future MCP) are pure HTTP consumers that import no server internals.
7+
TaskFlow is a task tracker with kanban boards and workflow state machines. The server is the single source of truth; all clients (CLI, TUI, MCP, simulator) are pure HTTP consumers that import no server internals.
88

99
```
1010
┌──────────────────────────────────────────────────────────┐
@@ -34,9 +34,9 @@ TaskFlow is a task tracker with kanban boards and workflow state machines. The s
3434
│ Accepts model.Resource and model.Operation directly │
3535
│ Handles path substitution, query params, auth │
3636
└──────────────────────────────────────────────────────────┘
37-
38-
39-
CLI TUI Simulator
37+
38+
39+
CLI TUI MCP Simulator
4040
```
4141

4242
## Define once, derive everywhere
@@ -53,6 +53,7 @@ Each entry has an explicit `Name` (e.g. `task_list`, `board_create`) that serves
5353
| HTTP server | Routes, handler mapping, status codes |
5454
| OpenAPI spec | Paths, methods, parameters, schemas, operationIds |
5555
| CLI | Command tree (`<resource>_<action>` → group + subcommand), flags |
56+
| MCP server | Resources (taskflow:// URIs), tools (input schemas), descriptions |
5657
| httpclient | Path substitution, HTTP method, query string building |
5758

5859
Named references are exported as package-level variables (`model.ResTaskList`, `model.OpTaskCreate`, etc.) so consumers reference domain types directly without string lookups.
@@ -70,6 +71,7 @@ internal/
7071
├── transport/ Maps domain actions to HTTP semantics (method, status code)
7172
├── httpclient/ Domain-aware HTTP client for all consumers
7273
├── http/ HTTP server (routes, middleware, OpenAPI generation)
74+
├── mcp/ MCP server (tools + resources derived from model, notifications)
7375
├── cli/ CLI (commands derived from model)
7476
├── eventbus/ In-process pub/sub with ring-buffered subscriptions
7577
├── tui/ Interactive terminal UI (Bubble Tea)
@@ -79,6 +81,7 @@ cmd/
7981
├── taskflow-server/ Server binary
8082
├── taskflow/ CLI binary
8183
├── taskflow-tui/ TUI binary
84+
├── taskflow-mcp/ MCP server binary (stdio transport)
8285
├── taskflow-seed/ Test data generator
8386
└── taskflow-sim/ Activity simulator
8487
```
@@ -100,6 +103,7 @@ sqlite — depends on model, repo (storage implementation)
100103
transport — depends on model (HTTP method/status mapping)
101104
httpclient — depends on model, transport, eventbus
102105
http — depends on model, transport, service, taskflow, eventbus
106+
mcp — depends on model, httpclient, eventbus
103107
cli — depends on model, httpclient
104108
tui — depends on model, httpclient, eventbus
105109
```

NOTES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ These features were identified during MCP planning and should be integrated into
7373

7474
Great question. Here's what I'd want as an AI agent using TaskFlow:
7575

76-
- [ ] MCP server interface. The PRD mentions it but it's not built yet. For me, an MCP tool interface would be the most natural way to interact — I could create tasks, transition them, and check board state without constructing HTTP requests. The operation definitions in model.Operations() could derive MCP tool definitions the same way they derive HTTP routes and CLI commands.
76+
- [x] MCP server interface. Tools and resources auto-derived from model.Operations() and model.Resources(). Notification piggyback delivers change awareness on tool responses. Task ref shorthand, whoami tool, and rich descriptions for agent guidance.
7777

7878
- [x] Structured error responses with actionable context. The current error format is good ({"error": "invalid_transition", "message": "..."}) but when a transition fails, I'd love the response to include the available transitions so I can self-correct without a second round-trip:
7979

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,17 @@ taskflow-tui
3939
## Features
4040

4141
- HTTP API with auth (SHA-256 keys), RBAC, idempotency keys, and batch operations
42-
- 41 domain endpoints (18 Resources + 23 Operations) auto-derived from the model
42+
- 42 domain endpoints (19 Resources + 23 Operations) auto-derived from the model
4343
- OpenAPI 3.1 spec auto-generated at startup
4444
- CLI with commands derived from the same model
4545
- Interactive TUI with kanban, list, workflow graph, and live event stream — see **[TUI Reference](docs/tui.md)**
46+
- MCP server for AI agent integration (Claude Code, Aider, Cursor) with notification piggyback — see **[MCP Server](docs/mcp.md)**
4647
- Real-time event streaming (SSE) with before/after task snapshots
4748
- Webhook dispatch with HMAC-SHA256 signatures, retry, and delivery logging
4849
- HTML dashboard at `/dashboard`
4950
- Docker deployment with seed admin bootstrap
5051

51-
- MCP server for AI agent integration (Claude Code, Aider, Cursor) — see **[MCP Server](docs/mcp.md)**
52-
53-
See [docs/](docs/) for API, CLI, and TUI reference.
52+
See [docs/](docs/) for API, CLI, TUI, and MCP reference.
5453

5554
## Roles
5655

@@ -111,7 +110,7 @@ Tasks are moved between states by name (e.g. `--transition start`), not by targe
111110

112111
## Architecture
113112

114-
Operations are defined once in `model.Resources()` and `model.Operations()` and derived into HTTP routes, CLI commands, OpenAPI specs, and the shared `httpclient`. All clients (CLI, TUI, simulator) are pure HTTP consumers — they import no server internals.
113+
Operations are defined once in `model.Resources()` and `model.Operations()` and derived into HTTP routes, CLI commands, OpenAPI specs, MCP tools/resources, and the shared `httpclient`. All clients (CLI, TUI, MCP, simulator) are pure HTTP consumers — they import no server internals.
115114

116115
See **[ARCHITECTURE.md](ARCHITECTURE.md)** for the full architectural reference: dependency flow, package responsibilities, event system, query param derivation, and design rationale.
117116

docs/mcp.md

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,24 +127,54 @@ Tools are mutations that change state. Path parameters and body fields are passe
127127
| `webhook_update` | Update a webhook (admin) | `id`, fields to change |
128128
| `webhook_delete` | Delete a webhook (admin) | `id` |
129129

130-
## Workflow Tips for Agents
130+
### Identity
131131

132-
1. **Check available transitions** before transitioning: read the `workflow_get` resource for the board, then match the task's current state to available transitions.
132+
| Tool | Description |
133+
|------|-------------|
134+
| `whoami` | Returns your actor identity (name, role, type) |
133135

134-
2. **Use `@me` for self-assignment**: when creating or updating tasks, use `@me` as the assignee value.
136+
## Convenience Features
135137

136-
3. **Transition by name, not state**: pass the transition name (e.g. `start`, `submit`, `approve`), not the target state.
138+
### Task references
137139

138-
4. **Board detail for full context**: use `board_detail` to get a complete snapshot of a board including all tasks with their comments, dependencies, and audit.
140+
Tools that take `slug` + `num` also accept a `task_ref` shorthand like `"platform/3"`. This is parsed in the MCP layer — the domain model is unchanged.
139141

140-
5. **Task search across boards**: use `task_search` to find tasks across all boards by keyword.
142+
### Notifications
143+
144+
The MCP server subscribes to the global event stream at startup. Events from other actors are buffered and piggybacked onto tool responses as a text block:
145+
146+
```
147+
--- 2 notification(s) from other actors ---
148+
[2026-04-01T10:15:00Z] alice moved platform/3 from backlog to in_progress
149+
[2026-04-01T10:16:30Z] brice commented on platform/7
150+
```
151+
152+
This gives the agent awareness of changes without polling. Notifications are cleared after delivery. If no events have arrived, tool responses are unchanged.
153+
154+
## Tips for Agents
155+
156+
1. **Use `task_detail`** instead of `task_get` when you need full context — it includes comments, dependencies, attachments, and audit in one request.
157+
158+
2. **Use `whoami`** to discover your identity. This tells you your actor name, role, and type.
159+
160+
3. **Use `@me`** as the assignee value when creating or updating tasks to assign to yourself.
161+
162+
4. **Transition by name, not state**: pass the transition name (e.g. `start`, `submit`, `approve`), not the target state. On failure, the error includes available transitions.
163+
164+
5. **Use `task_ref`** shorthand (e.g. `"platform/3"`) instead of separate `slug` and `num` for conciseness.
165+
166+
6. **Use `task_search`** to find tasks across all boards by keyword, assignee, state, or priority.
141167

142168
## Architecture
143169

144170
The MCP server is a thin adapter over `internal/httpclient`. Resources and tools are auto-derived from `model.Resources()` and `model.Operations()` — the same definitions that drive the HTTP API, CLI, and OpenAPI spec. No manual tool registration is needed.
145171

146172
```
147173
AI Agent ←→ taskflow-mcp (stdio) ←→ httpclient ←→ TaskFlow Server
174+
175+
Subscribe (events)
176+
177+
Notification buffer
148178
```
149179

150-
Each agent instance runs as a separate process with its own API key. The agent's identity comes from the API key — all actions are attributed to the corresponding actor in the audit trail.
180+
Each agent instance runs as a separate process with its own API key. The agent's identity is resolved at startup via `/me` and used to filter out self-events from the notification stream.
File renamed without changes.

0 commit comments

Comments
 (0)