@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.
- package/.env.example +19 -0
- package/AGENT.md +1165 -0
- package/CHANGELOG.md +72 -0
- package/agent/commands/acp.commit.md +511 -0
- package/agent/commands/acp.init.md +376 -0
- package/agent/commands/acp.package-install.md +347 -0
- package/agent/commands/acp.proceed.md +311 -0
- package/agent/commands/acp.report.md +392 -0
- package/agent/commands/acp.status.md +280 -0
- package/agent/commands/acp.sync.md +323 -0
- package/agent/commands/acp.update.md +301 -0
- package/agent/commands/acp.validate.md +385 -0
- package/agent/commands/acp.version-check-for-updates.md +275 -0
- package/agent/commands/acp.version-check.md +190 -0
- package/agent/commands/acp.version-update.md +288 -0
- package/agent/commands/command.template.md +273 -0
- package/agent/commands/git.commit.md +511 -0
- package/agent/commands/git.init.md +513 -0
- package/agent/design/.gitkeep +0 -0
- package/agent/design/acp-task-execution-requirements.md +555 -0
- package/agent/design/api-dto-design.md +394 -0
- package/agent/design/code-extraction-guide.md +827 -0
- package/agent/design/design.template.md +136 -0
- package/agent/design/requirements.template.md +387 -0
- package/agent/design/rest-api-integration.md +489 -0
- package/agent/design/sdk-export-requirements.md +549 -0
- package/agent/milestones/.gitkeep +0 -0
- package/agent/milestones/milestone-1-{title}.template.md +206 -0
- package/agent/milestones/milestone-2-task-infrastructure.md +232 -0
- package/agent/milestones/milestone-4-autonomous-execution.md +235 -0
- package/agent/patterns/.gitkeep +0 -0
- package/agent/patterns/bootstrap.md +1271 -0
- package/agent/patterns/bootstrap.template.md +1237 -0
- package/agent/patterns/pattern.template.md +364 -0
- package/agent/progress.template.yaml +158 -0
- package/agent/progress.yaml +375 -0
- package/agent/scripts/check-for-updates.sh +88 -0
- package/agent/scripts/install.sh +157 -0
- package/agent/scripts/uninstall.sh +75 -0
- package/agent/scripts/update.sh +139 -0
- package/agent/scripts/version.sh +35 -0
- package/agent/tasks/.gitkeep +0 -0
- package/agent/tasks/task-1-{title}.template.md +225 -0
- package/agent/tasks/task-86-task-data-model-schemas.md +143 -0
- package/agent/tasks/task-87-task-database-service.md +220 -0
- package/agent/tasks/task-88-firebase-client-wrapper.md +139 -0
- package/agent/tasks/task-88-task-execution-engine.md +277 -0
- package/agent/tasks/task-89-mcp-server-implementation.md +197 -0
- package/agent/tasks/task-90-build-configuration.md +146 -0
- package/agent/tasks/task-91-deployment-configuration.md +128 -0
- package/coverage/base.css +224 -0
- package/coverage/block-navigation.js +87 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +191 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +191 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +210 -0
- package/coverage/lcov-report/src/client.ts.html +1030 -0
- package/coverage/lcov-report/src/constant/collections.ts.html +469 -0
- package/coverage/lcov-report/src/constant/index.html +116 -0
- package/coverage/lcov-report/src/dto/index.html +116 -0
- package/coverage/lcov-report/src/dto/transformers.ts.html +568 -0
- package/coverage/lcov-report/src/index.html +146 -0
- package/coverage/lcov-report/src/schemas/index.html +116 -0
- package/coverage/lcov-report/src/schemas/task.ts.html +547 -0
- package/coverage/lcov-report/src/server-factory.ts.html +418 -0
- package/coverage/lcov-report/src/server.ts.html +289 -0
- package/coverage/lcov-report/src/services/index.html +116 -0
- package/coverage/lcov-report/src/services/task-database.service.ts.html +1495 -0
- package/coverage/lcov-report/src/tools/index.html +236 -0
- package/coverage/lcov-report/src/tools/index.ts.html +292 -0
- package/coverage/lcov-report/src/tools/task-add-message.ts.html +277 -0
- package/coverage/lcov-report/src/tools/task-complete-task-item.ts.html +343 -0
- package/coverage/lcov-report/src/tools/task-create-milestone.ts.html +286 -0
- package/coverage/lcov-report/src/tools/task-create-task-item.ts.html +358 -0
- package/coverage/lcov-report/src/tools/task-get-next-step.ts.html +460 -0
- package/coverage/lcov-report/src/tools/task-get-status.ts.html +316 -0
- package/coverage/lcov-report/src/tools/task-report-completion.ts.html +343 -0
- package/coverage/lcov-report/src/tools/task-update-progress.ts.html +232 -0
- package/coverage/lcov.info +974 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +210 -0
- package/coverage/src/client.ts.html +1030 -0
- package/coverage/src/constant/collections.ts.html +469 -0
- package/coverage/src/constant/index.html +116 -0
- package/coverage/src/dto/index.html +116 -0
- package/coverage/src/dto/transformers.ts.html +568 -0
- package/coverage/src/index.html +146 -0
- package/coverage/src/schemas/index.html +116 -0
- package/coverage/src/schemas/task.ts.html +547 -0
- package/coverage/src/server-factory.ts.html +418 -0
- package/coverage/src/server.ts.html +289 -0
- package/coverage/src/services/index.html +116 -0
- package/coverage/src/services/task-database.service.ts.html +1495 -0
- package/coverage/src/tools/index.html +236 -0
- package/coverage/src/tools/index.ts.html +292 -0
- package/coverage/src/tools/task-add-message.ts.html +277 -0
- package/coverage/src/tools/task-complete-task-item.ts.html +343 -0
- package/coverage/src/tools/task-create-milestone.ts.html +286 -0
- package/coverage/src/tools/task-create-task-item.ts.html +358 -0
- package/coverage/src/tools/task-get-next-step.ts.html +460 -0
- package/coverage/src/tools/task-get-status.ts.html +316 -0
- package/coverage/src/tools/task-report-completion.ts.html +343 -0
- package/coverage/src/tools/task-update-progress.ts.html +232 -0
- package/firestore.rules +95 -0
- package/jest.config.js +31 -0
- package/package.json +67 -0
- package/src/client.spec.ts +199 -0
- package/src/client.ts +315 -0
- package/src/constant/collections.ts +128 -0
- package/src/dto/index.ts +47 -0
- package/src/dto/task-api.dto.ts +219 -0
- package/src/dto/transformers.spec.ts +462 -0
- package/src/dto/transformers.ts +161 -0
- package/src/schemas/task.ts +154 -0
- package/src/server-factory.spec.ts +70 -0
- package/src/server-factory.ts +111 -0
- package/src/server.ts +68 -0
- package/src/services/task-database.service.e2e.ts +116 -0
- package/src/services/task-database.service.spec.ts +479 -0
- package/src/services/task-database.service.ts +470 -0
- package/src/test-schemas.ts +161 -0
- package/src/tools/index.ts +69 -0
- package/src/tools/task-add-message.ts +64 -0
- package/src/tools/task-complete-task-item.ts +86 -0
- package/src/tools/task-create-milestone.ts +67 -0
- package/src/tools/task-create-task-item.ts +91 -0
- package/src/tools/task-get-next-step.spec.ts +136 -0
- package/src/tools/task-get-next-step.ts +125 -0
- package/src/tools/task-get-status.spec.ts +213 -0
- package/src/tools/task-get-status.ts +77 -0
- package/src/tools/task-report-completion.ts +86 -0
- package/src/tools/task-update-progress.ts +49 -0
- package/src/tools/tools.spec.ts +194 -0
- package/tsconfig.json +31 -0
|
@@ -0,0 +1,549 @@
|
|
|
1
|
+
# task-mcp SDK Requirements for agentbase.me Integration
|
|
2
|
+
|
|
3
|
+
**Concept**: Requirements for task-mcp to export TypeScript types and REST API SDK for consumption by agentbase.me
|
|
4
|
+
**Created**: 2026-02-16
|
|
5
|
+
**Status**: Design Specification
|
|
6
|
+
**Audience**: task-mcp development team
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
For agentbase.me to integrate with task-mcp without duplicating code, task-mcp must export:
|
|
13
|
+
1. **TypeScript types** - Shared type definitions for tasks, milestones, and task items
|
|
14
|
+
2. **REST API SDK** - Client library for calling task-mcp REST endpoints
|
|
15
|
+
3. **MCP tools** - Already implemented for agent use
|
|
16
|
+
|
|
17
|
+
This document specifies what agentbase.me expects from the task-mcp npm package.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Package Structure
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
task-mcp/
|
|
25
|
+
├── package.json
|
|
26
|
+
├── src/
|
|
27
|
+
│ ├── index.ts # Main exports
|
|
28
|
+
│ ├── types/ # TypeScript types (exported)
|
|
29
|
+
│ │ ├── index.ts
|
|
30
|
+
│ │ ├── task.ts
|
|
31
|
+
│ │ ├── milestone.ts
|
|
32
|
+
│ │ └── task-item.ts
|
|
33
|
+
│ │
|
|
34
|
+
│ ├── sdk/ # REST API SDK (exported)
|
|
35
|
+
│ │ ├── index.ts
|
|
36
|
+
│ │ ├── client.ts
|
|
37
|
+
│ │ ├── tasks.ts
|
|
38
|
+
│ │ ├── milestones.ts
|
|
39
|
+
│ │ └── progress.ts
|
|
40
|
+
│ │
|
|
41
|
+
│ ├── tools/ # MCP tools (not exported)
|
|
42
|
+
│ │ └── ...
|
|
43
|
+
│ │
|
|
44
|
+
│ └── server/ # MCP server (not exported)
|
|
45
|
+
│ └── ...
|
|
46
|
+
│
|
|
47
|
+
└── dist/ # Built package
|
|
48
|
+
├── index.js
|
|
49
|
+
├── index.d.ts
|
|
50
|
+
├── types/
|
|
51
|
+
└── sdk/
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 1. TypeScript Types Export
|
|
57
|
+
|
|
58
|
+
### What to Export
|
|
59
|
+
|
|
60
|
+
Export all TypeScript types from Zod schemas:
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
// task-mcp/src/types/index.ts
|
|
64
|
+
export * from './task'
|
|
65
|
+
export * from './milestone'
|
|
66
|
+
export * from './task-item'
|
|
67
|
+
|
|
68
|
+
// task-mcp/src/types/task.ts
|
|
69
|
+
import { z } from 'zod'
|
|
70
|
+
|
|
71
|
+
// Zod schemas
|
|
72
|
+
export const TaskStatusSchema = z.enum([
|
|
73
|
+
'not_started',
|
|
74
|
+
'in_progress',
|
|
75
|
+
'paused',
|
|
76
|
+
'completed',
|
|
77
|
+
'failed'
|
|
78
|
+
])
|
|
79
|
+
|
|
80
|
+
export const TaskSchema = z.object({
|
|
81
|
+
id: z.string(),
|
|
82
|
+
user_id: z.string(),
|
|
83
|
+
title: z.string().min(1).max(200),
|
|
84
|
+
description: z.string().min(1).max(5000),
|
|
85
|
+
status: TaskStatusSchema,
|
|
86
|
+
created_at: z.string(),
|
|
87
|
+
updated_at: z.string(),
|
|
88
|
+
started_at: z.string().optional(),
|
|
89
|
+
completed_at: z.string().optional(),
|
|
90
|
+
progress: TaskProgressSchema,
|
|
91
|
+
execution: TaskExecutionSchema,
|
|
92
|
+
config: TaskConfigSchema,
|
|
93
|
+
metadata: TaskMetadataSchema
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
// TypeScript types
|
|
97
|
+
export type TaskStatus = z.infer<typeof TaskStatusSchema>
|
|
98
|
+
export type Task = z.infer<typeof TaskSchema>
|
|
99
|
+
export type TaskProgress = z.infer<typeof TaskProgressSchema>
|
|
100
|
+
export type TaskExecution = z.infer<typeof TaskExecutionSchema>
|
|
101
|
+
export type TaskConfig = z.infer<typeof TaskConfigSchema>
|
|
102
|
+
export type TaskMetadata = z.infer<typeof TaskMetadataSchema>
|
|
103
|
+
|
|
104
|
+
// Helper functions
|
|
105
|
+
export function createTaskTemplate(
|
|
106
|
+
userId: string,
|
|
107
|
+
title: string,
|
|
108
|
+
description: string,
|
|
109
|
+
config?: Partial<TaskConfig>
|
|
110
|
+
): Omit<Task, 'id'>
|
|
111
|
+
|
|
112
|
+
export function validateTask(data: unknown):
|
|
113
|
+
| { success: true; data: Task }
|
|
114
|
+
| { success: false; error: z.ZodError }
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Usage in agentbase.me
|
|
118
|
+
|
|
119
|
+
```typescript
|
|
120
|
+
// In agentbase.me
|
|
121
|
+
import { Task, Milestone, TaskItem, createTaskTemplate } from 'task-mcp'
|
|
122
|
+
|
|
123
|
+
// Use types
|
|
124
|
+
const task: Task = {
|
|
125
|
+
id: 'task_123',
|
|
126
|
+
user_id: 'user_456',
|
|
127
|
+
// ...
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Use helpers
|
|
131
|
+
const template = createTaskTemplate('user_456', 'My Task', 'Description')
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## 2. REST API SDK Export
|
|
137
|
+
|
|
138
|
+
### SDK Client Interface
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
// task-mcp/src/sdk/client.ts
|
|
142
|
+
export interface TaskMCPClientConfig {
|
|
143
|
+
endpoint: string // https://task-mcp.agentbase.me
|
|
144
|
+
serviceToken: string // Authentication token
|
|
145
|
+
timeout?: number // Request timeout (default: 30000ms)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export class TaskMCPClient {
|
|
149
|
+
constructor(config: TaskMCPClientConfig)
|
|
150
|
+
|
|
151
|
+
// Task operations
|
|
152
|
+
tasks: TasksAPI
|
|
153
|
+
|
|
154
|
+
// Milestone operations
|
|
155
|
+
milestones: MilestonesAPI
|
|
156
|
+
|
|
157
|
+
// Progress operations
|
|
158
|
+
progress: ProgressAPI
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Tasks API
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
// task-mcp/src/sdk/tasks.ts
|
|
166
|
+
export interface TasksAPI {
|
|
167
|
+
// List user's tasks
|
|
168
|
+
list(userId: string, options?: {
|
|
169
|
+
status?: TaskStatus
|
|
170
|
+
limit?: number
|
|
171
|
+
offset?: number
|
|
172
|
+
}): Promise<Task[]>
|
|
173
|
+
|
|
174
|
+
// Get single task
|
|
175
|
+
get(userId: string, taskId: string): Promise<Task | null>
|
|
176
|
+
|
|
177
|
+
// Create task
|
|
178
|
+
create(userId: string, data: Omit<Task, 'id' | 'created_at' | 'updated_at'>): Promise<Task>
|
|
179
|
+
|
|
180
|
+
// Update task
|
|
181
|
+
update(userId: string, taskId: string, data: Partial<Task>): Promise<Task>
|
|
182
|
+
|
|
183
|
+
// Delete task
|
|
184
|
+
delete(userId: string, taskId: string): Promise<void>
|
|
185
|
+
|
|
186
|
+
// Get task messages
|
|
187
|
+
getMessages(userId: string, taskId: string, options?: {
|
|
188
|
+
limit?: number
|
|
189
|
+
startAfter?: string
|
|
190
|
+
}): Promise<TaskMessage[]>
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Milestones API
|
|
195
|
+
|
|
196
|
+
```typescript
|
|
197
|
+
// task-mcp/src/sdk/milestones.ts
|
|
198
|
+
export interface MilestonesAPI {
|
|
199
|
+
// List milestones for a task
|
|
200
|
+
list(userId: string, taskId: string): Promise<Milestone[]>
|
|
201
|
+
|
|
202
|
+
// Get single milestone
|
|
203
|
+
get(userId: string, taskId: string, milestoneId: string): Promise<Milestone | null>
|
|
204
|
+
|
|
205
|
+
// Create milestone
|
|
206
|
+
create(userId: string, taskId: string, data: Omit<Milestone, 'id'>): Promise<Milestone>
|
|
207
|
+
|
|
208
|
+
// Update milestone
|
|
209
|
+
update(userId: string, taskId: string, milestoneId: string, data: Partial<Milestone>): Promise<Milestone>
|
|
210
|
+
|
|
211
|
+
// Complete milestone
|
|
212
|
+
complete(userId: string, taskId: string, milestoneId: string): Promise<Milestone>
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Progress API
|
|
217
|
+
|
|
218
|
+
```typescript
|
|
219
|
+
// task-mcp/src/sdk/progress.ts
|
|
220
|
+
export interface ProgressAPI {
|
|
221
|
+
// Get task progress
|
|
222
|
+
get(userId: string, taskId: string): Promise<TaskProgress>
|
|
223
|
+
|
|
224
|
+
// Update progress
|
|
225
|
+
update(userId: string, taskId: string, progress: Partial<TaskProgress>): Promise<TaskProgress>
|
|
226
|
+
|
|
227
|
+
// Complete task item
|
|
228
|
+
completeTaskItem(userId: string, taskId: string, milestoneId: string, taskItemId: string): Promise<void>
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### Usage in agentbase.me
|
|
233
|
+
|
|
234
|
+
```typescript
|
|
235
|
+
// In agentbase.me
|
|
236
|
+
import { TaskMCPClient } from 'task-mcp/sdk'
|
|
237
|
+
import { MCPServerDatabaseService } from '@/services/mcp-server-database.service'
|
|
238
|
+
|
|
239
|
+
// Get credentials from MCP integrations service (not env vars)
|
|
240
|
+
const server = await MCPServerDatabaseService.getServerById('task-mcp')
|
|
241
|
+
if (!server) {
|
|
242
|
+
throw new Error('task-mcp server not registered')
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
const client = new TaskMCPClient({
|
|
246
|
+
endpoint: server.endpoint,
|
|
247
|
+
serviceToken: server.service_token
|
|
248
|
+
})
|
|
249
|
+
|
|
250
|
+
// List tasks
|
|
251
|
+
const tasks = await client.tasks.list('user_123', {
|
|
252
|
+
status: 'in_progress',
|
|
253
|
+
limit: 10
|
|
254
|
+
})
|
|
255
|
+
|
|
256
|
+
// Create task
|
|
257
|
+
const newTask = await client.tasks.create('user_123', {
|
|
258
|
+
title: 'My Task',
|
|
259
|
+
description: 'Task description',
|
|
260
|
+
status: 'not_started',
|
|
261
|
+
// ...
|
|
262
|
+
})
|
|
263
|
+
|
|
264
|
+
// Get progress
|
|
265
|
+
const progress = await client.progress.get('user_123', 'task_456')
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
**Note**: Credentials retrieved from MCP integrations service (Firestore `mcp_servers` collection), following the same pattern as other MCP servers.
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
## 3. Package Configuration
|
|
273
|
+
|
|
274
|
+
### package.json
|
|
275
|
+
|
|
276
|
+
```json
|
|
277
|
+
{
|
|
278
|
+
"name": "task-mcp",
|
|
279
|
+
"version": "1.0.0",
|
|
280
|
+
"description": "MCP server for autonomous task execution with SDK",
|
|
281
|
+
"type": "module",
|
|
282
|
+
"main": "dist/index.js",
|
|
283
|
+
"types": "dist/index.d.ts",
|
|
284
|
+
"exports": {
|
|
285
|
+
".": {
|
|
286
|
+
"import": "./dist/index.js",
|
|
287
|
+
"types": "./dist/index.d.ts"
|
|
288
|
+
},
|
|
289
|
+
"./types": {
|
|
290
|
+
"import": "./dist/types/index.js",
|
|
291
|
+
"types": "./dist/types/index.d.ts"
|
|
292
|
+
},
|
|
293
|
+
"./sdk": {
|
|
294
|
+
"import": "./dist/sdk/index.js",
|
|
295
|
+
"types": "./dist/sdk/index.d.ts"
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
"files": [
|
|
299
|
+
"dist"
|
|
300
|
+
],
|
|
301
|
+
"scripts": {
|
|
302
|
+
"build": "tsc",
|
|
303
|
+
"prepublishOnly": "npm run build"
|
|
304
|
+
},
|
|
305
|
+
"dependencies": {
|
|
306
|
+
"zod": "^4.3.6"
|
|
307
|
+
},
|
|
308
|
+
"peerDependencies": {
|
|
309
|
+
"zod": "^4.0.0"
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
### Main Export
|
|
315
|
+
|
|
316
|
+
```typescript
|
|
317
|
+
// task-mcp/src/index.ts
|
|
318
|
+
// Export types
|
|
319
|
+
export * from './types'
|
|
320
|
+
|
|
321
|
+
// Export SDK
|
|
322
|
+
export * from './sdk'
|
|
323
|
+
|
|
324
|
+
// Do NOT export server or tools (internal only)
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
---
|
|
328
|
+
|
|
329
|
+
## 4. REST API Endpoints (task-mcp Server)
|
|
330
|
+
|
|
331
|
+
The SDK calls these REST endpoints on the task-mcp server:
|
|
332
|
+
|
|
333
|
+
### Task Endpoints
|
|
334
|
+
|
|
335
|
+
```
|
|
336
|
+
GET /api/tasks?user_id={userId}&status={status}&limit={limit}&offset={offset}
|
|
337
|
+
POST /api/tasks
|
|
338
|
+
GET /api/tasks/{taskId}?user_id={userId}
|
|
339
|
+
PATCH /api/tasks/{taskId}?user_id={userId}
|
|
340
|
+
DELETE /api/tasks/{taskId}?user_id={userId}
|
|
341
|
+
GET /api/tasks/{taskId}/messages?user_id={userId}&limit={limit}&startAfter={cursor}
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
### Milestone Endpoints
|
|
345
|
+
|
|
346
|
+
```
|
|
347
|
+
GET /api/tasks/{taskId}/milestones?user_id={userId}
|
|
348
|
+
POST /api/tasks/{taskId}/milestones?user_id={userId}
|
|
349
|
+
GET /api/tasks/{taskId}/milestones/{milestoneId}?user_id={userId}
|
|
350
|
+
PATCH /api/tasks/{taskId}/milestones/{milestoneId}?user_id={userId}
|
|
351
|
+
POST /api/tasks/{taskId}/milestones/{milestoneId}/complete?user_id={userId}
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
### Progress Endpoints
|
|
355
|
+
|
|
356
|
+
```
|
|
357
|
+
GET /api/tasks/{taskId}/progress?user_id={userId}
|
|
358
|
+
PATCH /api/tasks/{taskId}/progress?user_id={userId}
|
|
359
|
+
POST /api/tasks/{taskId}/progress/complete-item?user_id={userId}
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
### Authentication
|
|
363
|
+
|
|
364
|
+
All endpoints require authentication via service token:
|
|
365
|
+
|
|
366
|
+
```
|
|
367
|
+
Authorization: Bearer {serviceToken}
|
|
368
|
+
X-User-ID: {userId}
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
---
|
|
372
|
+
|
|
373
|
+
## 5. Error Handling
|
|
374
|
+
|
|
375
|
+
### SDK Error Types
|
|
376
|
+
|
|
377
|
+
```typescript
|
|
378
|
+
// task-mcp/src/sdk/errors.ts
|
|
379
|
+
export class TaskMCPError extends Error {
|
|
380
|
+
constructor(
|
|
381
|
+
message: string,
|
|
382
|
+
public statusCode: number,
|
|
383
|
+
public code: string
|
|
384
|
+
) {
|
|
385
|
+
super(message)
|
|
386
|
+
this.name = 'TaskMCPError'
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
export class TaskNotFoundError extends TaskMCPError {
|
|
391
|
+
constructor(taskId: string) {
|
|
392
|
+
super(`Task not found: ${taskId}`, 404, 'TASK_NOT_FOUND')
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
export class UnauthorizedError extends TaskMCPError {
|
|
397
|
+
constructor() {
|
|
398
|
+
super('Unauthorized', 401, 'UNAUTHORIZED')
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
export class ValidationError extends TaskMCPError {
|
|
403
|
+
constructor(message: string) {
|
|
404
|
+
super(message, 400, 'VALIDATION_ERROR')
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
### Usage in agentbase.me
|
|
410
|
+
|
|
411
|
+
```typescript
|
|
412
|
+
import { TaskMCPClient, TaskNotFoundError } from 'task-mcp/sdk'
|
|
413
|
+
|
|
414
|
+
try {
|
|
415
|
+
const task = await client.tasks.get('user_123', 'task_456')
|
|
416
|
+
} catch (error) {
|
|
417
|
+
if (error instanceof TaskNotFoundError) {
|
|
418
|
+
// Handle not found
|
|
419
|
+
} else {
|
|
420
|
+
// Handle other errors
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
---
|
|
426
|
+
|
|
427
|
+
## 6. Installation in agentbase.me
|
|
428
|
+
|
|
429
|
+
### Install Package
|
|
430
|
+
|
|
431
|
+
```bash
|
|
432
|
+
npm install task-mcp
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
### Configure Client
|
|
436
|
+
|
|
437
|
+
```typescript
|
|
438
|
+
// agentbase.me/src/lib/task-mcp-client.ts
|
|
439
|
+
import { TaskMCPClient } from 'task-mcp/sdk'
|
|
440
|
+
|
|
441
|
+
export const taskMCPClient = new TaskMCPClient({
|
|
442
|
+
endpoint: process.env.TASK_MCP_ENDPOINT!,
|
|
443
|
+
serviceToken: process.env.TASK_MCP_SERVICE_TOKEN!,
|
|
444
|
+
timeout: 30000
|
|
445
|
+
})
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
### Use in Components
|
|
449
|
+
|
|
450
|
+
```typescript
|
|
451
|
+
// agentbase.me/src/components/TaskList.tsx
|
|
452
|
+
import { Task } from 'task-mcp'
|
|
453
|
+
import { taskMCPClient } from '@/lib/task-mcp-client'
|
|
454
|
+
|
|
455
|
+
export function TaskList({ userId }: { userId: string }) {
|
|
456
|
+
const [tasks, setTasks] = useState<Task[]>([])
|
|
457
|
+
|
|
458
|
+
useEffect(() => {
|
|
459
|
+
taskMCPClient.tasks.list(userId, { status: 'in_progress' })
|
|
460
|
+
.then(setTasks)
|
|
461
|
+
}, [userId])
|
|
462
|
+
|
|
463
|
+
return (
|
|
464
|
+
<div>
|
|
465
|
+
{tasks.map(task => (
|
|
466
|
+
<TaskCard key={task.id} task={task} />
|
|
467
|
+
))}
|
|
468
|
+
</div>
|
|
469
|
+
)
|
|
470
|
+
}
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
---
|
|
474
|
+
|
|
475
|
+
## 7. Deliverables Checklist
|
|
476
|
+
|
|
477
|
+
For task-mcp to be consumable by agentbase.me:
|
|
478
|
+
|
|
479
|
+
- [ ] Export TypeScript types from Zod schemas
|
|
480
|
+
- [ ] Export helper functions (createTaskTemplate, validateTask, etc.)
|
|
481
|
+
- [ ] Implement TaskMCPClient class
|
|
482
|
+
- [ ] Implement TasksAPI with all methods
|
|
483
|
+
- [ ] Implement MilestonesAPI with all methods
|
|
484
|
+
- [ ] Implement ProgressAPI with all methods
|
|
485
|
+
- [ ] Implement error classes
|
|
486
|
+
- [ ] Create REST API endpoints on task-mcp server
|
|
487
|
+
- [ ] Add authentication middleware (service token + user_id)
|
|
488
|
+
- [ ] Build and publish npm package
|
|
489
|
+
- [ ] Generate TypeScript declaration files (.d.ts)
|
|
490
|
+
- [ ] Document SDK usage in README
|
|
491
|
+
|
|
492
|
+
---
|
|
493
|
+
|
|
494
|
+
## 8. Testing
|
|
495
|
+
|
|
496
|
+
### Unit Tests (task-mcp)
|
|
497
|
+
|
|
498
|
+
```typescript
|
|
499
|
+
// task-mcp/src/sdk/client.spec.ts
|
|
500
|
+
describe('TaskMCPClient', () => {
|
|
501
|
+
it('should list tasks', async () => {
|
|
502
|
+
const client = new TaskMCPClient({ endpoint, serviceToken })
|
|
503
|
+
const tasks = await client.tasks.list('user_123')
|
|
504
|
+
expect(tasks).toBeInstanceOf(Array)
|
|
505
|
+
})
|
|
506
|
+
})
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
### Integration Tests (agentbase.me)
|
|
510
|
+
|
|
511
|
+
```typescript
|
|
512
|
+
// agentbase.me/src/lib/task-mcp-client.spec.ts
|
|
513
|
+
import { taskMCPClient } from './task-mcp-client'
|
|
514
|
+
|
|
515
|
+
describe('task-mcp integration', () => {
|
|
516
|
+
it('should create and retrieve task', async () => {
|
|
517
|
+
const created = await taskMCPClient.tasks.create('user_123', {
|
|
518
|
+
title: 'Test Task',
|
|
519
|
+
description: 'Test',
|
|
520
|
+
// ...
|
|
521
|
+
})
|
|
522
|
+
|
|
523
|
+
const retrieved = await taskMCPClient.tasks.get('user_123', created.id)
|
|
524
|
+
expect(retrieved).toEqual(created)
|
|
525
|
+
})
|
|
526
|
+
})
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
---
|
|
530
|
+
|
|
531
|
+
## Summary
|
|
532
|
+
|
|
533
|
+
For agentbase.me to successfully integrate with task-mcp:
|
|
534
|
+
|
|
535
|
+
1. **task-mcp exports types** - No duplication of schemas
|
|
536
|
+
2. **task-mcp exports SDK** - Clean REST API client
|
|
537
|
+
3. **task-mcp provides REST endpoints** - SDK calls these
|
|
538
|
+
4. **agentbase.me imports and uses** - No direct Firestore access
|
|
539
|
+
|
|
540
|
+
This creates a clean separation:
|
|
541
|
+
- **task-mcp**: Data layer + MCP tools + REST API + SDK
|
|
542
|
+
- **agentbase.me**: UI layer + Agent orchestration + SDK consumer
|
|
543
|
+
|
|
544
|
+
---
|
|
545
|
+
|
|
546
|
+
**Status**: Design Specification
|
|
547
|
+
**Next Action**: Implement SDK in task-mcp
|
|
548
|
+
**Owner**: task-mcp development team
|
|
549
|
+
**Consumer**: agentbase.me
|
|
File without changes
|