iit-mcp-autotask 0.62.3 → 0.63.1
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 +3 -2
- package/README.md +7 -5
- package/capabilities.json +2 -2
- package/dist/access/write-env.js +4 -0
- package/dist/config/schema.d.ts +4 -1
- package/dist/config/schema.js +7 -4
- package/dist/http-guard.js +2 -2
- package/dist/tools/catalog-data.d.ts +1 -1
- package/dist/tools/catalog-data.js +1 -1
- package/dist/tools/meta.js +3 -2
- package/dist/tools/write/snapshot.js +64 -3
- package/package.json +2 -2
- package/server.json +3 -3
package/.env.example
CHANGED
|
@@ -68,8 +68,9 @@ AUTOTASK_PROFILE=readonly
|
|
|
68
68
|
# The kill file: while it exists every preview and apply is denied (default <state dir>/KILL).
|
|
69
69
|
# AUTOTASK_KILL_FILE=/var/lib/autotask-mcp/KILL
|
|
70
70
|
# Optional toolsets on top of core (core is always on): a comma list of service, records, finance,
|
|
71
|
-
# or all. An unknown name fails boot.
|
|
72
|
-
#
|
|
71
|
+
# all, or core for core only. Unset = all. An unknown name fails boot. Set core (or a short list)
|
|
72
|
+
# for clients that cap the tool count or prompt size.
|
|
73
|
+
# AUTOTASK_TOOLSETS=core
|
|
73
74
|
# IANA time zone of the people asking (their local "today"), default UTC; not the tenant's or
|
|
74
75
|
# the server's zone. Autotask stores UTC; the zone is reported by
|
|
75
76
|
# autotask_tenant_status (time) and, when not UTC, named in the server instructions. Region/city
|
package/README.md
CHANGED
|
@@ -10,8 +10,9 @@ client + SDK-owned TTL caches).
|
|
|
10
10
|
|
|
11
11
|
## Tool surface
|
|
12
12
|
|
|
13
|
-
The **core** toolset is always served
|
|
14
|
-
|
|
13
|
+
The **core** toolset is always served. By default `service`, `records` and `finance` are served
|
|
14
|
+
too; `AUTOTASK_TOOLSETS=core` serves core only, or a comma list picks some of them (for clients
|
|
15
|
+
that cap the tool count or the prompt size). The operator profile adds a few more. The whole tool surface is
|
|
15
16
|
listed below (exact per-selection counts: the generated `capabilities.json`). Every other operation in the SDK's operation registry stays
|
|
16
17
|
reachable through the generic layer: `autotask_catalog` finds the key, `autotask_describe` serves
|
|
17
18
|
its contract (slim by default: transport and retry detail dropped, long text cut, the first two
|
|
@@ -143,7 +144,7 @@ fields on writes: [`docs/company-location-fields.md`](docs/company-location-fiel
|
|
|
143
144
|
| Variable | Default | Effect |
|
|
144
145
|
|----------|---------|--------|
|
|
145
146
|
| `AUTOTASK_PROFILE` | `readonly` | `readonly`: reads only, no state. `operator`: adds `autotask_write`, `autotask_apply` and `autotask_apply_destructive`; see [Operator profile](#operator-profile-writes). On HTTP it requires `AUTOTASK_HTTP_AUTH=tokens` or `gateway`. |
|
|
146
|
-
| `AUTOTASK_TOOLSETS` | — (core only
|
|
147
|
+
| `AUTOTASK_TOOLSETS` | — (all) | unset, blank or `all`: every toolset; `core`: core only; or a comma list of `service`, `records`, `finance`; an unknown name fails boot |
|
|
147
148
|
|
|
148
149
|
Every write and delete is refused on the read path (`autotask_read`) before any request
|
|
149
150
|
(`POLICY_DENIED`, status `denied`), on every profile. `authenticate.*` returns a live vendor token
|
|
@@ -429,7 +430,8 @@ shutdown. The `HEALTHCHECK` probes `/health` (liveness only — it never calls A
|
|
|
429
430
|
`AUTOTASK_HTTP_TOKENS_FILE`, a JSON file mapping the lowercase hex SHA-256 of each bearer token to
|
|
430
431
|
`{ "principal": "...", "profile": "readonly" | "operator", "toolsets": [...], "runScope": {...} }`
|
|
431
432
|
(an operator token needs `runScope`: `{"companyIds":[...]}` or `{"all":true}`). Each token sees
|
|
432
|
-
its own tool list
|
|
433
|
+
its own tool list (`toolsets` takes the same names, `core` and `all` included; a token without
|
|
434
|
+
`toolsets` gets the deployment's `AUTOTASK_TOOLSETS`, every toolset when that is unset); a missing or unknown token is 401; each principal gets
|
|
433
435
|
`AUTOTASK_HTTP_RATE_PER_MIN` requests a minute (default 60, then 429 with `Retry-After`). The
|
|
434
436
|
static bearer map does not implement the MCP authorization spec's RFC 9728 metadata (deviation
|
|
435
437
|
D-14). For an operator deployment use a separate Autotask API user from the read deployments.
|
|
@@ -515,7 +517,7 @@ non-zero on an invalid config (fail-fast) instead of failing at the first tool c
|
|
|
515
517
|
| `AUTOTASK_PRINCIPAL` | no | `stdio` | the stdio operator principal |
|
|
516
518
|
| `AUTOTASK_KILL_FILE` | no | `<state dir>/KILL` | the kill switch file |
|
|
517
519
|
| `AUTOTASK_USER_TIMEZONE` | no | `UTC` | IANA time zone of the people asking (their local "today"), not the Autotask tenant's or the server's zone; region/city names only (e.g. `Australia/Melbourne`), kept as written with only the case of a listed name fixed (`Europe/Kyiv` stays `Europe/Kyiv`); `utc`, `Etc/UTC` and `GMT` mean `UTC`; fixed offsets (`+10:00`, `Etc/GMT-10`) and names without a region (`EST`, `Japan`) fail boot. Autotask stores UTC; the zone is told to clients (`autotask_tenant_status` `time` part: zone, local time, UTC time, offset; one line in the server instructions when not UTC) so "today" and "yesterday" become UTC bounds in the right zone for moment fields such as ticket creation and due times. Time entries are calendar days: `dateWorked` and `time_entries.dateWorkedWindow` take plain `YYYY-MM-DD`, not UTC bounds. Filter values are never converted. |
|
|
518
|
-
| `AUTOTASK_TOOLSETS` | no | — | `service`, `records`, `finance` (comma list) or `
|
|
520
|
+
| `AUTOTASK_TOOLSETS` | no | — (all) | `service`, `records`, `finance` (comma list), `all`, or `core` for core only; unset serves every toolset; core is always served |
|
|
519
521
|
| `AUTOTASK_API_INTEGRATION_CODE` | stdio: yes · http: no (discouraged default) | — | the `ApiIntegrationCode` credential (stdio env; http: optional discouraged server default, presented only to the default origin) |
|
|
520
522
|
| `AUTOTASK_USERNAME` | stdio: yes · http: no (discouraged default) | — | the `UserName` credential (same semantics) |
|
|
521
523
|
| `AUTOTASK_SECRET` | stdio: yes · http: no (discouraged default) | — | the `Secret` credential (same semantics) |
|
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,268 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": 1268,
|
|
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
|
@@ -131,6 +131,10 @@ export function resolveWritePolicy(env) {
|
|
|
131
131
|
dedupProblems.push(`${op}: dedup applies to creates only`);
|
|
132
132
|
continue;
|
|
133
133
|
}
|
|
134
|
+
if (op === 'company_attachments.create') {
|
|
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
|
+
continue;
|
|
137
|
+
}
|
|
134
138
|
if (!fields.every((f) => FIELD.test(f))) {
|
|
135
139
|
dedupProblems.push(`${op}: each field must be a plain field name joined by +`);
|
|
136
140
|
continue;
|
package/dist/config/schema.d.ts
CHANGED
|
@@ -31,7 +31,10 @@ export declare const RUN_SCOPE: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
31
31
|
export declare function isLoopbackHost(host: string): boolean;
|
|
32
32
|
/** A comma list of hostnames (lowercased, de-duplicated), or undefined when unset or blank. */
|
|
33
33
|
export declare function parseHostList(raw: string | undefined): string[] | undefined;
|
|
34
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* `AUTOTASK_TOOLSETS` parsed once into the optional toolsets served on top of core: unset, blank or
|
|
36
|
+
* `all` = every toolset; `core` = nothing beyond core; otherwise the comma list (`core` in it is a no-op).
|
|
37
|
+
*/
|
|
35
38
|
export declare function parseToolsets(raw: string | undefined): string[];
|
|
36
39
|
/**
|
|
37
40
|
* A plausible hostname label (RFC 952/1123): 1-63 lowercase alphanumerics + hyphens, no leading or
|
package/dist/config/schema.js
CHANGED
|
@@ -35,13 +35,16 @@ export function parseHostList(raw) {
|
|
|
35
35
|
return undefined;
|
|
36
36
|
return [...new Set(raw.split(',').map((h) => h.trim().toLowerCase()).filter((h) => h.length > 0))];
|
|
37
37
|
}
|
|
38
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* `AUTOTASK_TOOLSETS` parsed once into the optional toolsets served on top of core: unset, blank or
|
|
40
|
+
* `all` = every toolset; `core` = nothing beyond core; otherwise the comma list (`core` in it is a no-op).
|
|
41
|
+
*/
|
|
39
42
|
export function parseToolsets(raw) {
|
|
40
43
|
const names = (raw ?? '')
|
|
41
44
|
.split(',')
|
|
42
45
|
.map((name) => name.trim().toLowerCase())
|
|
43
46
|
.filter((name) => name.length > 0);
|
|
44
|
-
return names.includes('all') ? [...TOOLSETS] : [...new Set(names)];
|
|
47
|
+
return names.length === 0 || names.includes('all') ? [...TOOLSETS] : [...new Set(names.filter((name) => name !== 'core'))];
|
|
45
48
|
}
|
|
46
49
|
/**
|
|
47
50
|
* A plausible hostname label (RFC 952/1123): 1-63 lowercase alphanumerics + hyphens, no leading or
|
|
@@ -170,7 +173,7 @@ export const CONFIG_FIELDS = z
|
|
|
170
173
|
}
|
|
171
174
|
return parsed.data;
|
|
172
175
|
}),
|
|
173
|
-
/** The optional toolsets on top of core (comma list of service, records, finance
|
|
176
|
+
/** The optional toolsets on top of core (comma list of service, records, finance; all or unset = every one; core = none). */
|
|
174
177
|
AUTOTASK_TOOLSETS: z.string().optional().transform(parseToolsets),
|
|
175
178
|
/**
|
|
176
179
|
* The single off switch for the SDK's in-process caches (issue #252; replaces
|
|
@@ -304,7 +307,7 @@ export const schema = CONFIG_FIELDS
|
|
|
304
307
|
// An unknown toolset name fails boot (a typo must not silently serve a smaller surface).
|
|
305
308
|
for (const name of c.AUTOTASK_TOOLSETS) {
|
|
306
309
|
if (!TOOLSETS.includes(name)) {
|
|
307
|
-
ctx.addIssue({ code: 'custom', path: ['AUTOTASK_TOOLSETS'], message: `"${name}" is not a toolset; use a comma list of ${TOOLSETS.join(', ')},
|
|
310
|
+
ctx.addIssue({ code: 'custom', path: ['AUTOTASK_TOOLSETS'], message: `"${name}" is not a toolset; use a comma list of ${TOOLSETS.join(', ')}, all (the default), or core for core only` });
|
|
308
311
|
}
|
|
309
312
|
}
|
|
310
313
|
});
|
package/dist/http-guard.js
CHANGED
|
@@ -33,7 +33,7 @@ const TOKEN_ENTRY = z
|
|
|
33
33
|
.object({
|
|
34
34
|
principal: z.string().min(1).max(200),
|
|
35
35
|
profile: z.enum(PROFILES),
|
|
36
|
-
toolsets: z.array(z.enum([...TOOLSETS, 'all'])).optional(),
|
|
36
|
+
toolsets: z.array(z.enum([...TOOLSETS, 'all', 'core'])).optional(),
|
|
37
37
|
runScope: RUN_SCOPE.optional(),
|
|
38
38
|
writeOperations: z.array(z.string().max(200).refine((operation) => hardRuleFor(operation, recordById(operation)).never === undefined, 'must name a served write operation')).max(1000).refine((operations) => new Set(operations).size === operations.length, 'duplicate write operations')
|
|
39
39
|
.transform((operations) => [...operations].sort()).optional(),
|
|
@@ -101,7 +101,7 @@ export function bearerOf(request) {
|
|
|
101
101
|
}
|
|
102
102
|
/** The per-request config a token selects: its own profile and toolsets. */
|
|
103
103
|
export function configForToken(config, entry) {
|
|
104
|
-
const toolsets = entry.toolsets === undefined ? config.AUTOTASK_TOOLSETS : entry.toolsets.includes('all') ? [...TOOLSETS] : entry.toolsets;
|
|
104
|
+
const toolsets = entry.toolsets === undefined ? config.AUTOTASK_TOOLSETS : entry.toolsets.includes('all') ? [...TOOLSETS] : entry.toolsets.filter((name) => name !== 'core');
|
|
105
105
|
return { ...config, AUTOTASK_PROFILE: entry.profile, AUTOTASK_TOOLSETS: [...toolsets] };
|
|
106
106
|
}
|
|
107
107
|
/**
|
|
@@ -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 = "275fdf2fd6712f9384c1a65f98c5faf1fda9695475ffbdf35c08e574c18b4157";
|
|
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 = '275fdf2fd6712f9384c1a65f98c5faf1fda9695475ffbdf35c08e574c18b4157';
|
|
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).
|
package/dist/tools/meta.js
CHANGED
|
@@ -406,7 +406,8 @@ async function guidanceFor(ctx, rec, reachable) {
|
|
|
406
406
|
if (udfCapable && udfFields === undefined)
|
|
407
407
|
udfFields = udfUnavailable(udfCatalogCall(rec.resource));
|
|
408
408
|
const data = Object.fromEntries((required ?? []).map((f) => [f, '<value>']));
|
|
409
|
-
const
|
|
409
|
+
const argNames = Object.keys(rec.inputSchema).filter(name => name !== 'opts');
|
|
410
|
+
const exampleArgs = argNames.map(name => name === 'data' ? (op === 'create' ? data : { '<field>': '<value>' }) : 0);
|
|
410
411
|
const attribution = (rec.resource === 'ticket_notes' || rec.resource === 'time_entries') && op === 'create' ? [`Set autotask_write.impersonationResourceId to request a human creator; its preview discloses the identity. ${rec.resource === 'time_entries' ? 'resourceID identifies whose work it is; ' : ''}read-only impersonatorCreatorResourceID does not trigger impersonation. Vendor impersonation permissions apply.`] : [];
|
|
411
412
|
const constraints = [...attribution, ...coupledNotes(rec.resource), ...constraintNotes(op, facts, derived, rec.resource), ...dateConventionNotes(rec.resource), ...udfMergeNote(op === 'update' && UDF_CAPABLE.has(rec.resource)), ...(statusScope !== undefined ? [statusScope] : [])];
|
|
412
413
|
const caveats = caveatNotes(rec.metadata?.caveats);
|
|
@@ -420,7 +421,7 @@ async function guidanceFor(ctx, rec, reachable) {
|
|
|
420
421
|
...(required === undefined ? { fieldsNote: `field metadata could not be read; call autotask_read {operation:"operations.fieldCatalog", args:[{resources:["${rec.resource}"]}]}` } : {}),
|
|
421
422
|
...(conditional !== undefined ? { requiredFieldsConditional: conditional } : {}),
|
|
422
423
|
...(unsatisfiable ? { createUnsatisfiableViaApi: true } : { exampleArgs, example: `autotask_write {operation:"${rec.id}", args:${JSON.stringify(exampleArgs)}}` }),
|
|
423
|
-
note: `${op === 'create' ? 'Required fields can be wider than the vendor marks (see the playbooks).' :
|
|
424
|
+
note: `${op === 'create' ? 'Required fields can be wider than the vendor marks (see the playbooks).' : `Update args are [${argNames.map(name => name === 'data' ? '{fields}' : name).join(', ')}]; send only the fields to change.`} Previews write nothing.`,
|
|
424
425
|
...(caveats.length > 0 ? { caveats } : {}),
|
|
425
426
|
...(constraints.length > 0 ? { constraints } : {}),
|
|
426
427
|
...(hasQuirks ? { quirksPointer: `known vendor quirks of this resource: autotask_describe {resource:"${rec.resource}"}.` } : {}),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** The pre-write snapshot (the before state), the stable facts and the forced-duplicate filters (issue #89). */
|
|
2
2
|
import { relationshipMap } from 'node-autotask/operations';
|
|
3
|
+
import { AutotaskConfigError } from 'node-autotask';
|
|
3
4
|
import { writeShape } from '../../write/hard-rules.js';
|
|
4
5
|
import { Cancelled, reason, isNotFound } from './common.js';
|
|
5
6
|
import { CALL_COMPANY_ARGS, CALL_ID_ARGS, asIdOrZero } from './parse.js';
|
|
@@ -77,6 +78,12 @@ function createReader(ctx, targetKey, signal) {
|
|
|
77
78
|
const v = await ctx.ops.invokeRead(ctx.client, `${resource}.get`, ids, { fresh: true }, signal);
|
|
78
79
|
if (v === undefined)
|
|
79
80
|
throw new Cancelled();
|
|
81
|
+
if (key !== targetKey && ids.length === 2) {
|
|
82
|
+
const parent = await parentOf(resource);
|
|
83
|
+
if (parent !== undefined && asIdOrZero(ci(v, parent.field)) !== ids[0]) {
|
|
84
|
+
throw new AutotaskConfigError(`${resource}: the fresh record did not establish the requested ${parent.field} route locator`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
80
87
|
reads[key] = v;
|
|
81
88
|
hashed[key] = key === targetKey ? v : stableFacts(v);
|
|
82
89
|
return v;
|
|
@@ -85,13 +92,53 @@ function createReader(ctx, targetKey, signal) {
|
|
|
85
92
|
}
|
|
86
93
|
return request;
|
|
87
94
|
};
|
|
88
|
-
|
|
95
|
+
const locators = new Map();
|
|
96
|
+
// A nested reference may name its parent without that parent's own route locator.
|
|
89
97
|
const idsFor = async (resource, id, rec) => {
|
|
90
98
|
if (hasSimpleGet(resource, ctx))
|
|
91
99
|
return [id];
|
|
92
100
|
const parent = await parentOf(resource);
|
|
93
|
-
|
|
94
|
-
|
|
101
|
+
if (ctx.record(`${resource}.get`) === undefined || parent === undefined)
|
|
102
|
+
return undefined;
|
|
103
|
+
const pid = ci(rec, parent.field);
|
|
104
|
+
if (isRefId(pid, parent.resource))
|
|
105
|
+
return [pid, id];
|
|
106
|
+
if (ctx.record(`${resource}.query`)?.effect !== 'read')
|
|
107
|
+
return undefined;
|
|
108
|
+
const key = `${resource}:lookup:${id}`;
|
|
109
|
+
let lookup = locators.get(key);
|
|
110
|
+
if (lookup === undefined) {
|
|
111
|
+
lookup = (async () => {
|
|
112
|
+
let found;
|
|
113
|
+
try {
|
|
114
|
+
found = await ctx.ops.invokeRead(ctx.client, `${resource}.query`, [{ filter: [{ field: 'id', op: 'eq', value: id }], limit: 2, includeFields: ['id', parent.field], names: false }], undefined, signal);
|
|
115
|
+
}
|
|
116
|
+
catch (err) {
|
|
117
|
+
if (isNotFound(err))
|
|
118
|
+
return undefined;
|
|
119
|
+
throw err;
|
|
120
|
+
}
|
|
121
|
+
if (found === undefined)
|
|
122
|
+
throw new Cancelled();
|
|
123
|
+
if (found === null || typeof found !== 'object' || Array.isArray(found))
|
|
124
|
+
return undefined;
|
|
125
|
+
const page = found;
|
|
126
|
+
if (!Array.isArray(page.items) || page.items.length !== 1 || page.hasMore !== false || (page.truncated !== undefined && page.truncated !== false))
|
|
127
|
+
return undefined;
|
|
128
|
+
const row = page.items[0];
|
|
129
|
+
if (row === null || typeof row !== 'object' || Array.isArray(row) || ci(row, 'id') !== id)
|
|
130
|
+
return undefined;
|
|
131
|
+
const locator = ci(row, parent.field);
|
|
132
|
+
if (!isRefId(locator, parent.resource))
|
|
133
|
+
return undefined;
|
|
134
|
+
// Hash the declared field explicitly; not every parent field is in STABLE_FACT_KEYS.
|
|
135
|
+
hashed[key] = { id, [parent.field]: locator };
|
|
136
|
+
return locator;
|
|
137
|
+
})();
|
|
138
|
+
locators.set(key, lookup);
|
|
139
|
+
}
|
|
140
|
+
const locator = await lookup;
|
|
141
|
+
return locator === undefined ? undefined : [locator, id];
|
|
95
142
|
};
|
|
96
143
|
// The scope facts: the company of the record itself AND of every id reference it carries (its
|
|
97
144
|
// parent, ticketID, projectID, taskID, contractID), each read live. The union is what the scope
|
|
@@ -278,6 +325,13 @@ export async function takeSnapshot(ctx, record, parsed, duplicateFields, signal)
|
|
|
278
325
|
const r = createReader(ctx, targetKey, signal);
|
|
279
326
|
const { get, idsFor, anchor, reads, hashed, unresolved, companies } = r;
|
|
280
327
|
const { targets, data } = parsed;
|
|
328
|
+
const parent = targets.parentId === undefined ? undefined : await parentOf(record.resource);
|
|
329
|
+
if (writeShape(record) === 'create_child' && parent !== undefined && data !== undefined) {
|
|
330
|
+
const payloadParent = ci(data, parent.field);
|
|
331
|
+
if (payloadParent !== undefined && asIdOrZero(payloadParent) !== targets.parentId) {
|
|
332
|
+
return reason('INPUT_INVALID', `${record.id}: data.${parent.field} conflicts with the parentId route`, `data.${parent.field}`);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
281
335
|
if (duplicateFields !== undefined && data !== undefined) {
|
|
282
336
|
const missing = duplicateFields.filter((f) => ci(data, f) === undefined || ci(data, f) === null);
|
|
283
337
|
if (missing.length > 0)
|
|
@@ -309,6 +363,13 @@ export async function takeSnapshot(ctx, record, parsed, duplicateFields, signal)
|
|
|
309
363
|
return reason('INPUT_INVALID', `${record.resource} ${targets.id} does not exist`, 'args.0');
|
|
310
364
|
}
|
|
311
365
|
}
|
|
366
|
+
if (writeShape(record) === 'delete_child' && parent !== undefined) {
|
|
367
|
+
const targetParent = ci(current, parent.field);
|
|
368
|
+
if (!isRefId(targetParent, parent.resource))
|
|
369
|
+
return reason('TARGET_NOT_IN_SCOPE', `${record.id}: the target's ${parent.field} could not be established from the current record`);
|
|
370
|
+
if (targetParent !== targets.parentId)
|
|
371
|
+
return reason('INPUT_INVALID', `${record.id}: the target's ${parent.field} conflicts with the parentId route`, 'args.0');
|
|
372
|
+
}
|
|
312
373
|
await anchor(record.resource, current, 0, false);
|
|
313
374
|
}
|
|
314
375
|
if (targets.toId !== undefined) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iit-mcp-autotask",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.63.1",
|
|
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.71.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.
|
|
3
|
+
"version": "0.63.1",
|
|
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",
|
|
@@ -56,13 +56,13 @@
|
|
|
56
56
|
"records",
|
|
57
57
|
"finance"
|
|
58
58
|
],
|
|
59
|
-
"select": "AUTOTASK_TOOLSETS (
|
|
59
|
+
"select": "AUTOTASK_TOOLSETS (unset or all = every toolset; core = core only; or a comma list)",
|
|
60
60
|
"operator": "operator profile only: autotask_write, autotask_apply, autotask_apply_destructive"
|
|
61
61
|
},
|
|
62
62
|
"capabilitiesManifest": "capabilities.json",
|
|
63
63
|
"sdk": {
|
|
64
64
|
"package": "node-autotask",
|
|
65
|
-
"versionRange": "0.
|
|
65
|
+
"versionRange": "0.71.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"
|