@prmichaelsen/task-mcp 0.2.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.
Files changed (142) hide show
  1. package/.env.example +19 -0
  2. package/AGENT.md +1165 -0
  3. package/CHANGELOG.md +72 -0
  4. package/agent/commands/acp.commit.md +511 -0
  5. package/agent/commands/acp.init.md +376 -0
  6. package/agent/commands/acp.package-install.md +347 -0
  7. package/agent/commands/acp.proceed.md +311 -0
  8. package/agent/commands/acp.report.md +392 -0
  9. package/agent/commands/acp.status.md +280 -0
  10. package/agent/commands/acp.sync.md +323 -0
  11. package/agent/commands/acp.update.md +301 -0
  12. package/agent/commands/acp.validate.md +385 -0
  13. package/agent/commands/acp.version-check-for-updates.md +275 -0
  14. package/agent/commands/acp.version-check.md +190 -0
  15. package/agent/commands/acp.version-update.md +288 -0
  16. package/agent/commands/command.template.md +273 -0
  17. package/agent/commands/git.commit.md +511 -0
  18. package/agent/commands/git.init.md +513 -0
  19. package/agent/design/.gitkeep +0 -0
  20. package/agent/design/acp-task-execution-requirements.md +555 -0
  21. package/agent/design/api-dto-design.md +394 -0
  22. package/agent/design/code-extraction-guide.md +827 -0
  23. package/agent/design/design.template.md +136 -0
  24. package/agent/design/requirements.template.md +387 -0
  25. package/agent/design/rest-api-integration.md +489 -0
  26. package/agent/design/sdk-export-requirements.md +549 -0
  27. package/agent/milestones/.gitkeep +0 -0
  28. package/agent/milestones/milestone-1-{title}.template.md +206 -0
  29. package/agent/milestones/milestone-2-task-infrastructure.md +232 -0
  30. package/agent/milestones/milestone-4-autonomous-execution.md +235 -0
  31. package/agent/patterns/.gitkeep +0 -0
  32. package/agent/patterns/bootstrap.md +1271 -0
  33. package/agent/patterns/bootstrap.template.md +1237 -0
  34. package/agent/patterns/pattern.template.md +364 -0
  35. package/agent/progress.template.yaml +158 -0
  36. package/agent/progress.yaml +375 -0
  37. package/agent/scripts/check-for-updates.sh +88 -0
  38. package/agent/scripts/install.sh +157 -0
  39. package/agent/scripts/uninstall.sh +75 -0
  40. package/agent/scripts/update.sh +139 -0
  41. package/agent/scripts/version.sh +35 -0
  42. package/agent/tasks/.gitkeep +0 -0
  43. package/agent/tasks/task-1-{title}.template.md +225 -0
  44. package/agent/tasks/task-86-task-data-model-schemas.md +143 -0
  45. package/agent/tasks/task-87-task-database-service.md +220 -0
  46. package/agent/tasks/task-88-firebase-client-wrapper.md +139 -0
  47. package/agent/tasks/task-88-task-execution-engine.md +277 -0
  48. package/agent/tasks/task-89-mcp-server-implementation.md +197 -0
  49. package/agent/tasks/task-90-build-configuration.md +146 -0
  50. package/agent/tasks/task-91-deployment-configuration.md +128 -0
  51. package/coverage/base.css +224 -0
  52. package/coverage/block-navigation.js +87 -0
  53. package/coverage/favicon.png +0 -0
  54. package/coverage/index.html +191 -0
  55. package/coverage/lcov-report/base.css +224 -0
  56. package/coverage/lcov-report/block-navigation.js +87 -0
  57. package/coverage/lcov-report/favicon.png +0 -0
  58. package/coverage/lcov-report/index.html +191 -0
  59. package/coverage/lcov-report/prettify.css +1 -0
  60. package/coverage/lcov-report/prettify.js +2 -0
  61. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  62. package/coverage/lcov-report/sorter.js +210 -0
  63. package/coverage/lcov-report/src/client.ts.html +1030 -0
  64. package/coverage/lcov-report/src/constant/collections.ts.html +469 -0
  65. package/coverage/lcov-report/src/constant/index.html +116 -0
  66. package/coverage/lcov-report/src/dto/index.html +116 -0
  67. package/coverage/lcov-report/src/dto/transformers.ts.html +568 -0
  68. package/coverage/lcov-report/src/index.html +146 -0
  69. package/coverage/lcov-report/src/schemas/index.html +116 -0
  70. package/coverage/lcov-report/src/schemas/task.ts.html +547 -0
  71. package/coverage/lcov-report/src/server-factory.ts.html +418 -0
  72. package/coverage/lcov-report/src/server.ts.html +289 -0
  73. package/coverage/lcov-report/src/services/index.html +116 -0
  74. package/coverage/lcov-report/src/services/task-database.service.ts.html +1495 -0
  75. package/coverage/lcov-report/src/tools/index.html +236 -0
  76. package/coverage/lcov-report/src/tools/index.ts.html +292 -0
  77. package/coverage/lcov-report/src/tools/task-add-message.ts.html +277 -0
  78. package/coverage/lcov-report/src/tools/task-complete-task-item.ts.html +343 -0
  79. package/coverage/lcov-report/src/tools/task-create-milestone.ts.html +286 -0
  80. package/coverage/lcov-report/src/tools/task-create-task-item.ts.html +358 -0
  81. package/coverage/lcov-report/src/tools/task-get-next-step.ts.html +460 -0
  82. package/coverage/lcov-report/src/tools/task-get-status.ts.html +316 -0
  83. package/coverage/lcov-report/src/tools/task-report-completion.ts.html +343 -0
  84. package/coverage/lcov-report/src/tools/task-update-progress.ts.html +232 -0
  85. package/coverage/lcov.info +974 -0
  86. package/coverage/prettify.css +1 -0
  87. package/coverage/prettify.js +2 -0
  88. package/coverage/sort-arrow-sprite.png +0 -0
  89. package/coverage/sorter.js +210 -0
  90. package/coverage/src/client.ts.html +1030 -0
  91. package/coverage/src/constant/collections.ts.html +469 -0
  92. package/coverage/src/constant/index.html +116 -0
  93. package/coverage/src/dto/index.html +116 -0
  94. package/coverage/src/dto/transformers.ts.html +568 -0
  95. package/coverage/src/index.html +146 -0
  96. package/coverage/src/schemas/index.html +116 -0
  97. package/coverage/src/schemas/task.ts.html +547 -0
  98. package/coverage/src/server-factory.ts.html +418 -0
  99. package/coverage/src/server.ts.html +289 -0
  100. package/coverage/src/services/index.html +116 -0
  101. package/coverage/src/services/task-database.service.ts.html +1495 -0
  102. package/coverage/src/tools/index.html +236 -0
  103. package/coverage/src/tools/index.ts.html +292 -0
  104. package/coverage/src/tools/task-add-message.ts.html +277 -0
  105. package/coverage/src/tools/task-complete-task-item.ts.html +343 -0
  106. package/coverage/src/tools/task-create-milestone.ts.html +286 -0
  107. package/coverage/src/tools/task-create-task-item.ts.html +358 -0
  108. package/coverage/src/tools/task-get-next-step.ts.html +460 -0
  109. package/coverage/src/tools/task-get-status.ts.html +316 -0
  110. package/coverage/src/tools/task-report-completion.ts.html +343 -0
  111. package/coverage/src/tools/task-update-progress.ts.html +232 -0
  112. package/firestore.rules +95 -0
  113. package/jest.config.js +31 -0
  114. package/package.json +67 -0
  115. package/src/client.spec.ts +199 -0
  116. package/src/client.ts +315 -0
  117. package/src/constant/collections.ts +128 -0
  118. package/src/dto/index.ts +47 -0
  119. package/src/dto/task-api.dto.ts +219 -0
  120. package/src/dto/transformers.spec.ts +462 -0
  121. package/src/dto/transformers.ts +161 -0
  122. package/src/schemas/task.ts +154 -0
  123. package/src/server-factory.spec.ts +70 -0
  124. package/src/server-factory.ts +111 -0
  125. package/src/server.ts +68 -0
  126. package/src/services/task-database.service.e2e.ts +116 -0
  127. package/src/services/task-database.service.spec.ts +479 -0
  128. package/src/services/task-database.service.ts +470 -0
  129. package/src/test-schemas.ts +161 -0
  130. package/src/tools/index.ts +69 -0
  131. package/src/tools/task-add-message.ts +64 -0
  132. package/src/tools/task-complete-task-item.ts +86 -0
  133. package/src/tools/task-create-milestone.ts +67 -0
  134. package/src/tools/task-create-task-item.ts +91 -0
  135. package/src/tools/task-get-next-step.spec.ts +136 -0
  136. package/src/tools/task-get-next-step.ts +125 -0
  137. package/src/tools/task-get-status.spec.ts +213 -0
  138. package/src/tools/task-get-status.ts +77 -0
  139. package/src/tools/task-report-completion.ts +86 -0
  140. package/src/tools/task-update-progress.ts +49 -0
  141. package/src/tools/tools.spec.ts +194 -0
  142. package/tsconfig.json +31 -0
@@ -0,0 +1,555 @@
1
+ # ACP Task Execution System for agentbase.me (MCP Server Architecture)
2
+
3
+ **Concept**: Port ACP-style autonomous task execution from Roo Code to agentbase.me using MCP server architecture
4
+ **Created**: 2026-02-16
5
+ **Last Updated**: 2026-02-16
6
+ **Status**: Design Specification
7
+
8
+ ---
9
+
10
+ ## Overview
11
+
12
+ This design document specifies the requirements for porting the Agent Context Protocol (ACP) task execution system from Roo Code to agentbase.me using an **MCP server-first architecture**. The goal is to enable long-running, autonomous task execution where agents work through structured milestones and tasks independently in the background, separate from conversational threads.
13
+
14
+ **Core Principle**: Unlike Roo Code's optimistic completion model (where agents ask for approval before proceeding), agentbase.me will use a **pessimistic execution model** where agents continuously work through all milestones and tasks until explicitly paused or all work is complete.
15
+
16
+ **Architecture Principle**: Task management tools are exposed via a **separate MCP server** following the [MCP Server Bootstrap Pattern](https://github.com/prmichaelsen/remember-mcp/blob/main/agent/patterns/bootstrap.md), not embedded in agentbase.me codebase.
17
+
18
+ ---
19
+
20
+ ## Problem Statement
21
+
22
+ Currently, agentbase.me supports only conversational chat interactions. Users cannot:
23
+
24
+ 1. **Create long-running tasks** that execute independently of the main conversation
25
+ 2. **Track structured progress** through milestones and sub-tasks
26
+ 3. **Resume work** on tasks across sessions
27
+ 4. **Monitor background execution** while continuing other conversations
28
+ 5. **Leverage ACP methodology** for systematic project development
29
+
30
+ This limits agentbase.me to short, interactive conversations rather than complex, multi-step project work.
31
+
32
+ ---
33
+
34
+ ## Solution
35
+
36
+ Implement a **Task Execution System** with **MCP Server Architecture** that:
37
+
38
+ 1. **Creates separate "task" conversation types** alongside regular chat conversations
39
+ 2. **Exposes task management tools via MCP server** (separate project)
40
+ 3. **Exposes REST API endpoints** for web UI operations (dual interface)
41
+ 4. **Executes tasks autonomously** in the background using ACP methodology
42
+ 5. **Persists task state** in Firestore for resumability
43
+ 6. **Sends progress updates** to the task thread as work proceeds
44
+ 7. **Respects user control** via pause/resume/stop controls
45
+ 8. **Shares business logic** between MCP tools and REST endpoints
46
+
47
+ **See Also**: [REST API Integration Design](rest-api-integration.md) for detailed REST endpoint specifications.
48
+
49
+ ---
50
+
51
+ ## Architecture: MCP Server-First Approach
52
+
53
+ ### System Components
54
+
55
+ ```
56
+ ┌─────────────────────────────────────────────────────────────┐
57
+ │ agentbase.me │
58
+ │ │
59
+ │ ┌──────────────┐ ┌─────────────────┐ │
60
+ │ │ Web UI │────────▶│ API Routes │ │
61
+ │ │ │ │ (UI Operations)│ │
62
+ │ └──────────────┘ └─────────────────┘ │
63
+ │ │ │ │
64
+ │ │ ▼ │
65
+ │ │ ┌─────────────┐ │
66
+ │ │ │ Firestore │ │
67
+ │ │ │ (Tasks DB) │ │
68
+ │ │ └─────────────┘ │
69
+ │ │ ▲ │
70
+ │ │ │ │
71
+ │ ▼ │ │
72
+ │ ┌──────────────┐ │ │
73
+ │ │ WebSocket │ │ │
74
+ │ │ (Updates) │ │ │
75
+ │ └──────────────┘ │ │
76
+ │ ▲ │ │
77
+ │ │ │ │
78
+ │ │ │ │
79
+ │ ┌──────────────────────────────────────┐ │
80
+ │ │ Agent (Chat) │ │
81
+ │ │ │ │
82
+ │ │ ┌────────────────────────────────┐ │ │
83
+ │ │ │ MCP Client │ │ │
84
+ │ │ │ (connects to task-mcp) │ │ │
85
+ │ │ └────────────────────────────────┘ │ │
86
+ │ └──────────────────────────────────────┘ │
87
+ │ │ │
88
+ └─────────┼──────────────────────────────────────────────────┘
89
+
90
+ │ MCP Protocol
91
+
92
+
93
+ ┌─────────────────────────────────────────────────────────────┐
94
+ │ task-mcp (Separate MCP Server) │
95
+ │ │
96
+ │ ┌──────────────────────────────────────────────────────┐ │
97
+ │ │ MCP Server (stdio/SSE transport) │ │
98
+ │ └──────────────────────────────────────────────────────┘ │
99
+ │ │ │
100
+ │ ▼ │
101
+ │ ┌──────────────────────────────────────────────────────┐ │
102
+ │ │ Task Management Tools │ │
103
+ │ │ - task_get_status │ │
104
+ │ │ - task_create_milestone │ │
105
+ │ │ - task_create_task │ │
106
+ │ │ - task_complete_task │ │
107
+ │ │ - task_update_progress │ │
108
+ │ │ - task_init │ │
109
+ │ │ - task_sync │ │
110
+ │ │ - task_generate_report │ │
111
+ │ │ - task_validate │ │
112
+ │ │ - ... (13 tools total) │ │
113
+ │ └──────────────────────────────────────────────────────┘ │
114
+ │ │ │
115
+ │ ▼ │
116
+ │ ┌──────────────────────────────────────────────────────┐ │
117
+ │ │ Firebase Admin SDK │ │
118
+ │ │ (Direct Firestore access with service account) │ │
119
+ │ └──────────────────────────────────────────────────────┘ │
120
+ │ │ │
121
+ └─────────┼───────────────────────────────────────────────────┘
122
+
123
+
124
+ ┌─────────────┐
125
+ │ Firestore │
126
+ │ (Tasks DB) │
127
+ └─────────────┘
128
+ ```
129
+
130
+ ### Key Architectural Decisions
131
+
132
+ 1. **Separate MCP Server Project**: `task-mcp` is a standalone Node.js project
133
+ 2. **MCP Protocol**: Agent connects to MCP server via stdio or SSE transport
134
+ 3. **Direct Database Access**: MCP server uses Firebase Admin SDK with service account
135
+ 4. **Tool-Based Operations**: All agent task operations go through MCP tools
136
+ 5. **API for UI**: Web UI uses REST API for user-initiated operations
137
+ 6. **WebSocket for Updates**: Real-time progress updates stream via WebSocket
138
+
139
+ ### Why MCP Server-First?
140
+
141
+ **Pros**:
142
+ - ✅ **Modularity**: Task tools are completely separate from agentbase.me
143
+ - ✅ **Reusability**: Other platforms can use the same MCP server
144
+ - ✅ **Independent Updates**: Update task tools without deploying agentbase.me
145
+ - ✅ **Standard Protocol**: Follows MCP architecture patterns
146
+ - ✅ **Scalability**: MCP server can scale independently
147
+ - ✅ **Testing**: Easier to test tools in isolation
148
+ - ✅ **Multi-tenant**: MCP server handles per-user authentication
149
+
150
+ **Cons**:
151
+ - ❌ **Network Latency**: Tool calls go over network (mitigated by local deployment)
152
+ - ❌ **Additional Infrastructure**: Need to deploy and manage MCP server
153
+ - ❌ **Authentication Complexity**: Need to pass user credentials to MCP server
154
+
155
+ **Decision**: The benefits of modularity and reusability outweigh the complexity.
156
+
157
+ ---
158
+
159
+ ## MCP Server Project Structure
160
+
161
+ Following the [MCP Server Bootstrap Pattern](https://github.com/prmichaelsen/remember-mcp/blob/main/agent/patterns/bootstrap.md):
162
+
163
+ ```
164
+ task-mcp/
165
+ ├── src/
166
+ │ ├── index.ts # CLI entry point (stdio)
167
+ │ ├── server.ts # Standalone server
168
+ │ ├── server-factory.ts # Factory for multi-tenant
169
+ │ ├── client.ts # Firebase Admin SDK wrapper
170
+ │ ├── types.ts # Shared types
171
+ │ │
172
+ │ ├── tools/ # Task management tools
173
+ │ │ ├── index.ts # Tool exports
174
+ │ │ ├── task-get-status.ts
175
+ │ │ ├── task-update-progress.ts
176
+ │ │ ├── task-pause.ts
177
+ │ │ ├── task-resume.ts
178
+ │ │ ├── task-create-milestone.ts
179
+ │ │ ├── task-create-task.ts
180
+ │ │ ├── task-complete-task.ts
181
+ │ │ ├── task-complete-milestone.ts
182
+ │ │ ├── task-init.ts
183
+ │ │ ├── task-get-detailed-status.ts
184
+ │ │ ├── task-sync.ts
185
+ │ │ ├── task-generate-report.ts
186
+ │ │ └── task-validate.ts
187
+ │ │
188
+ │ └── utils/
189
+ │ ├── logger.ts # Stdio-safe logging
190
+ │ └── error-serializer.ts # Error handling
191
+
192
+ ├── agent/ # ACP documentation
193
+ │ ├── design/
194
+ │ ├── milestones/
195
+ │ ├── tasks/
196
+ │ └── progress.yaml
197
+
198
+ ├── package.json
199
+ ├── tsconfig.json
200
+ ├── esbuild.build.js
201
+ ├── firestore-service-account.json # Service account key (gitignored)
202
+ └── README.md
203
+ ```
204
+
205
+ ### Tool Structure (per Bootstrap Pattern)
206
+
207
+ ```typescript
208
+ // src/tools/task-get-status.ts
209
+ import { FirebaseClient } from '../client.js'
210
+
211
+ export const taskGetStatusTool = {
212
+ name: 'task_get_status',
213
+ description: 'Get current task status and progress',
214
+ inputSchema: {
215
+ type: 'object',
216
+ properties: {
217
+ task_id: {
218
+ type: 'string',
219
+ description: 'Task ID to get status for'
220
+ }
221
+ },
222
+ required: ['task_id']
223
+ }
224
+ }
225
+
226
+ export async function handleTaskGetStatus(
227
+ client: FirebaseClient,
228
+ args: { task_id: string }
229
+ ): Promise<string> {
230
+ try {
231
+ const task = await client.getTask(args.task_id)
232
+ if (!task) {
233
+ throw new Error(`Task not found: ${args.task_id}`)
234
+ }
235
+
236
+ return JSON.stringify({
237
+ task_title: task.title,
238
+ status: task.status,
239
+ current_milestone: task.progress.current_milestone,
240
+ overall_progress: task.progress.overall_percentage
241
+ }, null, 2)
242
+ } catch (error) {
243
+ throw new Error(`Failed to get status: ${error instanceof Error ? error.message : String(error)}`)
244
+ }
245
+ }
246
+ ```
247
+
248
+ ---
249
+
250
+ ## agentbase.me Changes
251
+
252
+ ### What Stays in agentbase.me
253
+
254
+ 1. **REST API Routes** (for UI operations)
255
+ - Uses FirebaseClient from task-mcp (shared business logic)
256
+ - See [REST API Integration Design](rest-api-integration.md) for full endpoint list
257
+ - Example endpoints:
258
+ * `POST /api/tasks` - Create task (from UI)
259
+ * `GET /api/tasks` - List tasks (for UI)
260
+ * `GET /api/tasks/:id` - Get task details (for UI)
261
+ * `DELETE /api/tasks/:id` - Delete task (from UI)
262
+ * `GET /api/tasks/:id/messages` - Get task messages (for UI)
263
+
264
+ 2. **UI Components**
265
+ - Task list view
266
+ - Task detail view
267
+ - Task thread view
268
+ - Progress visualization
269
+
270
+ 3. **WebSocket Handler**
271
+ - Stream progress updates to UI
272
+ - Handle real-time task status changes
273
+
274
+ 4. **MCP Client Integration**
275
+ - Connect agent to task-mcp server
276
+ - Pass user credentials to MCP server
277
+ - Handle MCP tool calls from agent
278
+
279
+ ### What Lives in task-mcp
280
+
281
+ 1. **Shared Business Logic** (used by both MCP tools and REST API)
282
+ - FirebaseClient wrapper
283
+ - TaskDatabaseService
284
+ - Zod schemas and validation
285
+
286
+ 2. **MCP Tools** (8 core tools for agents)
287
+ - task_get_status, task_get_next_step, task_update_progress
288
+ - task_complete_task_item, task_create_milestone, task_create_task_item
289
+ - task_report_completion, task_add_message
290
+
291
+ 3. **MCP Server Implementation**
292
+ - Server factory for multi-tenant
293
+ - Stdio transport
294
+ - Tool registration and handling
295
+
296
+ 4. **REST API Support** (optional)
297
+ - FirebaseClient can be imported by agentbase.me
298
+ - Enables dual interface (MCP + REST)
299
+ - See [REST API Integration Design](rest-api-integration.md)
300
+
301
+ ---
302
+
303
+ ## Data Model
304
+
305
+ ### Task Document (Firestore)
306
+
307
+ ```typescript
308
+ interface Task {
309
+ id: string
310
+ user_id: string
311
+ title: string
312
+ description: string
313
+ status: 'not_started' | 'in_progress' | 'paused' | 'completed' | 'failed'
314
+ created_at: string
315
+ updated_at: string
316
+ started_at?: string
317
+ completed_at?: string
318
+
319
+ // ACP Structure
320
+ progress: {
321
+ current_milestone: string
322
+ current_task: string
323
+ overall_percentage: number
324
+ milestones: Milestone[]
325
+ tasks: Record<string, TaskItem[]>
326
+ }
327
+
328
+ // Execution State
329
+ execution: {
330
+ api_messages: ApiMessage[]
331
+ task_messages: TaskMessage[]
332
+ tool_results: ToolResult[]
333
+ error?: string
334
+ abort_reason?: string
335
+ }
336
+
337
+ // Configuration
338
+ config: {
339
+ model: string
340
+ system_prompt: string
341
+ auto_approve: boolean
342
+ max_iterations?: number
343
+ timeout_minutes?: number
344
+ }
345
+
346
+ metadata?: {
347
+ conversation_id?: string
348
+ parent_task_id?: string
349
+ tags?: string[]
350
+ }
351
+ }
352
+ ```
353
+
354
+ ---
355
+
356
+ ## Implementation Phases
357
+
358
+ ### Phase 1: MCP Server Foundation (Week 1-2)
359
+
360
+ **Deliverables**:
361
+ - [ ] Create task-mcp project structure
362
+ - [ ] Implement Firebase Admin SDK client
363
+ - [ ] Create 8 core task management tools
364
+ - [ ] Implement MCP server with stdio transport
365
+ - [ ] Write unit tests for tools
366
+ - [ ] Deploy MCP server
367
+
368
+ **Success Criteria**:
369
+ - MCP server starts successfully
370
+ - Tools can be called via MCP protocol
371
+ - Firebase operations work correctly
372
+ - Tests pass
373
+
374
+ ### Phase 2: agentbase.me Integration (Week 3-4)
375
+
376
+ **Deliverables**:
377
+ - [ ] Task data model in agentbase.me
378
+ - [ ] API routes for UI operations
379
+ - [ ] MCP client integration in agent
380
+ - [ ] Task conversation type
381
+ - [ ] Basic UI components
382
+ - [ ] WebSocket progress updates
383
+
384
+ **Success Criteria**:
385
+ - Can create task from UI
386
+ - Agent can connect to MCP server
387
+ - Agent can call task tools
388
+ - UI displays task progress
389
+ - Real-time updates work
390
+
391
+ ### Phase 3: ACP Workflow Tools (Week 5-6)
392
+
393
+ **Deliverables**:
394
+ - [ ] 5 ACP workflow tools in task-mcp
395
+ - [ ] task_init - Initialize context
396
+ - [ ] task_get_detailed_status - Detailed status
397
+ - [ ] task_sync - Sync documentation
398
+ - [ ] task_generate_report - Generate report
399
+ - [ ] task_validate - Validate structure
400
+
401
+ **Success Criteria**:
402
+ - All 13 tools implemented
403
+ - Agent can use workflow tools
404
+ - Reports generate correctly
405
+ - Validation works
406
+
407
+ ### Phase 4: Autonomous Execution (Week 7-8)
408
+
409
+ **Deliverables**:
410
+ - [ ] Pessimistic execution loop
411
+ - [ ] Message queue system
412
+ - [ ] Auto-approval system
413
+ - [ ] Safety limits
414
+ - [ ] Error recovery
415
+ - [ ] UI polish
416
+
417
+ **Success Criteria**:
418
+ - Agent works through all milestones
419
+ - Safety limits prevent runaway execution
420
+ - Errors handled gracefully
421
+ - UI is polished and intuitive
422
+
423
+ ---
424
+
425
+ ## MCP Server Authentication
426
+
427
+ ### Multi-Tenant Authentication
428
+
429
+ The MCP server needs to know which user is making requests. Options:
430
+
431
+ **Option A: JWT in Tool Arguments**
432
+ ```typescript
433
+ // Every tool call includes user_id
434
+ {
435
+ "tool": "task_get_status",
436
+ "arguments": {
437
+ "user_id": "user_abc123", // Passed by agent
438
+ "task_id": "task_xyz789"
439
+ }
440
+ }
441
+ ```
442
+
443
+ **Option B: MCP Server Factory (Recommended)**
444
+ ```typescript
445
+ // Agent creates per-user MCP server instance
446
+ const mcpServer = createTaskMCPServer(userId, firebaseToken)
447
+ ```
448
+
449
+ **Decision**: Use Option B (server factory) for better security and isolation.
450
+
451
+ ---
452
+
453
+ ## Deployment
454
+
455
+ ### task-mcp Deployment Options
456
+
457
+ **Option 1: Cloud Run (Recommended)**
458
+ - Deploy as Cloud Run service
459
+ - Use SSE transport for HTTP connections
460
+ - Auto-scaling based on load
461
+ - Easy to update independently
462
+
463
+ **Option 2: Cloud Functions**
464
+ - Deploy as Cloud Function
465
+ - Triggered by agent requests
466
+ - Serverless, pay-per-use
467
+ - Cold start latency
468
+
469
+ **Option 3: Compute Engine**
470
+ - Deploy on VM
471
+ - Always-on, low latency
472
+ - More control, more cost
473
+ - Good for high-volume usage
474
+
475
+ **Recommendation**: Start with Cloud Run for balance of cost, performance, and ease of deployment.
476
+
477
+ ---
478
+
479
+ ## Security Considerations
480
+
481
+ ### MCP Server Security
482
+
483
+ **Requirements**:
484
+ - MCP server validates user identity
485
+ - Tools enforce user-scoped data access
486
+ - Service account has minimal permissions
487
+ - Audit logging for all operations
488
+
489
+ **Implementation**:
490
+ - Use Firebase Admin SDK with service account
491
+ - Validate user_id in every tool call
492
+ - Firestore security rules as backup
493
+ - Log all tool executions
494
+
495
+ ### API Security
496
+
497
+ **Requirements**:
498
+ - API routes require authentication
499
+ - Users can only access their own tasks
500
+ - Rate limiting per user
501
+ - Input validation
502
+
503
+ **Implementation**:
504
+ - Firebase Auth tokens
505
+ - User ID from auth token
506
+ - Firestore security rules
507
+ - Zod schema validation
508
+
509
+ ---
510
+
511
+ ## Success Metrics
512
+
513
+ ### Functional Metrics
514
+
515
+ - [ ] MCP server deploys successfully
516
+ - [ ] Agent can connect to MCP server
517
+ - [ ] All 13 tools work correctly
518
+ - [ ] Tasks execute autonomously
519
+ - [ ] Progress tracked accurately
520
+ - [ ] UI displays real-time updates
521
+
522
+ ### Performance Metrics
523
+
524
+ - [ ] Tool call latency < 200ms
525
+ - [ ] MCP server uptime > 99.9%
526
+ - [ ] Task creation < 1 second
527
+ - [ ] Progress updates < 500ms latency
528
+
529
+ ### User Experience Metrics
530
+
531
+ - [ ] Intuitive task creation
532
+ - [ ] Clear progress indicators
533
+ - [ ] Responsive UI
534
+ - [ ] Graceful error handling
535
+
536
+ ---
537
+
538
+ ## References
539
+
540
+ - [Roo Code Repository](https://github.com/RooVetGit/Roo-Code)
541
+ - [Agent Context Protocol (ACP)](../../../AGENT.md)
542
+ - [MCP Server Bootstrap Pattern](https://github.com/prmichaelsen/remember-mcp/blob/main/agent/patterns/bootstrap.md)
543
+ - [Model Context Protocol](https://modelcontextprotocol.io/)
544
+ - [Firebase Admin SDK](https://firebase.google.com/docs/admin/setup)
545
+ - [REST API Integration Design](rest-api-integration.md) - Dual interface architecture
546
+ - [MCP Best Practices](https://www.philschmid.de/mcp-best-practices) - Industry best practices
547
+
548
+ ---
549
+
550
+ **Status**: Design Specification
551
+ **Architecture**: MCP Server-First
552
+ **Next Action**: Begin Phase 1 - Create task-mcp project
553
+ **Owner**: Development Team
554
+ **Created**: 2026-02-16
555
+ **Last Updated**: 2026-02-16