iit-mcp-autotask 0.63.5 → 0.63.7
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/README.md +5 -0
- package/capabilities.json +2 -2
- package/dist/access/write-env.js +8 -0
- package/dist/tools/catalog-data.d.ts +1 -1
- package/dist/tools/catalog-data.js +1 -1
- package/dist/tools/write/preview.js +9 -3
- package/dist/tools/write/snapshot.js +52 -10
- package/package.json +2 -2
- package/server.json +2 -2
package/README.md
CHANGED
|
@@ -679,6 +679,11 @@ be visible through `resources.get`; the write's company run scope still applies
|
|
|
679
679
|
does not prove impersonation permission: Autotask checks the API user's permission and whether the
|
|
680
680
|
target resource permits impersonation.
|
|
681
681
|
|
|
682
|
+
For `task_note_attachments.create`, `attachedByContactID` requests a contact author. The
|
|
683
|
+
preview reports `creatorIdentity.mode: "requested_contact"`, the `contactId`, and the
|
|
684
|
+
`requestIdentity` used for the call. The approval summary shows the requested contact and any
|
|
685
|
+
resource impersonation. Autotask validates contact authorship, visibility and publish settings.
|
|
686
|
+
|
|
682
687
|
Apply restores the identity saved in the encrypted plan; supply only the preview's plan and approval
|
|
683
688
|
echo. A plan belongs to the original credential and principal. A different credential or ambient
|
|
684
689
|
impersonation default cannot apply it. The requested header identifies attribution intent; the vendor's
|
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,308 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": 1308,
|
|
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
|
@@ -139,6 +139,14 @@ export function resolveWritePolicy(env) {
|
|
|
139
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
140
|
continue;
|
|
141
141
|
}
|
|
142
|
+
if (op === 'task_note_attachments.create') {
|
|
143
|
+
dedupProblems.push(`${op}: the note-filtered query cannot establish exact note-parent duplicates; remove this AUTOTASK_DEDUP entry and use explicit scoped create`);
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
if (op === 'configuration_item_attachments.create') {
|
|
147
|
+
dedupProblems.push(`${op}: the configuration-item query cannot establish exact configuration-item parent duplicates; remove this AUTOTASK_DEDUP entry and use explicit scoped create`);
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
142
150
|
if (!fields.every((f) => FIELD.test(f))) {
|
|
143
151
|
dedupProblems.push(`${op}: each field must be a plain field name joined by +`);
|
|
144
152
|
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 = "3b14a93bbda886bce89c87d61ba40092f9acf6a829a959f042be1c3a0744ed42";
|
|
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 = '3b14a93bbda886bce89c87d61ba40092f9acf6a829a959f042be1c3a0744ed42';
|
|
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).
|
|
@@ -159,8 +159,14 @@ function evaluatePreview(r, a, snap, dry, resource, types) {
|
|
|
159
159
|
audit(decision.decision, decision.reasons, planHash, parsed.targets, facts);
|
|
160
160
|
const described = describe(record, shape, op, parsed, dry);
|
|
161
161
|
const creator = creatorIdentity(ctx);
|
|
162
|
-
const
|
|
163
|
-
const
|
|
162
|
+
const contact = op === 'task_note_attachments.create' ? parsed.data?.attachedByContactID : undefined;
|
|
163
|
+
const requestAuthor = typeof contact === 'number' ? { mode: 'requested_contact', contactId: contact, requestIdentity: creator } : creator;
|
|
164
|
+
const resourceIdentity = creator.mode === 'impersonation' ? `impersonation resource ${creator.resourceId}` : undefined;
|
|
165
|
+
const attribution = typeof contact === 'number'
|
|
166
|
+
? `Requested contact author ${contact}, subject to Autotask validation${resourceIdentity === undefined ? '' : `. Request uses ${resourceIdentity}`}`
|
|
167
|
+
: `Creator: ${resourceIdentity ?? 'API user'}`;
|
|
168
|
+
const fileAttachment = ['configuration_item_attachments.create', 'task_attachments.create', 'task_note_attachments.create'].includes(op);
|
|
169
|
+
const base64 = fileAttachment && parsed.data?.attachmentType === 'FILE_ATTACHMENT' ? parsed.data.data : undefined;
|
|
164
170
|
const file = typeof base64 === 'string'
|
|
165
171
|
? { bytes: Buffer.byteLength(base64, 'base64'), sha256: createHash('sha256').update(base64, 'base64').digest('hex') }
|
|
166
172
|
: undefined;
|
|
@@ -169,7 +175,7 @@ function evaluatePreview(r, a, snap, dry, resource, types) {
|
|
|
169
175
|
described.lines = [...described.lines, attribution, ...(fileSummary === '' ? [] : [fileSummary])];
|
|
170
176
|
const preview = {
|
|
171
177
|
operation: op,
|
|
172
|
-
creatorIdentity:
|
|
178
|
+
creatorIdentity: requestAuthor,
|
|
173
179
|
targets: parsed.targets,
|
|
174
180
|
decision: decision.decision,
|
|
175
181
|
hazards: decision.hazards,
|
|
@@ -58,6 +58,15 @@ export function getIds(ctx, resource, parentId, id) {
|
|
|
58
58
|
}
|
|
59
59
|
class AttachmentScopeUnresolved extends Error {
|
|
60
60
|
}
|
|
61
|
+
/** AttachmentInfo uses installedProduct names in vendor help and configurationItem names in Swagger. */
|
|
62
|
+
function assetOrigin(attachment, field, documentedField) {
|
|
63
|
+
const swagger = ci(attachment, field);
|
|
64
|
+
const documented = ci(attachment, documentedField);
|
|
65
|
+
if (swagger != null && documented != null && swagger !== documented) {
|
|
66
|
+
throw new AttachmentScopeUnresolved(`attachment_info: conflicting ${field} and ${documentedField} associations`);
|
|
67
|
+
}
|
|
68
|
+
return swagger ?? documented;
|
|
69
|
+
}
|
|
61
70
|
/** 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. */
|
|
62
71
|
function createReader(ctx, targetKey, signal, operation) {
|
|
63
72
|
const reads = {};
|
|
@@ -65,6 +74,8 @@ function createReader(ctx, targetKey, signal, operation) {
|
|
|
65
74
|
const companies = new Set();
|
|
66
75
|
const unresolved = [];
|
|
67
76
|
const taskAttachment = operation === 'task_attachments.create' || operation === 'task_attachments.delete';
|
|
77
|
+
const assetAttachment = operation === 'configuration_item_attachments.create' || operation === 'configuration_item_attachments.delete';
|
|
78
|
+
const strictAttachment = taskAttachment || assetAttachment || operation === 'task_note_attachments.create' || operation === 'task_note_attachments.delete';
|
|
68
79
|
// The write's own TARGET record is hashed in full (an update/delete must notice any change to it);
|
|
69
80
|
// a record that is only REFERENCED (the ticket a time entry is logged on) is hashed by its stable
|
|
70
81
|
// facts only, so a volatile stamp the first of two outstanding writes moves (lastActivityDate,
|
|
@@ -82,14 +93,15 @@ function createReader(ctx, targetKey, signal, operation) {
|
|
|
82
93
|
if (v === undefined)
|
|
83
94
|
throw new Cancelled();
|
|
84
95
|
const model = v;
|
|
85
|
-
|
|
96
|
+
const hasCompanyScope = resource === 'projects' || resource === 'contracts' || (assetAttachment && resource === 'configuration_items');
|
|
97
|
+
if (strictAttachment && (ci(model, 'id') !== ids.at(-1) || (hasCompanyScope && !isRefId(ci(model, 'companyID'), 'companies')))) {
|
|
86
98
|
throw new AttachmentScopeUnresolved(`${resource}: the fresh record did not establish the requested identity and scope`);
|
|
87
99
|
}
|
|
88
100
|
if (key !== targetKey && ids.length === 2) {
|
|
89
101
|
const parent = await parentOf(resource);
|
|
90
102
|
if (parent !== undefined && asIdOrZero(ci(model, parent.field)) !== ids[0]) {
|
|
91
103
|
const detail = `${resource}: the fresh record did not establish the requested ${parent.field} route locator`;
|
|
92
|
-
if (
|
|
104
|
+
if (strictAttachment)
|
|
93
105
|
throw new AttachmentScopeUnresolved(detail);
|
|
94
106
|
throw new AutotaskConfigError(detail);
|
|
95
107
|
}
|
|
@@ -164,6 +176,9 @@ function createReader(ctx, targetKey, signal, operation) {
|
|
|
164
176
|
const attachmentOrigin = taskAttachment && !payload && (resource === 'attachment_info' || resource === 'task_attachments');
|
|
165
177
|
if (attachmentOrigin)
|
|
166
178
|
refs.push(['taskNoteID', 'task_notes'], ['timeEntryID', 'time_entries']);
|
|
179
|
+
if (assetAttachment && !payload && (resource === 'attachment_info' || resource === 'configuration_item_attachments')) {
|
|
180
|
+
refs.push(['configurationItemNoteID', 'configuration_item_notes']);
|
|
181
|
+
}
|
|
167
182
|
const children = await drainReads(refs.map(async ([field, res]) => {
|
|
168
183
|
let read;
|
|
169
184
|
try {
|
|
@@ -173,7 +188,9 @@ function createReader(ctx, targetKey, signal, operation) {
|
|
|
173
188
|
read = { kind: required ? 'missing' : 'absent' };
|
|
174
189
|
}
|
|
175
190
|
else {
|
|
176
|
-
|
|
191
|
+
// Attachment paths can reach a project via both its task and task note before its contract.
|
|
192
|
+
const projectContract = strictAttachment && depth === 3 && resource === 'projects' && res === 'contracts';
|
|
193
|
+
const ids = isRefId(value, res) && (depth < 3 || projectContract) ? await idsFor(res, value, rec) : undefined;
|
|
177
194
|
if (ids === undefined)
|
|
178
195
|
read = { kind: 'missing' };
|
|
179
196
|
else {
|
|
@@ -356,6 +373,9 @@ export async function takeSnapshot(ctx, record, parsed, duplicateFields, signal)
|
|
|
356
373
|
const parent = targets.parentId === undefined ? undefined : await parentOf(record.resource);
|
|
357
374
|
if (writeShape(record) === 'create_child' && parent !== undefined && data !== undefined) {
|
|
358
375
|
const payloadParent = ci(data, parent.field);
|
|
376
|
+
if (record.id === 'task_note_attachments.create' && payloadParent !== undefined) {
|
|
377
|
+
return reason('INPUT_INVALID', 'Pass the task note ID as parentId for a task note attachment', 'data.taskNoteID');
|
|
378
|
+
}
|
|
359
379
|
if (record.id === 'task_attachments.create' && payloadParent !== undefined && typeof payloadParent !== 'number') {
|
|
360
380
|
return reason('INPUT_INVALID', `${record.id}: data.${parent.field} must be a numeric task identifier`, `data.${parent.field}`);
|
|
361
381
|
}
|
|
@@ -416,12 +436,13 @@ export async function takeSnapshot(ctx, record, parsed, duplicateFields, signal)
|
|
|
416
436
|
}
|
|
417
437
|
}
|
|
418
438
|
if (data !== undefined) {
|
|
419
|
-
|
|
439
|
+
const nestedAsset = record.id === 'configuration_item_attachments.create';
|
|
440
|
+
if ((nestedAsset || record.id === 'task_attachments.create') && ci(data, 'parentAttachmentID') !== undefined) {
|
|
420
441
|
const parentAttachmentID = ci(data, 'parentAttachmentID');
|
|
421
442
|
if (!isRefId(parentAttachmentID, 'attachment_info')) {
|
|
422
443
|
return reason('INPUT_INVALID', `${record.id}: parentAttachmentID must identify an attachment`, 'data.parentAttachmentID');
|
|
423
444
|
}
|
|
424
|
-
const unproved = reason('TARGET_NOT_IN_SCOPE', `${record.id}: the parent attachment's task scope could not be established`);
|
|
445
|
+
const unproved = reason('TARGET_NOT_IN_SCOPE', `${record.id}: the parent attachment's ${nestedAsset ? 'configuration item' : 'task'} scope could not be established`);
|
|
425
446
|
let attachment;
|
|
426
447
|
try {
|
|
427
448
|
attachment = await get('attachment_info', [parentAttachmentID]);
|
|
@@ -431,11 +452,19 @@ export async function takeSnapshot(ctx, record, parsed, duplicateFields, signal)
|
|
|
431
452
|
throw err;
|
|
432
453
|
return unproved;
|
|
433
454
|
}
|
|
434
|
-
|
|
455
|
+
const parentResource = nestedAsset ? 'configuration_items' : 'tasks';
|
|
456
|
+
const owner = nestedAsset ? assetOrigin(attachment, 'configurationItemID', 'installedProductID') : ci(attachment, 'taskID');
|
|
457
|
+
if (!isRefId(owner, parentResource) || owner !== targets.parentId)
|
|
435
458
|
return unproved;
|
|
459
|
+
const scoped = nestedAsset ? {
|
|
460
|
+
...attachment,
|
|
461
|
+
configurationItemID: owner,
|
|
462
|
+
configurationItemNoteID: assetOrigin(attachment, 'configurationItemNoteID', 'installedProductNoteID'),
|
|
463
|
+
} : attachment;
|
|
436
464
|
// The ancestor and origin fields also bind the proposed attachment relationship to this preview.
|
|
437
|
-
|
|
438
|
-
|
|
465
|
+
const originFields = nestedAsset ? ['parentAttachmentID', 'configurationItemID', 'configurationItemNoteID'] : ['parentAttachmentID', 'taskNoteID', 'timeEntryID'];
|
|
466
|
+
hashed[`attachment_info:${parentAttachmentID}:origin`] = originFields.map(field => ci(scoped, field));
|
|
467
|
+
await anchor('attachment_info', scoped, 0, false);
|
|
439
468
|
}
|
|
440
469
|
// The payload's references: a create's would-be record, or what an update moves the record to.
|
|
441
470
|
// `id` in a payload is never a scope fact (the payload flag).
|
|
@@ -444,12 +473,25 @@ export async function takeSnapshot(ctx, record, parsed, duplicateFields, signal)
|
|
|
444
473
|
if (targets.parentId !== undefined) {
|
|
445
474
|
// The parent the caller names is a scope fact of its own, read live, whatever the payload says.
|
|
446
475
|
const parent = await parentOf(record.resource);
|
|
447
|
-
const
|
|
476
|
+
const noteAttachment = record.resource === 'task_note_attachments';
|
|
477
|
+
const locatorInput = noteAttachment ? {} : data ?? current ?? {};
|
|
478
|
+
const ids = parent === undefined || !isRefId(targets.parentId, parent.resource) ? undefined : await idsFor(parent.resource, targets.parentId, locatorInput);
|
|
448
479
|
if (parent === undefined || ids === undefined)
|
|
449
480
|
unresolved.push(`${record.resource}.parent`);
|
|
450
481
|
else {
|
|
451
482
|
try {
|
|
452
|
-
|
|
483
|
+
const parentRecord = await get(parent.resource, ids);
|
|
484
|
+
if (noteAttachment) {
|
|
485
|
+
const attachmentTask = current === undefined ? undefined : ci(current, 'taskID');
|
|
486
|
+
if (attachmentTask != null && attachmentTask !== ci(parentRecord, 'taskID')) {
|
|
487
|
+
return reason('TARGET_NOT_IN_SCOPE', `${record.id}: the attachment's task association contradicts the note's task`);
|
|
488
|
+
}
|
|
489
|
+
const contact = data === undefined ? undefined : ci(data, 'attachedByContactID');
|
|
490
|
+
if (isRefId(contact, 'contacts')) {
|
|
491
|
+
hashed[`task_notes:${ids.join('/')}:contact_author`] = { createdByContactID: ci(parentRecord, 'createdByContactID') };
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
await anchor(parent.resource, parentRecord, 1, false);
|
|
453
495
|
}
|
|
454
496
|
catch (err) {
|
|
455
497
|
if (!isNotFound(err))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iit-mcp-autotask",
|
|
3
|
-
"version": "0.63.
|
|
3
|
+
"version": "0.63.7",
|
|
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.77.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.7",
|
|
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.77.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"
|