iit-mcp-autotask 0.63.4 → 0.63.5
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/capabilities.json
CHANGED
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
},
|
|
75
75
|
{
|
|
76
76
|
"id": "autotask.platform.catalog",
|
|
77
|
-
"description": "Find the exact operation key for anything without a dedicated tool: ranked search (q) over the 1,
|
|
77
|
+
"description": "Find the exact operation key for anything without a dedicated tool: ranked search (q) over the 1,294 registry operations, with effect and whether this deployment serves it. No vendor call.",
|
|
78
78
|
"mcpPrimitive": "tool",
|
|
79
79
|
"toolName": "autotask_catalog",
|
|
80
80
|
"type": "read",
|
|
@@ -480,7 +480,7 @@
|
|
|
480
480
|
"autotask_describe",
|
|
481
481
|
"autotask_read"
|
|
482
482
|
],
|
|
483
|
-
"backingRegistryOperations":
|
|
483
|
+
"backingRegistryOperations": 1294,
|
|
484
484
|
"note": "autotask_catalog finds the exact operation key (ranked search), autotask_describe serves its contract, autotask_read runs any effect=read key. Writes go through the operator profile (autotask_write then autotask_apply); authenticate.* is never served."
|
|
485
485
|
},
|
|
486
486
|
"schemas": {}
|
package/dist/access/write-env.js
CHANGED
|
@@ -135,6 +135,10 @@ export function resolveWritePolicy(env) {
|
|
|
135
135
|
dedupProblems.push(`${op}: company-level queries can include company-note attachments and cannot establish exact company-parent duplicates; remove this AUTOTASK_DEDUP entry and use explicit scoped create`);
|
|
136
136
|
continue;
|
|
137
137
|
}
|
|
138
|
+
if (op === 'task_attachments.create') {
|
|
139
|
+
dedupProblems.push(`${op}: task-level queries can include child attachments and cannot establish exact task-parent duplicates; remove this AUTOTASK_DEDUP entry and use explicit scoped create`);
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
138
142
|
if (!fields.every((f) => FIELD.test(f))) {
|
|
139
143
|
dedupProblems.push(`${op}: each field must be a plain field name joined by +`);
|
|
140
144
|
continue;
|
|
@@ -107,7 +107,7 @@ export declare function sdkCacheOptions(cache: 'on' | 'off'): Pick<AutotaskConfi
|
|
|
107
107
|
* fails the boot (or the CI test) instead of quietly shipping a tool surface that no longer
|
|
108
108
|
* describes the SDK behind it.
|
|
109
109
|
*/
|
|
110
|
-
export declare const BUILT_AGAINST_PLAN_HASH = "
|
|
110
|
+
export declare const BUILT_AGAINST_PLAN_HASH = "3732a92572dcff19995b19cf9ba1dec6156153313f5d54704d1cca885d1aff45";
|
|
111
111
|
/**
|
|
112
112
|
* Fail fast when the installed SDK's plan has moved out from under this surface.
|
|
113
113
|
* Called at boot (main.ts) and safe to call repeatedly (pure comparison).
|
|
@@ -187,7 +187,7 @@ export function sdkCacheOptions(cache) {
|
|
|
187
187
|
* fails the boot (or the CI test) instead of quietly shipping a tool surface that no longer
|
|
188
188
|
* describes the SDK behind it.
|
|
189
189
|
*/
|
|
190
|
-
export const BUILT_AGAINST_PLAN_HASH = '
|
|
190
|
+
export const BUILT_AGAINST_PLAN_HASH = '3732a92572dcff19995b19cf9ba1dec6156153313f5d54704d1cca885d1aff45';
|
|
191
191
|
/**
|
|
192
192
|
* Fail fast when the installed SDK's plan has moved out from under this surface.
|
|
193
193
|
* Called at boot (main.ts) and safe to call repeatedly (pure comparison).
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** `autotask_write`: the preview tool (issue #89). */
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
2
3
|
import { releaseClientOnError } from '../context/derive.js';
|
|
3
4
|
import { MoveRefusedError } from 'node-autotask';
|
|
4
5
|
import { describeWrite } from 'node-autotask/operations';
|
|
@@ -159,8 +160,13 @@ function evaluatePreview(r, a, snap, dry, resource, types) {
|
|
|
159
160
|
const described = describe(record, shape, op, parsed, dry);
|
|
160
161
|
const creator = creatorIdentity(ctx);
|
|
161
162
|
const attribution = creator.mode === 'api_user' ? 'Creator: API user' : `Creator: impersonation resource ${creator.resourceId}`;
|
|
162
|
-
|
|
163
|
-
|
|
163
|
+
const base64 = op === 'task_attachments.create' && parsed.data?.attachmentType === 'FILE_ATTACHMENT' ? parsed.data.data : undefined;
|
|
164
|
+
const file = typeof base64 === 'string'
|
|
165
|
+
? { bytes: Buffer.byteLength(base64, 'base64'), sha256: createHash('sha256').update(base64, 'base64').digest('hex') }
|
|
166
|
+
: undefined;
|
|
167
|
+
const fileSummary = file === undefined ? '' : `File ${file.bytes} bytes, SHA-256 ${file.sha256}`;
|
|
168
|
+
described.headline = `${described.headline}. ${attribution}${fileSummary === '' ? '' : `. ${fileSummary}`}`;
|
|
169
|
+
described.lines = [...described.lines, attribution, ...(fileSummary === '' ? [] : [fileSummary])];
|
|
164
170
|
const preview = {
|
|
165
171
|
operation: op,
|
|
166
172
|
creatorIdentity: creatorIdentity(ctx),
|
|
@@ -174,6 +180,7 @@ function evaluatePreview(r, a, snap, dry, resource, types) {
|
|
|
174
180
|
// parsed args: they still carry pre-redaction personal-data values), so a gated create on a
|
|
175
181
|
// DELETE-less resource confirms the exact body it approves.
|
|
176
182
|
...(shape === 'create' || shape === 'create_child' ? { payload: dry.data } : {}),
|
|
183
|
+
...(file === undefined ? {} : { file }),
|
|
177
184
|
// #183 AC23: the record a delete will remove — the snapshot's target read (zero new wire: the
|
|
178
185
|
// read is already paid for the snapshot, the field checks and the policy facts), marked
|
|
179
186
|
// untrusted like every other served vendor record (S6).
|
|
@@ -56,12 +56,15 @@ export function isRefId(v, resource) {
|
|
|
56
56
|
export function getIds(ctx, resource, parentId, id) {
|
|
57
57
|
return parentId !== undefined && !hasSimpleGet(resource, ctx) ? [parentId, id] : [id];
|
|
58
58
|
}
|
|
59
|
+
class AttachmentScopeUnresolved extends Error {
|
|
60
|
+
}
|
|
59
61
|
/** The reader for one snapshot. Only the write's own target record is hashed in full; a referenced record is hashed by its stable facts. */
|
|
60
|
-
function createReader(ctx, targetKey, signal,
|
|
62
|
+
function createReader(ctx, targetKey, signal, operation) {
|
|
61
63
|
const reads = {};
|
|
62
64
|
const hashed = {};
|
|
63
65
|
const companies = new Set();
|
|
64
66
|
const unresolved = [];
|
|
67
|
+
const taskAttachment = operation === 'task_attachments.create' || operation === 'task_attachments.delete';
|
|
65
68
|
// The write's own TARGET record is hashed in full (an update/delete must notice any change to it);
|
|
66
69
|
// a record that is only REFERENCED (the ticket a time entry is logged on) is hashed by its stable
|
|
67
70
|
// facts only, so a volatile stamp the first of two outstanding writes moves (lastActivityDate,
|
|
@@ -78,15 +81,22 @@ function createReader(ctx, targetKey, signal, requirePredecessorInPayload = fals
|
|
|
78
81
|
const v = await ctx.ops.invokeRead(ctx.client, `${resource}.get`, ids, { fresh: true }, signal);
|
|
79
82
|
if (v === undefined)
|
|
80
83
|
throw new Cancelled();
|
|
84
|
+
const model = v;
|
|
85
|
+
if (taskAttachment && (ci(model, 'id') !== ids.at(-1) || (resource === 'projects' && !isRefId(ci(model, 'companyID'), 'companies')))) {
|
|
86
|
+
throw new AttachmentScopeUnresolved(`${resource}: the fresh record did not establish the requested identity and scope`);
|
|
87
|
+
}
|
|
81
88
|
if (key !== targetKey && ids.length === 2) {
|
|
82
89
|
const parent = await parentOf(resource);
|
|
83
|
-
if (parent !== undefined && asIdOrZero(ci(
|
|
84
|
-
|
|
90
|
+
if (parent !== undefined && asIdOrZero(ci(model, parent.field)) !== ids[0]) {
|
|
91
|
+
const detail = `${resource}: the fresh record did not establish the requested ${parent.field} route locator`;
|
|
92
|
+
if (taskAttachment)
|
|
93
|
+
throw new AttachmentScopeUnresolved(detail);
|
|
94
|
+
throw new AutotaskConfigError(detail);
|
|
85
95
|
}
|
|
86
96
|
}
|
|
87
97
|
reads[key] = v;
|
|
88
98
|
hashed[key] = key === targetKey ? v : stableFacts(v);
|
|
89
|
-
return
|
|
99
|
+
return model;
|
|
90
100
|
})();
|
|
91
101
|
pending.set(key, request);
|
|
92
102
|
}
|
|
@@ -151,12 +161,15 @@ function createReader(ctx, targetKey, signal, requirePredecessorInPayload = fals
|
|
|
151
161
|
// The successor is the route parent. The other task also contributes scope and stable facts.
|
|
152
162
|
if (resource === 'task_predecessors')
|
|
153
163
|
refs.push(['predecessorTaskID', 'tasks']);
|
|
164
|
+
const attachmentOrigin = taskAttachment && !payload && (resource === 'attachment_info' || resource === 'task_attachments');
|
|
165
|
+
if (attachmentOrigin)
|
|
166
|
+
refs.push(['taskNoteID', 'task_notes'], ['timeEntryID', 'time_entries']);
|
|
154
167
|
const children = await drainReads(refs.map(async ([field, res]) => {
|
|
155
168
|
let read;
|
|
156
169
|
try {
|
|
157
170
|
const value = ci(rec, field);
|
|
158
171
|
if (value === undefined || value === null) {
|
|
159
|
-
const required = field === 'predecessorTaskID' && (!payload ||
|
|
172
|
+
const required = field === 'predecessorTaskID' && (!payload || operation === 'task_predecessors.create');
|
|
160
173
|
read = { kind: required ? 'missing' : 'absent' };
|
|
161
174
|
}
|
|
162
175
|
else {
|
|
@@ -166,7 +179,8 @@ function createReader(ctx, targetKey, signal, requirePredecessorInPayload = fals
|
|
|
166
179
|
else {
|
|
167
180
|
const target = await get(res, ids);
|
|
168
181
|
const wrongTask = resource === 'task_predecessors' && res === 'tasks' && ci(target, 'id') !== value;
|
|
169
|
-
|
|
182
|
+
const wrongOrigin = attachmentOrigin && (res === 'task_notes' || res === 'time_entries') && ci(target, 'taskID') !== ci(rec, 'taskID');
|
|
183
|
+
read = wrongTask || wrongOrigin ? { kind: 'missing' } : { kind: 'record', record: target };
|
|
170
184
|
}
|
|
171
185
|
}
|
|
172
186
|
}
|
|
@@ -336,12 +350,15 @@ export async function takeSnapshot(ctx, record, parsed, duplicateFields, signal)
|
|
|
336
350
|
return reason('INPUT_INVALID', `${record.id}: parentId 0 names no record; write targets are ids, never names (resolve a name with autotask_resolve first)`, 'args.0');
|
|
337
351
|
}
|
|
338
352
|
const targetKey = parsed.targets.id === undefined ? undefined : `${record.resource}:${getIds(ctx, record.resource, parsed.targets.parentId, parsed.targets.id).join('/')}`;
|
|
339
|
-
const r = createReader(ctx, targetKey, signal, record.id
|
|
353
|
+
const r = createReader(ctx, targetKey, signal, record.id);
|
|
340
354
|
const { get, idsFor, anchor, reads, hashed, unresolved, companies } = r;
|
|
341
355
|
const { targets, data } = parsed;
|
|
342
356
|
const parent = targets.parentId === undefined ? undefined : await parentOf(record.resource);
|
|
343
357
|
if (writeShape(record) === 'create_child' && parent !== undefined && data !== undefined) {
|
|
344
358
|
const payloadParent = ci(data, parent.field);
|
|
359
|
+
if (record.id === 'task_attachments.create' && payloadParent !== undefined && typeof payloadParent !== 'number') {
|
|
360
|
+
return reason('INPUT_INVALID', `${record.id}: data.${parent.field} must be a numeric task identifier`, `data.${parent.field}`);
|
|
361
|
+
}
|
|
345
362
|
if (payloadParent !== undefined && asIdOrZero(payloadParent) !== targets.parentId) {
|
|
346
363
|
return reason('INPUT_INVALID', `${record.id}: data.${parent.field} conflicts with the parentId route`, `data.${parent.field}`);
|
|
347
364
|
}
|
|
@@ -399,6 +416,27 @@ export async function takeSnapshot(ctx, record, parsed, duplicateFields, signal)
|
|
|
399
416
|
}
|
|
400
417
|
}
|
|
401
418
|
if (data !== undefined) {
|
|
419
|
+
if (record.id === 'task_attachments.create' && ci(data, 'parentAttachmentID') !== undefined) {
|
|
420
|
+
const parentAttachmentID = ci(data, 'parentAttachmentID');
|
|
421
|
+
if (!isRefId(parentAttachmentID, 'attachment_info')) {
|
|
422
|
+
return reason('INPUT_INVALID', `${record.id}: parentAttachmentID must identify an attachment`, 'data.parentAttachmentID');
|
|
423
|
+
}
|
|
424
|
+
const unproved = reason('TARGET_NOT_IN_SCOPE', `${record.id}: the parent attachment's task scope could not be established`);
|
|
425
|
+
let attachment;
|
|
426
|
+
try {
|
|
427
|
+
attachment = await get('attachment_info', [parentAttachmentID]);
|
|
428
|
+
}
|
|
429
|
+
catch (err) {
|
|
430
|
+
if (!isNotFound(err))
|
|
431
|
+
throw err;
|
|
432
|
+
return unproved;
|
|
433
|
+
}
|
|
434
|
+
if (!isRefId(ci(attachment, 'taskID'), 'tasks') || ci(attachment, 'taskID') !== targets.parentId)
|
|
435
|
+
return unproved;
|
|
436
|
+
// The ancestor and origin fields also bind the proposed attachment relationship to this preview.
|
|
437
|
+
hashed[`attachment_info:${parentAttachmentID}:origin`] = ['parentAttachmentID', 'taskNoteID', 'timeEntryID'].map(field => ci(attachment, field));
|
|
438
|
+
await anchor('attachment_info', attachment, 0, false);
|
|
439
|
+
}
|
|
402
440
|
// The payload's references: a create's would-be record, or what an update moves the record to.
|
|
403
441
|
// `id` in a payload is never a scope fact (the payload flag).
|
|
404
442
|
await anchor(record.resource, data, 0, true);
|
|
@@ -436,7 +474,12 @@ export async function takeSnapshot(ctx, record, parsed, duplicateFields, signal)
|
|
|
436
474
|
}
|
|
437
475
|
return [];
|
|
438
476
|
};
|
|
439
|
-
const
|
|
477
|
+
const scope = references().catch((err) => {
|
|
478
|
+
if (err instanceof AttachmentScopeUnresolved)
|
|
479
|
+
return reason('TARGET_NOT_IN_SCOPE', err.message);
|
|
480
|
+
throw err;
|
|
481
|
+
});
|
|
482
|
+
const [referenceResult, duplicateIds] = await drainReads([scope, duplicates()]);
|
|
440
483
|
if ('code' in referenceResult)
|
|
441
484
|
return referenceResult;
|
|
442
485
|
const { current } = referenceResult;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iit-mcp-autotask",
|
|
3
|
-
"version": "0.63.
|
|
3
|
+
"version": "0.63.5",
|
|
4
4
|
"description": "MCP server for the Autotask (Datto) PSA domain, built on the node-autotask SDK",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Max Soukhomlinov",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@modelcontextprotocol/server": "^2.2.0",
|
|
57
|
-
"node-autotask": "0.
|
|
57
|
+
"node-autotask": "0.75.0",
|
|
58
58
|
"zod": "^4.6.7"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
package/server.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iit-mcp-autotask",
|
|
3
|
-
"version": "0.63.
|
|
3
|
+
"version": "0.63.5",
|
|
4
4
|
"description": "MCP server for the Autotask (Datto) PSA API, powered by the node-autotask SDK",
|
|
5
5
|
"mcpProtocolBaseline": "2026-07-28",
|
|
6
6
|
"legacyProtocolFallback": "2025-11-25",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"capabilitiesManifest": "capabilities.json",
|
|
63
63
|
"sdk": {
|
|
64
64
|
"package": "node-autotask",
|
|
65
|
-
"versionRange": "0.
|
|
65
|
+
"versionRange": "0.75.0"
|
|
66
66
|
},
|
|
67
67
|
"vendorExtensions": false,
|
|
68
68
|
"credentialModelNote": "per-request; server-held under stdio or, on HTTP, only behind AUTOTASK_HTTP_AUTH=tokens; operator plans and the ledger are keyed by principal and tenant id, never by credential, and an apply authenticates the request credential and restores the plan's per-write impersonation"
|