@krffl/tododdle-mcp 0.0.1 → 3.16.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 (52) hide show
  1. package/.claude-plugin/marketplace.json +28 -0
  2. package/.claude-plugin/plugin.json +20 -0
  3. package/.codex-plugin/plugin.json +38 -0
  4. package/LICENSE +21 -0
  5. package/README.md +544 -3
  6. package/config/external-api-parity.json +149 -0
  7. package/dist/api-client.d.ts +46 -0
  8. package/dist/api-client.d.ts.map +1 -0
  9. package/dist/api-client.js +166 -0
  10. package/dist/api-client.js.map +1 -0
  11. package/dist/compatibility.d.ts +10 -0
  12. package/dist/compatibility.d.ts.map +1 -0
  13. package/dist/compatibility.js +17 -0
  14. package/dist/compatibility.js.map +1 -0
  15. package/dist/config.d.ts +15 -0
  16. package/dist/config.d.ts.map +1 -0
  17. package/dist/config.js +66 -0
  18. package/dist/config.js.map +1 -0
  19. package/dist/index.d.ts +3 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +20 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/server.d.ts +28 -0
  24. package/dist/server.d.ts.map +1 -0
  25. package/dist/server.js +2732 -0
  26. package/dist/server.js.map +1 -0
  27. package/dist/upload-source.d.ts +37 -0
  28. package/dist/upload-source.d.ts.map +1 -0
  29. package/dist/upload-source.js +237 -0
  30. package/dist/upload-source.js.map +1 -0
  31. package/dist/workflow-guidance.d.ts +2 -0
  32. package/dist/workflow-guidance.d.ts.map +1 -0
  33. package/dist/workflow-guidance.js +20 -0
  34. package/dist/workflow-guidance.js.map +1 -0
  35. package/examples/AGENTS.tododdle.md +18 -0
  36. package/package.json +63 -4
  37. package/skills/tododdle-bootstrap/SKILL.md +61 -0
  38. package/skills/tododdle-bootstrap/agents/openai.yaml +14 -0
  39. package/skills/tododdle-bootstrap/scripts/update-agents.mjs +166 -0
  40. package/skills/tododdle-factory/SKILL.md +59 -0
  41. package/skills/tododdle-factory/agents/openai.yaml +14 -0
  42. package/skills/tododdle-factory/references/staging-dogfood.md +16 -0
  43. package/skills/tododdle-supervisor/SKILL.md +36 -0
  44. package/skills/tododdle-supervisor/agents/openai.yaml +14 -0
  45. package/skills/tododdle-workflow/SKILL.md +82 -0
  46. package/skills/tododdle-workflow/agents/openai.yaml +14 -0
  47. package/skills/tododdle-workflow/references/files.md +33 -0
  48. package/skills/tododdle-workflow/references/project-work.md +41 -0
  49. package/skills/tododdle-workflow/references/releases.md +35 -0
  50. package/skills/tododdle-workflow/references/scheduled-workflows.md +91 -0
  51. package/skills/tododdle-workflow/references/support-cases.md +16 -0
  52. package/skills/tododdle-workflow/references/time-tracking.md +10 -0
@@ -0,0 +1,149 @@
1
+ {
2
+ "source": "ToDoddle External API inventory, reviewed 2026-10-15",
3
+ "tools": {
4
+ "get_document_image": ["GET /api/external/projects/[projectId]/documents/[documentId]/image"],
5
+ "list_projects": ["GET /api/external/projects"],
6
+ "get_project": ["GET /api/external/projects/[projectId]"],
7
+ "create_project": ["POST /api/external/projects"],
8
+ "update_project": ["PUT /api/external/projects/[projectId]"],
9
+ "archive_project": ["PUT /api/external/projects/[projectId]"],
10
+ "restore_project": ["PUT /api/external/projects/[projectId]"],
11
+ "set_project_status_line": ["PUT /api/external/projects/[projectId]/status-line", "DELETE /api/external/projects/[projectId]/status-line"],
12
+ "list_boards": ["GET /api/external/projects/[projectId]/plans"],
13
+ "get_board": ["GET /api/external/projects/[projectId]/plans/[planId]"],
14
+ "create_board": ["POST /api/external/projects/[projectId]/plans"],
15
+ "update_board": ["PUT /api/external/projects/[projectId]/plans/[planId]"],
16
+ "move_board": ["PUT /api/external/projects/[projectId]/plans/[planId]"],
17
+ "archive_board": ["PUT /api/external/projects/[projectId]/plans/[planId]"],
18
+ "restore_board": ["PUT /api/external/projects/[projectId]/plans/[planId]"],
19
+ "list_lanes": ["GET /api/external/projects/[projectId]/plans/[planId]/sections"],
20
+ "get_lane": ["GET /api/external/projects/[projectId]/plans/[planId]/sections/[sectionId]"],
21
+ "create_lane": ["POST /api/external/projects/[projectId]/plans/[planId]/sections"],
22
+ "update_lane": ["PUT /api/external/projects/[projectId]/plans/[planId]/sections/[sectionId]"],
23
+ "move_lane": ["PUT /api/external/projects/[projectId]/plans/[planId]/sections/[sectionId]"],
24
+ "archive_lane": ["PUT /api/external/projects/[projectId]/plans/[planId]/sections/[sectionId]"],
25
+ "restore_lane": ["PUT /api/external/projects/[projectId]/plans/[planId]/sections/[sectionId]"],
26
+ "list_releases": ["GET /api/external/projects/[projectId]/releases"],
27
+ "get_release": ["GET /api/external/projects/[projectId]/releases/[releaseId]"],
28
+ "get_release_metadata_templates": ["GET /api/external/release-metadata-templates"],
29
+ "create_release": ["POST /api/external/projects/[projectId]/releases"],
30
+ "update_release": ["PATCH /api/external/projects/[projectId]/releases/[releaseId]"],
31
+ "request_release_status_change": ["POST /api/external/projects/[projectId]/releases/[releaseId]/status-requests"],
32
+ "list_testbench_rounds": ["GET /api/external/projects/[projectId]/testbench/rounds"],
33
+ "set_round_release": ["PATCH /api/external/projects/[projectId]/testbench/rounds/[roundId]/release"],
34
+ "list_project_members": ["GET /api/external/projects/[projectId]/members"],
35
+ "list_security_events": ["GET /api/external/security-events"],
36
+ "list_review_requests": ["GET /api/external/projects/[projectId]/review-requests"],
37
+ "get_review_request": ["GET /api/external/projects/[projectId]/review-requests/[reviewRequestId]"],
38
+ "create_review_request": ["POST /api/external/projects/[projectId]/review-requests"],
39
+ "update_review_request": ["PATCH /api/external/projects/[projectId]/review-requests/[reviewRequestId]"],
40
+ "respond_to_review_request": ["POST /api/external/projects/[projectId]/review-requests/[reviewRequestId]/responses"],
41
+ "list_review_comments": ["GET /api/external/projects/[projectId]/review-requests/[reviewRequestId]/comments"],
42
+ "add_review_comment": ["POST /api/external/projects/[projectId]/review-requests/[reviewRequestId]/comments"],
43
+ "add_review_checklist_item": ["POST /api/external/projects/[projectId]/review-requests/[reviewRequestId]/checklist"],
44
+ "update_review_checklist_item": ["PATCH /api/external/projects/[projectId]/review-requests/[reviewRequestId]/checklist/[itemId]"],
45
+ "complete_review_request": ["PATCH /api/external/projects/[projectId]/review-requests/[reviewRequestId]"],
46
+ "cancel_review_request": ["PATCH /api/external/projects/[projectId]/review-requests/[reviewRequestId]"],
47
+ "list_project_documents": ["GET /api/external/projects/[projectId]/documents"],
48
+ "get_document_download_url": ["POST /api/external/projects/[projectId]/documents/[documentId]/download-url"],
49
+ "begin_upload": ["POST /api/external/projects/[projectId]/documents/upload-sessions"],
50
+ "complete_upload": ["POST /api/external/projects/[projectId]/documents/[documentId]/finalize"],
51
+ "upload_project_document": [
52
+ "POST /api/external/projects/[projectId]/documents/upload-sessions",
53
+ "POST /api/external/projects/[projectId]/documents/[documentId]/finalize"
54
+ ],
55
+ "attach_file_to_ticket": [
56
+ "POST /api/external/projects/[projectId]/documents/upload-sessions",
57
+ "POST /api/external/projects/[projectId]/documents/[documentId]/finalize"
58
+ ],
59
+ "list_notes": ["GET /api/external/notes"],
60
+ "get_note": ["GET /api/external/notes/[noteId]"],
61
+ "create_note": ["POST /api/external/notes"],
62
+ "update_note": ["PUT /api/external/notes/[noteId]"],
63
+ "archive_note": ["DELETE /api/external/notes/[noteId]"],
64
+ "get_project_context": ["GET /api/external/projects/[projectId]/context"],
65
+ "get_work_queue": ["GET /api/external/work-queue"],
66
+ "list_available_work": ["GET /api/external/work-queue/available"],
67
+ "claim_next_ticket": ["POST /api/external/work-queue/available"],
68
+ "get_focus_list": ["GET /api/external/focus"],
69
+ "add_ticket_to_focus": ["POST /api/external/focus"],
70
+ "move_focus_ticket": ["PATCH /api/external/focus/[taskId]"],
71
+ "remove_ticket_from_focus": ["DELETE /api/external/focus/[taskId]"],
72
+ "search_project": ["GET /api/external/projects/[projectId]/search"],
73
+ "list_tickets": ["GET /api/external/tasks"],
74
+ "get_ticket": ["GET /api/external/tasks/[taskId]"],
75
+ "get_support_case": ["GET /api/external/projects/[projectId]/tasks/[taskId]/support-case"],
76
+ "list_support_cases": ["GET /api/external/projects/[projectId]/support/cases"],
77
+ "list_support_case_messages": ["GET /api/external/projects/[projectId]/tasks/[taskId]/support-case/messages"],
78
+ "get_support_module": ["GET /api/external/projects/[projectId]/support/status"],
79
+ "get_support_attachment_url": ["GET /api/external/projects/[projectId]/tasks/[taskId]/support-case/attachments/[attachmentId]/access-url"],
80
+ "update_support_case": ["PATCH /api/external/projects/[projectId]/tasks/[taskId]/support-case"],
81
+ "preview_support_reply": ["POST /api/external/projects/[projectId]/tasks/[taskId]/support-case/reply-preview"],
82
+ "reply_to_support_case": ["POST /api/external/projects/[projectId]/tasks/[taskId]/support-case/messages"],
83
+ "get_tickets": ["POST /api/external/tasks/batch"],
84
+ "list_ticket_attributes": ["GET /api/external/tasks/[taskId]/attributes"],
85
+ "set_ticket_attribute": ["PUT /api/external/tasks/[taskId]/attributes"],
86
+ "delete_ticket_attribute": ["DELETE /api/external/tasks/[taskId]/attributes"],
87
+ "list_ticket_checklist": ["GET /api/external/tasks/[taskId]/checklist"],
88
+ "add_ticket_checklist_items": ["POST /api/external/tasks/[taskId]/checklist"],
89
+ "update_ticket_checklist_item": ["PATCH /api/external/tasks/[taskId]/checklist"],
90
+ "delete_ticket_checklist_item": ["DELETE /api/external/tasks/[taskId]/checklist"],
91
+ "claim_ticket": ["PUT /api/external/tasks/[taskId]/claim"],
92
+ "renew_ticket_claim": ["PUT /api/external/tasks/[taskId]/claim"],
93
+ "release_ticket": ["DELETE /api/external/tasks/[taskId]/claim"],
94
+ "list_agent_runs": ["GET /api/external/tasks/[taskId]/agent-runs"],
95
+ "get_agent_run": ["GET /api/external/tasks/[taskId]/agent-runs/[runId]"],
96
+ "finish_agent_run": ["POST /api/external/tasks/[taskId]/agent-runs/[runId]"],
97
+ "log_completed_work": ["POST /api/external/projects/[projectId]/completed-work"],
98
+ "get_supervisor_state": ["GET /api/external/tasks/[taskId]/supervisor-state"],
99
+ "record_work_event": ["POST /api/external/tasks/[taskId]/work-events"],
100
+ "record_assessment": ["POST /api/external/tasks/[taskId]/assessments"],
101
+ "record_verification": ["POST /api/external/tasks/[taskId]/work-events"],
102
+ "create_ticket": ["POST /api/external/tasks"],
103
+ "update_ticket": ["PUT /api/external/tasks/[taskId]"],
104
+ "transition_ticket": ["PUT /api/external/tasks/[taskId]"],
105
+ "set_ticket_blocker": ["PUT /api/external/tasks/[taskId]"],
106
+ "move_ticket": ["PUT /api/external/tasks/[taskId]/move"],
107
+ "preview_ticket_move": ["POST /api/external/tasks/[taskId]/move/preview"],
108
+ "add_ticket_comment": ["POST /api/external/tasks/[taskId]/comments"],
109
+ "get_agent_inbox": ["GET /api/external/agent-inbox"],
110
+ "get_workspace_setup": ["GET /api/external/workspace-setup"],
111
+ "send_feedback": ["POST /api/external/feedback"],
112
+ "acknowledge_agent_reply": ["POST /api/external/agent-inbox/[commentId]/acknowledge"],
113
+ "archive_ticket": ["PATCH /api/external/tasks/[taskId]/archive"],
114
+ "get_active_time_entries": ["GET /api/external/time-entries/active"],
115
+ "list_project_time": ["GET /api/external/projects/[projectId]/time-entries"],
116
+ "list_ticket_time": ["GET /api/external/projects/[projectId]/tasks/[taskId]/time-entries"],
117
+ "start_ticket_timer": ["POST /api/external/projects/[projectId]/tasks/[taskId]/time-entries"],
118
+ "log_ticket_time": ["POST /api/external/projects/[projectId]/tasks/[taskId]/time-entries"],
119
+ "stop_ticket_timer": ["POST /api/external/projects/[projectId]/tasks/[taskId]/time-entries/[timeEntryId]/stop"],
120
+ "update_time_entry": ["PATCH /api/external/projects/[projectId]/tasks/[taskId]/time-entries/[timeEntryId]"],
121
+ "archive_time_entry": ["DELETE /api/external/projects/[projectId]/tasks/[taskId]/time-entries/[timeEntryId]"],
122
+ "get_project_brief": ["GET /api/external/projects/[projectId]/brief"],
123
+ "list_project_artifacts": ["GET /api/external/projects/[projectId]/artifacts"],
124
+ "get_project_artifact": ["GET /api/external/projects/[projectId]/artifacts/[artifactId]"],
125
+ "create_project_artifact": ["POST /api/external/projects/[projectId]/artifacts"],
126
+ "list_artifact_revisions": ["GET /api/external/projects/[projectId]/artifacts/[artifactId]/revisions"],
127
+ "link_project_artifacts": ["POST /api/external/projects/[projectId]/artifacts/[artifactId]/relations"],
128
+ "update_project_artifact": ["PATCH /api/external/projects/[projectId]/artifacts/[artifactId]"],
129
+ "transition_project_artifact": ["POST /api/external/projects/[projectId]/artifacts/[artifactId]/transition"],
130
+ "link_artifact_ticket": ["POST /api/external/projects/[projectId]/artifacts/[artifactId]/task-links"],
131
+ "add_artifact_comment": ["POST /api/external/projects/[projectId]/artifacts/[artifactId]/comments"]
132
+ },
133
+ "exceptions": {
134
+ "POST /api/external/oauth/token": "Transport-level OAuth token acquisition is exercised by the API client, not exposed as a model-callable tool.",
135
+ "GET /api/external/action-approvals": "Consequential-action review is a human control surface and is not exposed as a model-callable read.",
136
+ "GET /api/external/action-approvals/[approvalId]": "Consequential-action detail is a human control surface and is not exposed as a model-callable read.",
137
+ "DELETE /api/external/projects/[projectId]": "Compatibility hard-delete endpoint is intentionally omitted; MCP exposes reversible archive and restore tools.",
138
+ "DELETE /api/external/projects/[projectId]/plans/[planId]": "Compatibility hard-delete endpoint is intentionally omitted; MCP exposes reversible archive and restore tools.",
139
+ "DELETE /api/external/projects/[projectId]/plans/[planId]/sections/[sectionId]": "Compatibility endpoint is intentionally omitted; MCP exposes explicit optimistic archive and restore tools.",
140
+ "POST /api/external/projects/[projectId]/tasks/[taskId]/attachments": "Attachment creation is completed by the direct-upload finalize operation used by attach_file_to_ticket.",
141
+ "GET /api/external/tasks/[taskId]/comments": "get_ticket returns bounded comments with the complete ticket context, avoiding a redundant model-callable read.",
142
+ "GET /api/external/tasks/[taskId]/assessments": "get_supervisor_state returns bounded current and optional previous assessments for decision guidance, avoiding a redundant model-callable history read.",
143
+ "GET /api/external/tasks/[taskId]/work-events": "get_supervisor_state returns bounded meaningful work events with the compact Ticket state, avoiding a redundant model-callable history read.",
144
+ "DELETE /api/external/tasks/[taskId]": "Compatibility hard-delete endpoint is intentionally omitted; MCP exposes archive_ticket.",
145
+ "GET /api/external/todos": "Superseded personal-list contract; MCP uses the bounded Focus API.",
146
+ "POST /api/external/todos": "Superseded personal-list contract; MCP uses add_ticket_to_focus.",
147
+ "DELETE /api/external/todos/[taskId]": "Superseded personal-list contract; MCP uses remove_ticket_from_focus."
148
+ }
149
+ }
@@ -0,0 +1,46 @@
1
+ import type { McpConfig } from './config.js';
2
+ export interface AgentRunRequestContext {
3
+ runId: string;
4
+ projectId: string;
5
+ taskId: string;
6
+ action: 'READ_PROJECT_DATA' | 'UPDATE_TICKET' | 'ADD_INTERNAL_COMMENT' | 'UPDATE_INTERNAL_WORKFLOW' | 'RECORD_EVIDENCE' | 'UPLOAD_INTERNAL_ATTACHMENT' | 'TRACK_INTERNAL_TIME';
7
+ }
8
+ /** Scope names a denied request needed, when the API reports them. */
9
+ export interface ToDoddleScopeDenial {
10
+ requiredScopes?: string[];
11
+ missingScopes?: string[];
12
+ grantedScopes?: string[];
13
+ }
14
+ export declare class ToDoddleApiError extends Error {
15
+ readonly status: number;
16
+ readonly code: string;
17
+ readonly details?: unknown;
18
+ readonly scopes?: ToDoddleScopeDenial | undefined;
19
+ constructor(status: number, code: string, message: string, details?: unknown, scopes?: ToDoddleScopeDenial | undefined);
20
+ }
21
+ export interface ToDoddleApi {
22
+ get(path: string, query?: Record<string, string | number | boolean | undefined>, runContext?: AgentRunRequestContext): Promise<Record<string, unknown>>;
23
+ post(path: string, body: unknown, idempotencyKey?: string, runContext?: AgentRunRequestContext): Promise<Record<string, unknown>>;
24
+ put(path: string, body: unknown, runContext?: AgentRunRequestContext): Promise<Record<string, unknown>>;
25
+ patch(path: string, body: unknown, runContext?: AgentRunRequestContext): Promise<Record<string, unknown>>;
26
+ delete(path: string, body: unknown, runContext?: AgentRunRequestContext): Promise<Record<string, unknown>>;
27
+ uploadFile(url: string, headers: Record<string, string>, filePath: string, fileSize: number): Promise<void>;
28
+ }
29
+ export declare class ToDoddleApiClient implements ToDoddleApi {
30
+ private readonly config;
31
+ private accessToken;
32
+ private tokenExpiresAt;
33
+ constructor(config: McpConfig);
34
+ private getAccessToken;
35
+ private request;
36
+ private readPayload;
37
+ private assertNoRedirect;
38
+ private toError;
39
+ get(path: string, query?: Record<string, string | number | boolean | undefined>, runContext?: AgentRunRequestContext): Promise<Record<string, unknown>>;
40
+ post(path: string, body: unknown, idempotencyKey?: string, runContext?: AgentRunRequestContext): Promise<Record<string, unknown>>;
41
+ put(path: string, body: unknown, runContext?: AgentRunRequestContext): Promise<Record<string, unknown>>;
42
+ patch(path: string, body: unknown, runContext?: AgentRunRequestContext): Promise<Record<string, unknown>>;
43
+ delete(path: string, body: unknown, runContext?: AgentRunRequestContext): Promise<Record<string, unknown>>;
44
+ uploadFile(url: string, headers: Record<string, string>, filePath: string, fileSize: number): Promise<void>;
45
+ }
46
+ //# sourceMappingURL=api-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-client.d.ts","sourceRoot":"","sources":["../src/api-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAS7C,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EACF,mBAAmB,GACnB,eAAe,GACf,sBAAsB,GACtB,0BAA0B,GAC1B,iBAAiB,GACjB,4BAA4B,GAC5B,qBAAqB,CAAC;CAC3B;AAED,sEAAsE;AACtE,MAAM,WAAW,mBAAmB;IAClC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED,qBAAa,gBAAiB,SAAQ,KAAK;IAEvC,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM;IAErB,QAAQ,CAAC,OAAO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.js';
3
+ export class ToDoddleApiError extends Error {
4
+ status;
5
+ code;
6
+ details;
7
+ scopes;
8
+ constructor(status, code, message, details, scopes) {
9
+ super(message);
10
+ this.status = status;
11
+ this.code = code;
12
+ this.details = details;
13
+ this.scopes = scopes;
14
+ this.name = 'ToDoddleApiError';
15
+ }
16
+ }
17
+ function stringList(value) {
18
+ return Array.isArray(value) && value.every((item) => typeof item === 'string')
19
+ ? value
20
+ : undefined;
21
+ }
22
+ function scopeDenial(payload) {
23
+ // Some routes report the scopes inside `details` instead of at the top level.
24
+ const details = payload.details && typeof payload.details === 'object'
25
+ ? payload.details
26
+ : {};
27
+ const requiredScopes = stringList(payload.required_scopes) ?? stringList(details.required_scopes);
28
+ const grantedScopes = stringList(payload.granted_scopes);
29
+ const missingScopes = stringList(payload.missing_scopes) ??
30
+ (requiredScopes && grantedScopes
31
+ ? requiredScopes.filter((scope) => !grantedScopes.includes(scope))
32
+ : undefined);
33
+ if (!requiredScopes && !missingScopes)
34
+ return undefined;
35
+ return { requiredScopes, missingScopes, grantedScopes };
36
+ }
37
+ export class ToDoddleApiClient {
38
+ config;
39
+ accessToken = null;
40
+ tokenExpiresAt = 0;
41
+ constructor(config) {
42
+ this.config = config;
43
+ }
44
+ async getAccessToken() {
45
+ if (this.accessToken && Date.now() < this.tokenExpiresAt - 30_000)
46
+ return this.accessToken;
47
+ const form = new URLSearchParams({
48
+ grant_type: 'client_credentials',
49
+ client_id: this.config.clientId,
50
+ client_secret: this.config.clientSecret,
51
+ });
52
+ const response = await fetch(`${this.config.baseUrl}/api/external/oauth/token`, {
53
+ method: 'POST',
54
+ headers: {
55
+ 'content-type': 'application/x-www-form-urlencoded',
56
+ ...MCP_REQUEST_HEADERS,
57
+ },
58
+ body: form,
59
+ redirect: 'manual',
60
+ });
61
+ this.assertNoRedirect(response);
62
+ const payload = await this.readPayload(response);
63
+ if (!response.ok)
64
+ throw this.toError(response.status, payload);
65
+ const token = payload;
66
+ if (!token.access_token || !token.expires_in)
67
+ throw new Error('Token endpoint returned an invalid response');
68
+ this.accessToken = token.access_token;
69
+ this.tokenExpiresAt = Date.now() + token.expires_in * 1000;
70
+ return token.access_token;
71
+ }
72
+ async request(method, path, body, query, idempotencyKey, retry = true, runContext) {
73
+ const url = new URL(path, this.config.baseUrl);
74
+ Object.entries(query || {}).forEach(([key, value]) => {
75
+ if (value !== undefined)
76
+ url.searchParams.set(key, String(value));
77
+ });
78
+ const token = await this.getAccessToken();
79
+ const response = await fetch(url, {
80
+ method,
81
+ headers: {
82
+ authorization: `Bearer ${token}`,
83
+ ...MCP_REQUEST_HEADERS,
84
+ ...(body !== undefined ? { 'content-type': 'application/json' } : {}),
85
+ ...(idempotencyKey ? { 'idempotency-key': idempotencyKey } : {}),
86
+ ...(runContext
87
+ ? {
88
+ 'x-tododdle-run-id': runContext.runId,
89
+ 'x-tododdle-run-project-id': runContext.projectId,
90
+ 'x-tododdle-run-ticket-id': runContext.taskId,
91
+ 'x-tododdle-run-action': runContext.action,
92
+ }
93
+ : {}),
94
+ },
95
+ body: body === undefined ? undefined : JSON.stringify(body),
96
+ redirect: 'manual',
97
+ });
98
+ this.assertNoRedirect(response);
99
+ if (response.status === 401 && retry) {
100
+ this.accessToken = null;
101
+ this.tokenExpiresAt = 0;
102
+ return this.request(method, path, body, query, idempotencyKey, false, runContext);
103
+ }
104
+ const payload = await this.readPayload(response);
105
+ if (!response.ok)
106
+ throw this.toError(response.status, payload);
107
+ return payload;
108
+ }
109
+ async readPayload(response) {
110
+ const text = await response.text();
111
+ let payload;
112
+ try {
113
+ payload = JSON.parse(text);
114
+ }
115
+ catch {
116
+ payload = text;
117
+ }
118
+ return payload && typeof payload === 'object'
119
+ ? payload
120
+ : { value: payload };
121
+ }
122
+ assertNoRedirect(response) {
123
+ if (response.status < 300 || response.status >= 400)
124
+ return;
125
+ const destination = response.headers.get('location');
126
+ throw new ToDoddleApiError(response.status, 'configuration_error', `TODODDLE_BASE_URL redirected${destination ? ` to ${destination}` : ''}; configure the final API origin instead`);
127
+ }
128
+ toError(status, payload) {
129
+ const code = typeof payload.error === 'string' ? payload.error : 'server_error';
130
+ const message = typeof payload.message === 'string'
131
+ ? payload.message
132
+ : typeof payload.error_description === 'string'
133
+ ? payload.error_description
134
+ : `ToDoddle request failed (${status})`;
135
+ return new ToDoddleApiError(status, code, code === 'MCP_UPDATE_REQUIRED'
136
+ ? formatMcpUpdateRequiredMessage(message, payload.details)
137
+ : message, payload.details, scopeDenial(payload));
138
+ }
139
+ get(path, query, runContext) {
140
+ return this.request('GET', path, undefined, query, undefined, true, runContext);
141
+ }
142
+ post(path, body, idempotencyKey, runContext) {
143
+ return this.request('POST', path, body, undefined, idempotencyKey, true, runContext);
144
+ }
145
+ put(path, body, runContext) {
146
+ return this.request('PUT', path, body, undefined, undefined, true, runContext);
147
+ }
148
+ patch(path, body, runContext) {
149
+ return this.request('PATCH', path, body, undefined, undefined, true, runContext);
150
+ }
151
+ delete(path, body, runContext) {
152
+ return this.request('DELETE', path, body, undefined, undefined, true, runContext);
153
+ }
154
+ async uploadFile(url, headers, filePath, fileSize) {
155
+ const response = await fetch(url, {
156
+ method: 'PUT',
157
+ headers: { ...headers, 'content-length': String(fileSize) },
158
+ body: createReadStream(filePath),
159
+ duplex: 'half',
160
+ });
161
+ if (!response.ok) {
162
+ throw new Error(`Direct upload failed (${response.status})`);
163
+ }
164
+ }
165
+ }
166
+ //# sourceMappingURL=api-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-client.js","sourceRoot":"","sources":["../src/api-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AA4BzF,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAE9B,MAAM;IACN,IAAI;IAEJ,OAAO;IACP,MAAM;IALjB,YACW,MAAc,EACd,IAAY,EACrB,OAAe,EACN,OAAiB,EACj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_HEADER = "x-tododdle-mcp-version";
4
+ export declare const MCP_COMPATIBILITY_HEADER = "x-tododdle-mcp-compatibility";
5
+ export declare const MCP_REQUEST_HEADERS: {
6
+ readonly "x-tododdle-mcp-version": "3.16.0";
7
+ readonly "x-tododdle-mcp-compatibility": string;
8
+ };
9
+ export declare function formatMcpUpdateRequiredMessage(message: string, details: unknown): string;
10
+ //# sourceMappingURL=compatibility.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compatibility.d.ts","sourceRoot":"","sources":["../src/compatibility.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,WAAW,CAAC;AAC5C,eAAO,MAAM,uBAAuB,IAAI,CAAC;AACzC,eAAO,MAAM,kBAAkB,2BAA2B,CAAC;AAC3D,eAAO,MAAM,wBAAwB,iCAAiC,CAAC;AAEvE,eAAO,MAAM,mBAAmB;;;CAGtB,CAAC;AAUX,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAUxF"}
@@ -0,0 +1,17 @@
1
+ export const MCP_PACKAGE_VERSION = '3.16.0';
2
+ export const MCP_COMPATIBILITY_LEVEL = 3;
3
+ export const MCP_VERSION_HEADER = 'x-tododdle-mcp-version';
4
+ export const MCP_COMPATIBILITY_HEADER = 'x-tododdle-mcp-compatibility';
5
+ export const MCP_REQUEST_HEADERS = {
6
+ [MCP_VERSION_HEADER]: MCP_PACKAGE_VERSION,
7
+ [MCP_COMPATIBILITY_HEADER]: String(MCP_COMPATIBILITY_LEVEL),
8
+ };
9
+ export function formatMcpUpdateRequiredMessage(message, details) {
10
+ const value = details && typeof details === 'object' ? details : {};
11
+ const updateCommand = typeof value.updateCommand === 'string'
12
+ ? value.updateCommand
13
+ : 'npx --yes --prefer-online @krffl/tododdle-mcp@latest';
14
+ const documentation = typeof value.documentationUrl === 'string' ? ` See ${value.documentationUrl}.` : '';
15
+ return `${message} Ask the user to run \`${updateCommand}\`, then restart Codex.${documentation}`;
16
+ }
17
+ //# sourceMappingURL=compatibility.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compatibility.js","sourceRoot":"","sources":["../src/compatibility.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,mBAAmB,GAAG,QAAQ,CAAC;AAC5C,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC;AACzC,MAAM,CAAC,MAAM,kBAAkB,GAAG,wBAAwB,CAAC;AAC3D,MAAM,CAAC,MAAM,wBAAwB,GAAG,8BAA8B,CAAC;AAEvE,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,CAAC,kBAAkB,CAAC,EAAE,mBAAmB;IACzC,CAAC,wBAAwB,CAAC,EAAE,MAAM,CAAC,uBAAuB,CAAC;CACnD,CAAC;AAUX,MAAM,UAAU,8BAA8B,CAAC,OAAe,EAAE,OAAgB;IAC9E,MAAM,KAAK,GAAG,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAE,OAAoC,CAAC,CAAC,CAAC,EAAE,CAAC;IAClG,MAAM,aAAa,GACjB,OAAO,KAAK,CAAC,aAAa,KAAK,QAAQ;QACrC,CAAC,CAAC,KAAK,CAAC,aAAa;QACrB,CAAC,CAAC,sDAAsD,CAAC;IAC7D,MAAM,aAAa,GACjB,OAAO,KAAK,CAAC,gBAAgB,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,KAAK,CAAC,gBAAgB,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAEtF,OAAO,GAAG,OAAO,0BAA0B,aAAa,0BAA0B,aAAa,EAAE,CAAC;AACpG,CAAC"}
@@ -0,0 +1,15 @@
1
+ export interface McpConfig {
2
+ baseUrl: string;
3
+ clientId: string;
4
+ clientSecret: string;
5
+ managedUploadRoot: string;
6
+ maxUploadBytes: number;
7
+ }
8
+ /**
9
+ * The managed upload root is the system temporary directory itself, resolved through symlinks
10
+ * (for example macOS /var/folders/.../T becomes /private/var/folders/.../T). No subfolder is
11
+ * created. Safety comes from the per-file checks in prepareUploadSource.
12
+ */
13
+ export declare function getDefaultManagedUploadRoot(temporaryDirectory?: string): string;
14
+ export declare function loadMcpConfig(environment?: NodeJS.ProcessEnv): McpConfig;
15
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;CACxB;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,kBAAkB,SAAW,GAAG,MAAM,CAMjF;AAsCD,wBAAgB,aAAa,CAAC,WAAW,GAAE,MAAM,CAAC,UAAwB,GAAG,SAAS,CA6BrF"}
package/dist/config.js ADDED
@@ -0,0 +1,66 @@
1
+ import { realpathSync } from 'node:fs';
2
+ import { tmpdir } from 'node:os';
3
+ import { resolve } from 'node:path';
4
+ /**
5
+ * The managed upload root is the system temporary directory itself, resolved through symlinks
6
+ * (for example macOS /var/folders/.../T becomes /private/var/folders/.../T). No subfolder is
7
+ * created. Safety comes from the per-file checks in prepareUploadSource.
8
+ */
9
+ export function getDefaultManagedUploadRoot(temporaryDirectory = tmpdir()) {
10
+ try {
11
+ return realpathSync.native(temporaryDirectory);
12
+ }
13
+ catch {
14
+ return resolve(temporaryDirectory);
15
+ }
16
+ }
17
+ function normalizeBaseUrl(value) {
18
+ const rawValue = value || 'https://app.tododdle.com';
19
+ let url;
20
+ try {
21
+ url = new URL(rawValue);
22
+ }
23
+ catch {
24
+ throw new Error('TODODDLE_BASE_URL must be a valid absolute URL');
25
+ }
26
+ const isLoopback = ['localhost', '127.0.0.1', '::1'].includes(url.hostname);
27
+ if (['trackingti.me', 'www.trackingti.me', 'tododdle.com', 'www.tododdle.com'].includes(url.hostname)) {
28
+ throw new Error('TODODDLE_BASE_URL must use the application origin https://app.tododdle.com');
29
+ }
30
+ if (url.protocol !== 'https:' && !(isLoopback && url.protocol === 'http:')) {
31
+ throw new Error('TODODDLE_BASE_URL must use HTTPS except for loopback development');
32
+ }
33
+ if (url.username ||
34
+ url.password ||
35
+ url.search ||
36
+ url.hash ||
37
+ (url.pathname && url.pathname !== '/')) {
38
+ throw new Error('TODODDLE_BASE_URL must be an origin without credentials, path, query, or fragment');
39
+ }
40
+ return url.origin;
41
+ }
42
+ export function loadMcpConfig(environment = process.env) {
43
+ const baseUrl = normalizeBaseUrl(environment.TODODDLE_BASE_URL);
44
+ const clientId = environment.TODODDLE_CLIENT_ID;
45
+ const clientSecret = environment.TODODDLE_CLIENT_SECRET;
46
+ const managedUploadRoot = getDefaultManagedUploadRoot();
47
+ const configuredMax = Number(environment.TODODDLE_MAX_UPLOAD_BYTES || 1024 * 1024 * 1024);
48
+ if (!clientId || !clientSecret) {
49
+ throw new Error('TODODDLE_CLIENT_ID and TODODDLE_CLIENT_SECRET are required');
50
+ }
51
+ if (!Number.isSafeInteger(configuredMax) || configuredMax <= 0) {
52
+ throw new Error('TODODDLE_MAX_UPLOAD_BYTES must be a positive integer');
53
+ }
54
+ if (environment.TODODDLE_UPLOAD_ROOTS) {
55
+ // stderr is safe for a stdio MCP server; stdout carries the protocol.
56
+ console.error('TODODDLE_UPLOAD_ROOTS is no longer used and can be removed. Local uploads come from the system temporary directory.');
57
+ }
58
+ return {
59
+ baseUrl,
60
+ clientId,
61
+ clientSecret,
62
+ managedUploadRoot,
63
+ maxUploadBytes: configuredMax,
64
+ };
65
+ }
66
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,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AG,CAAC,EACtC,CAAC;QACD,MAAM,IAAI,KAAK,CACb,mFAAmF,CACpF,CAAC;IACJ,CAAC;IAED,OAAO,GAAG,CAAC,MAAM,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,WAAW,GAAsB,OAAO,CAAC,GAAG;IACxE,MAAM,OAAO,GAAG,gBAAgB,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;IAChE,MAAM,QAAQ,GAAG,WAAW,CAAC,kBAAkB,CAAC;IAChD,MAAM,YAAY,GAAG,WAAW,CAAC,sBAAsB,CAAC;IACxD,MAAM,iBAAiB,GAAG,2BAA2B,EAAE,CAAC;IACxD,MAAM,aAAa,GAAG,MAAM,CAAC,WAAW,CAAC,yBAAyB,IAAI,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;IAE1F,IAAI,CAAC,QAAQ,IAAI,CAAC,YAAY,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;IAChF,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,aAAa,CAAC,IAAI,aAAa,IAAI,CAAC,EAAE,CAAC;QAC/D,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IAC1E,CAAC;IAED,IAAI,WAAW,CAAC,qBAAqB,EAAE,CAAC;QACtC,sEAAsE;QACtE,OAAO,CAAC,KAAK,CACX,qHAAqH,CACtH,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO;QACP,QAAQ;QACR,YAAY;QACZ,iBAAiB;QACjB,cAAc,EAAE,aAAa;KAC9B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env node
2
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
3
+ import { ToDoddleApiClient } from './api-client.js';
4
+ import { loadMcpConfig } from './config.js';
5
+ import { createToDoddleMcpServer } from './server.js';
6
+ async function main() {
7
+ const config = loadMcpConfig();
8
+ const server = createToDoddleMcpServer(new ToDoddleApiClient(config), {
9
+ managedUploadRoot: config.managedUploadRoot,
10
+ appOrigin: config.baseUrl,
11
+ maxUploadBytes: config.maxUploadBytes,
12
+ });
13
+ await server.connect(new StdioServerTransport());
14
+ console.error('ToDoddle MCP server connected over stdio');
15
+ }
16
+ main().catch((error) => {
17
+ console.error('ToDoddle MCP server failed:', error instanceof Error ? error.message : error);
18
+ process.exitCode = 1;
19
+ });
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD,KAAK,UAAU,IAAI;IACjB,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC;IAC/B,MAAM,MAAM,GAAG,uBAAuB,CAAC,IAAI,iBAAiB,CAAC,MAAM,CAAC,EAAE;QACpE,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;QAC3C,SAAS,EAAE,MAAM,CAAC,OAAO;QACzB,cAAc,EAAE,MAAM,CAAC,cAAc;KACtC,CAAC,CAAC;IACH,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,oBAAoB,EAAE,CAAC,CAAC;IACjD,OAAO,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;AAC5D,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAC7F,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import { ToDoddleApiError, type ToDoddleApi } from './api-client.js';
3
+ /**
4
+ * Turns a ToDoddle API failure into a tool error the agent can act on. The SDK
5
+ * default keeps only the message, which dropped the scope an owner must grant.
6
+ */
7
+ export declare function apiErrorResult(error: ToDoddleApiError): {
8
+ isError: boolean;
9
+ content: {
10
+ type: 'text';
11
+ text: string;
12
+ }[];
13
+ };
14
+ /**
15
+ * The API returns web links as paths such as /dashboard/project/x. Left
16
+ * relative, a client guesses the host and often picks www.tododdle.com, which
17
+ * is the marketing site. Turn them into absolute links on the app origin.
18
+ * In-app embed paths (/api/documents/...) are left alone.
19
+ */
20
+ export declare function absolutizeLinks(value: unknown, appOrigin: string): unknown;
21
+ export interface ToDoddleMcpServerOptions {
22
+ managedUploadRoot?: string;
23
+ /** Web app origin, such as https://app.tododdle.com, for absolute links in results. */
24
+ appOrigin?: string;
25
+ maxUploadBytes?: number;
26
+ }
27
+ export declare function createToDoddleMcpServer(api: ToDoddleApi, serverOptions?: ToDoddleMcpServerOptions): McpServer;
28
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAoB,MAAM,yCAAyC,CAAC;AAEtF,OAAO,EAAE,gBAAgB,EAA+B,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAqPlG;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,gBAAgB;;;cAmBV,MAAM;;;EACjD;AAcD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAc1E;AA2HD,MAAM,WAAW,wBAAwB;IACvC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,uFAAuF;IACvF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AA2ND,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,WAAW,EAChB,aAAa,GAAE,wBAA6B,GAC3C,SAAS,CAywGX"}