mcp-sunsama 0.6.0 → 0.7.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/CHANGELOG.md +13 -0
- package/CLAUDE.md +1 -1
- package/README.md +1 -0
- package/dist/main.js +59 -3
- package/dist/schemas.d.ts +10 -2
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +4 -0
- package/package.json +1 -1
- package/src/main.ts +66 -2
- package/src/schemas.ts +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# mcp-sunsama
|
|
2
2
|
|
|
3
|
+
## 0.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 3394176: Add get-task-by-id tool for retrieving specific tasks by their unique identifier
|
|
8
|
+
|
|
9
|
+
- Add `get-task-by-id` MCP tool that retrieves a specific task by its ID
|
|
10
|
+
- Add `getTaskByIdSchema` with taskId parameter validation
|
|
11
|
+
- Return complete task object if found, null if not found
|
|
12
|
+
- Follow standard tool patterns for authentication, error handling, and logging
|
|
13
|
+
- Update documentation in README.md and CLAUDE.md
|
|
14
|
+
- Maintain consistent JSON response format for single object retrieval
|
|
15
|
+
|
|
3
16
|
## 0.6.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
package/CLAUDE.md
CHANGED
|
@@ -126,7 +126,7 @@ Optional:
|
|
|
126
126
|
|
|
127
127
|
### Task Operations
|
|
128
128
|
Full CRUD support:
|
|
129
|
-
- **Read**: `get-tasks-by-day`, `get-tasks-backlog`, `get-archived-tasks`, `get-streams`
|
|
129
|
+
- **Read**: `get-tasks-by-day`, `get-tasks-backlog`, `get-archived-tasks`, `get-task-by-id`, `get-streams`
|
|
130
130
|
- **Write**: `create-task`, `update-task-complete`, `update-task-snooze-date`, `update-task-backlog`, `delete-task`
|
|
131
131
|
|
|
132
132
|
Task read operations support response trimming. `get-tasks-by-day` includes completion filtering. `get-archived-tasks` includes enhanced pagination with hasMore flag for LLM decision-making.
|
package/README.md
CHANGED
|
@@ -92,6 +92,7 @@ Add this configuration to your Claude Desktop MCP settings:
|
|
|
92
92
|
- `get-tasks-by-day` - Get tasks for a specific day with completion filtering
|
|
93
93
|
- `get-tasks-backlog` - Get backlog tasks
|
|
94
94
|
- `get-archived-tasks` - Get archived tasks with pagination (includes hasMore flag for LLM context)
|
|
95
|
+
- `get-task-by-id` - Get a specific task by its ID
|
|
95
96
|
- `update-task-complete` - Mark tasks as complete
|
|
96
97
|
- `update-task-snooze-date` - Reschedule tasks to different dates
|
|
97
98
|
- `update-task-backlog` - Move tasks to the backlog
|
package/dist/main.js
CHANGED
|
@@ -3,7 +3,7 @@ import { FastMCP } from "fastmcp";
|
|
|
3
3
|
import { httpStreamAuthenticator } from "./auth/http.js";
|
|
4
4
|
import { initializeStdioAuth } from "./auth/stdio.js";
|
|
5
5
|
import { getTransportConfig } from "./config/transport.js";
|
|
6
|
-
import { createTaskSchema, deleteTaskSchema, getArchivedTasksSchema, getStreamsSchema, getTasksBacklogSchema, getTasksByDaySchema, getUserSchema, updateTaskBacklogSchema, updateTaskCompleteSchema, updateTaskSnoozeDateSchema } from "./schemas.js";
|
|
6
|
+
import { createTaskSchema, deleteTaskSchema, getArchivedTasksSchema, getStreamsSchema, getTaskByIdSchema, getTasksBacklogSchema, getTasksByDaySchema, getUserSchema, updateTaskBacklogSchema, updateTaskCompleteSchema, updateTaskSnoozeDateSchema } from "./schemas.js";
|
|
7
7
|
import { getSunsamaClient } from "./utils/client-resolver.js";
|
|
8
8
|
import { filterTasksByCompletion } from "./utils/task-filters.js";
|
|
9
9
|
import { trimTasksForResponse } from "./utils/task-trimmer.js";
|
|
@@ -16,14 +16,14 @@ if (transportConfig.transportType === "stdio") {
|
|
|
16
16
|
}
|
|
17
17
|
const server = new FastMCP({
|
|
18
18
|
name: "Sunsama API Server",
|
|
19
|
-
version: "0.
|
|
19
|
+
version: "0.7.0",
|
|
20
20
|
instructions: `
|
|
21
21
|
This MCP server provides access to the Sunsama API for task and project management.
|
|
22
22
|
|
|
23
23
|
Available tools:
|
|
24
24
|
- Authentication: login, logout, check authentication status
|
|
25
25
|
- User operations: get current user information
|
|
26
|
-
- Task operations: get tasks by day, get backlog tasks, get archived tasks
|
|
26
|
+
- Task operations: get tasks by day, get backlog tasks, get archived tasks, get task by ID
|
|
27
27
|
- Stream operations: get streams/channels for the user's group
|
|
28
28
|
|
|
29
29
|
Authentication is required for all operations. You can either:
|
|
@@ -210,6 +210,57 @@ ${toTsv(trimmedTasks)}`;
|
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
212
|
});
|
|
213
|
+
server.addTool({
|
|
214
|
+
name: "get-task-by-id",
|
|
215
|
+
description: "Get a specific task by its ID",
|
|
216
|
+
parameters: getTaskByIdSchema,
|
|
217
|
+
execute: async (args, { session, log }) => {
|
|
218
|
+
try {
|
|
219
|
+
const { taskId } = args;
|
|
220
|
+
log.info("Getting task by ID", {
|
|
221
|
+
taskId: taskId
|
|
222
|
+
});
|
|
223
|
+
// Get the appropriate client based on transport type
|
|
224
|
+
const sunsamaClient = getSunsamaClient(session);
|
|
225
|
+
// Get the specific task by ID
|
|
226
|
+
const task = await sunsamaClient.getTaskById(taskId);
|
|
227
|
+
if (task) {
|
|
228
|
+
log.info("Successfully retrieved task by ID", {
|
|
229
|
+
taskId: taskId,
|
|
230
|
+
taskText: task.text
|
|
231
|
+
});
|
|
232
|
+
return {
|
|
233
|
+
content: [
|
|
234
|
+
{
|
|
235
|
+
type: "text",
|
|
236
|
+
text: JSON.stringify(task, null, 2)
|
|
237
|
+
}
|
|
238
|
+
]
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
log.info("Task not found", {
|
|
243
|
+
taskId: taskId
|
|
244
|
+
});
|
|
245
|
+
return {
|
|
246
|
+
content: [
|
|
247
|
+
{
|
|
248
|
+
type: "text",
|
|
249
|
+
text: "null"
|
|
250
|
+
}
|
|
251
|
+
]
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
catch (error) {
|
|
256
|
+
log.error("Failed to get task by ID", {
|
|
257
|
+
taskId: args.taskId,
|
|
258
|
+
error: error instanceof Error ? error.message : 'Unknown error'
|
|
259
|
+
});
|
|
260
|
+
throw new Error(`Failed to get task by ID: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
});
|
|
213
264
|
// Task Mutation Operations
|
|
214
265
|
server.addTool({
|
|
215
266
|
name: "create-task",
|
|
@@ -561,6 +612,11 @@ Uses HTTP Basic Auth headers (per-request authentication):
|
|
|
561
612
|
- Returns: TSV of trimmed archived Task objects with pagination metadata header
|
|
562
613
|
- Pagination: Uses limit+1 pattern to determine if more results are available
|
|
563
614
|
|
|
615
|
+
- **get-task-by-id**: Get a specific task by its ID
|
|
616
|
+
- Parameters:
|
|
617
|
+
- \`taskId\` (required): The ID of the task to retrieve
|
|
618
|
+
- Returns: JSON with complete Task object if found, or null if not found
|
|
619
|
+
|
|
564
620
|
- **create-task**: Create a new task with optional properties
|
|
565
621
|
- Parameters:
|
|
566
622
|
- \`text\` (required): Task title/description
|
package/dist/schemas.d.ts
CHANGED
|
@@ -27,6 +27,13 @@ export declare const getArchivedTasksSchema: z.ZodObject<{
|
|
|
27
27
|
offset?: number | undefined;
|
|
28
28
|
limit?: number | undefined;
|
|
29
29
|
}>;
|
|
30
|
+
export declare const getTaskByIdSchema: z.ZodObject<{
|
|
31
|
+
taskId: z.ZodString;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
taskId: string;
|
|
34
|
+
}, {
|
|
35
|
+
taskId: string;
|
|
36
|
+
}>;
|
|
30
37
|
/**
|
|
31
38
|
* User Operation Schemas
|
|
32
39
|
*/
|
|
@@ -49,22 +56,22 @@ export declare const createTaskSchema: z.ZodObject<{
|
|
|
49
56
|
taskId: z.ZodOptional<z.ZodString>;
|
|
50
57
|
}, "strip", z.ZodTypeAny, {
|
|
51
58
|
text: string;
|
|
59
|
+
taskId?: string | undefined;
|
|
52
60
|
notes?: string | undefined;
|
|
53
61
|
streamIds?: string[] | undefined;
|
|
54
62
|
timeEstimate?: number | undefined;
|
|
55
63
|
dueDate?: string | undefined;
|
|
56
64
|
snoozeUntil?: string | undefined;
|
|
57
65
|
private?: boolean | undefined;
|
|
58
|
-
taskId?: string | undefined;
|
|
59
66
|
}, {
|
|
60
67
|
text: string;
|
|
68
|
+
taskId?: string | undefined;
|
|
61
69
|
notes?: string | undefined;
|
|
62
70
|
streamIds?: string[] | undefined;
|
|
63
71
|
timeEstimate?: number | undefined;
|
|
64
72
|
dueDate?: string | undefined;
|
|
65
73
|
snoozeUntil?: string | undefined;
|
|
66
74
|
private?: boolean | undefined;
|
|
67
|
-
taskId?: string | undefined;
|
|
68
75
|
}>;
|
|
69
76
|
export declare const updateTaskCompleteSchema: z.ZodObject<{
|
|
70
77
|
taskId: z.ZodString;
|
|
@@ -547,6 +554,7 @@ export type CompletionFilter = z.infer<typeof completionFilterSchema>;
|
|
|
547
554
|
export type GetTasksByDayInput = z.infer<typeof getTasksByDaySchema>;
|
|
548
555
|
export type GetTasksBacklogInput = z.infer<typeof getTasksBacklogSchema>;
|
|
549
556
|
export type GetArchivedTasksInput = z.infer<typeof getArchivedTasksSchema>;
|
|
557
|
+
export type GetTaskByIdInput = z.infer<typeof getTaskByIdSchema>;
|
|
550
558
|
export type GetUserInput = z.infer<typeof getUserSchema>;
|
|
551
559
|
export type GetStreamsInput = z.infer<typeof getStreamsSchema>;
|
|
552
560
|
export type CreateTaskInput = z.infer<typeof createTaskSchema>;
|
package/dist/schemas.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AAGH,eAAO,MAAM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AAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AACzD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE/D,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC/D,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC/E,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC/D,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAEnF,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAC9C,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAC9C,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAClD,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACpE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
package/dist/schemas.js
CHANGED
|
@@ -17,6 +17,10 @@ export const getArchivedTasksSchema = z.object({
|
|
|
17
17
|
offset: z.number().int().min(0).optional().describe("Pagination offset (defaults to 0)"),
|
|
18
18
|
limit: z.number().int().min(1).max(1000).optional().describe("Maximum number of tasks to return (defaults to 100)"),
|
|
19
19
|
});
|
|
20
|
+
// Get task by ID parameters
|
|
21
|
+
export const getTaskByIdSchema = z.object({
|
|
22
|
+
taskId: z.string().min(1, "Task ID is required").describe("The ID of the task to retrieve"),
|
|
23
|
+
});
|
|
20
24
|
/**
|
|
21
25
|
* User Operation Schemas
|
|
22
26
|
*/
|
package/package.json
CHANGED
package/src/main.ts
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
deleteTaskSchema,
|
|
11
11
|
getArchivedTasksSchema,
|
|
12
12
|
getStreamsSchema,
|
|
13
|
+
getTaskByIdSchema,
|
|
13
14
|
getTasksBacklogSchema,
|
|
14
15
|
getTasksByDaySchema,
|
|
15
16
|
getUserSchema,
|
|
@@ -32,14 +33,14 @@ if (transportConfig.transportType === "stdio") {
|
|
|
32
33
|
|
|
33
34
|
const server = new FastMCP({
|
|
34
35
|
name: "Sunsama API Server",
|
|
35
|
-
version: "0.
|
|
36
|
+
version: "0.7.0",
|
|
36
37
|
instructions: `
|
|
37
38
|
This MCP server provides access to the Sunsama API for task and project management.
|
|
38
39
|
|
|
39
40
|
Available tools:
|
|
40
41
|
- Authentication: login, logout, check authentication status
|
|
41
42
|
- User operations: get current user information
|
|
42
|
-
- Task operations: get tasks by day, get backlog tasks, get archived tasks
|
|
43
|
+
- Task operations: get tasks by day, get backlog tasks, get archived tasks, get task by ID
|
|
43
44
|
- Stream operations: get streams/channels for the user's group
|
|
44
45
|
|
|
45
46
|
Authentication is required for all operations. You can either:
|
|
@@ -262,6 +263,64 @@ ${toTsv(trimmedTasks)}`;
|
|
|
262
263
|
}
|
|
263
264
|
});
|
|
264
265
|
|
|
266
|
+
server.addTool({
|
|
267
|
+
name: "get-task-by-id",
|
|
268
|
+
description: "Get a specific task by its ID",
|
|
269
|
+
parameters: getTaskByIdSchema,
|
|
270
|
+
execute: async (args, {session, log}) => {
|
|
271
|
+
try {
|
|
272
|
+
const {taskId} = args;
|
|
273
|
+
|
|
274
|
+
log.info("Getting task by ID", {
|
|
275
|
+
taskId: taskId
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
// Get the appropriate client based on transport type
|
|
279
|
+
const sunsamaClient = getSunsamaClient(session as SessionData | null);
|
|
280
|
+
|
|
281
|
+
// Get the specific task by ID
|
|
282
|
+
const task = await sunsamaClient.getTaskById(taskId);
|
|
283
|
+
|
|
284
|
+
if (task) {
|
|
285
|
+
log.info("Successfully retrieved task by ID", {
|
|
286
|
+
taskId: taskId,
|
|
287
|
+
taskText: task.text
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
return {
|
|
291
|
+
content: [
|
|
292
|
+
{
|
|
293
|
+
type: "text",
|
|
294
|
+
text: JSON.stringify(task, null, 2)
|
|
295
|
+
}
|
|
296
|
+
]
|
|
297
|
+
};
|
|
298
|
+
} else {
|
|
299
|
+
log.info("Task not found", {
|
|
300
|
+
taskId: taskId
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
return {
|
|
304
|
+
content: [
|
|
305
|
+
{
|
|
306
|
+
type: "text",
|
|
307
|
+
text: "null"
|
|
308
|
+
}
|
|
309
|
+
]
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
} catch (error) {
|
|
314
|
+
log.error("Failed to get task by ID", {
|
|
315
|
+
taskId: args.taskId,
|
|
316
|
+
error: error instanceof Error ? error.message : 'Unknown error'
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
throw new Error(`Failed to get task by ID: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
|
|
265
324
|
// Task Mutation Operations
|
|
266
325
|
server.addTool({
|
|
267
326
|
name: "create-task",
|
|
@@ -668,6 +727,11 @@ Uses HTTP Basic Auth headers (per-request authentication):
|
|
|
668
727
|
- Returns: TSV of trimmed archived Task objects with pagination metadata header
|
|
669
728
|
- Pagination: Uses limit+1 pattern to determine if more results are available
|
|
670
729
|
|
|
730
|
+
- **get-task-by-id**: Get a specific task by its ID
|
|
731
|
+
- Parameters:
|
|
732
|
+
- \`taskId\` (required): The ID of the task to retrieve
|
|
733
|
+
- Returns: JSON with complete Task object if found, or null if not found
|
|
734
|
+
|
|
671
735
|
- **create-task**: Create a new task with optional properties
|
|
672
736
|
- Parameters:
|
|
673
737
|
- \`text\` (required): Task title/description
|
package/src/schemas.ts
CHANGED
|
@@ -23,6 +23,11 @@ export const getArchivedTasksSchema = z.object({
|
|
|
23
23
|
limit: z.number().int().min(1).max(1000).optional().describe("Maximum number of tasks to return (defaults to 100)"),
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
+
// Get task by ID parameters
|
|
27
|
+
export const getTaskByIdSchema = z.object({
|
|
28
|
+
taskId: z.string().min(1, "Task ID is required").describe("The ID of the task to retrieve"),
|
|
29
|
+
});
|
|
30
|
+
|
|
26
31
|
/**
|
|
27
32
|
* User Operation Schemas
|
|
28
33
|
*/
|
|
@@ -175,6 +180,7 @@ export type CompletionFilter = z.infer<typeof completionFilterSchema>;
|
|
|
175
180
|
export type GetTasksByDayInput = z.infer<typeof getTasksByDaySchema>;
|
|
176
181
|
export type GetTasksBacklogInput = z.infer<typeof getTasksBacklogSchema>;
|
|
177
182
|
export type GetArchivedTasksInput = z.infer<typeof getArchivedTasksSchema>;
|
|
183
|
+
export type GetTaskByIdInput = z.infer<typeof getTaskByIdSchema>;
|
|
178
184
|
export type GetUserInput = z.infer<typeof getUserSchema>;
|
|
179
185
|
export type GetStreamsInput = z.infer<typeof getStreamsSchema>;
|
|
180
186
|
|