iit-mcp-autotask 0.58.1 → 0.58.3
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 +8 -0
- package/dist/tools/context/client.js +2 -0
- package/dist/tools/context/scope.js +2 -0
- package/dist/tools/meta.js +12 -2
- package/dist/tools/read-runtime.d.ts +18 -0
- package/dist/tools/read-runtime.js +50 -0
- package/dist/tools/reasons.js +2 -0
- package/dist/tools/schemas.d.ts +3 -0
- package/dist/tools/schemas.js +1 -0
- package/package.json +4 -4
- package/server.json +2 -2
package/README.md
CHANGED
|
@@ -798,6 +798,14 @@ For token rotation, two hashes may name the same principal only with identical c
|
|
|
798
798
|
|
|
799
799
|
`autotask_read {operation:"time_entries.get", args:[id], projection:"time_entry_verification_v1"}` returns one forced-fresh read snapshot: scalar time-entry fields and versioned SHA256/code-point/UTF-8-byte metadata for `summaryNotes` and `internalNotes`. It never returns note bodies or changes the normal free-text caps. Hashes cover exact raw UTF-8, without whitespace, wrapper or line-ending normalisation; null and unavailable fields are distinct. Each note is bounded at 1 MiB; unsupported, missing, oversized or malformed data is never proof of equality. Callers must check the contract, fresh flag and entry/resource identity before comparing. Existing credentials and read policy still apply.
|
|
800
800
|
|
|
801
|
+
For consumers that reserve a vendor-call budget, `autotask_tenant_status` with
|
|
802
|
+
`parts:["server"]` exposes zero-vendor `server.readRuntime` proof of the actual client
|
|
803
|
+
retry/recovery bounds. Pass its `sha256` as `autotask_read.expectedReadRuntime` on
|
|
804
|
+
every read to refuse changed or unavailable bounds before dispatch. Validate the
|
|
805
|
+
contract, SDK/plan and supported bounds first; retain separate connection/auth pins.
|
|
806
|
+
See [the runtime proof contract](docs/read-runtime.md) for canonicalization, drift
|
|
807
|
+
semantics and typed refusals. The guard is optional for existing consumers.
|
|
808
|
+
|
|
801
809
|
For full bounded note display and protected-field evidence, opt in to `billing_review_entry_v1`:
|
|
802
810
|
|
|
803
811
|
```json
|
|
@@ -4,6 +4,7 @@ import { invokeDelete, invokeRead, invokeWrite, relationshipMap, resolveAny, sea
|
|
|
4
4
|
import { serverCredentialDefaults } from '../../config/load.js';
|
|
5
5
|
import { normalizeBaseUrl } from '../../base-hosts.js';
|
|
6
6
|
import { sdkCacheOptions } from '../catalog-data.js';
|
|
7
|
+
import { captureReadRuntime } from '../read-runtime.js';
|
|
7
8
|
// ---------------------------------------------------------------------------
|
|
8
9
|
// SDK client construction
|
|
9
10
|
// ---------------------------------------------------------------------------
|
|
@@ -101,6 +102,7 @@ export function buildStdioClient(config, log) {
|
|
|
101
102
|
...(defaults.impersonationResourceId !== undefined ? { impersonationResourceId: defaults.impersonationResourceId } : {}),
|
|
102
103
|
baseUrl: normalized.baseUrl,
|
|
103
104
|
});
|
|
105
|
+
captureReadRuntime(client);
|
|
104
106
|
return { client, origin: normalized.origin };
|
|
105
107
|
}
|
|
106
108
|
// ---------------------------------------------------------------------------
|
|
@@ -2,6 +2,7 @@ import { credentialShapeProblem } from 'node-autotask';
|
|
|
2
2
|
import { serverCredentialDefaults } from '../../config/load.js';
|
|
3
3
|
import { baseHostAllowed, normalizeBaseUrl } from '../../base-hosts.js';
|
|
4
4
|
import { CREDENTIAL_LOAD_HINT } from '../../credential.js';
|
|
5
|
+
import { captureReadRuntime } from '../read-runtime.js';
|
|
5
6
|
import { buildSdkBaseOptions, buildPlaceholderClient } from './client.js';
|
|
6
7
|
/**
|
|
7
8
|
* The five origin facts of one request, derived from the header origin and the deployment default. They are kept together on purpose:
|
|
@@ -173,6 +174,7 @@ export function createHttpScopeResolver(config, log, pool, baseOptions) {
|
|
|
173
174
|
// construction (HostPolicyDeniedError out of the per-request factory).
|
|
174
175
|
const poolConfig = poolConfigFor(creds, baseNormalized, defaultOrigin, baseOptions);
|
|
175
176
|
const client = pool.get(poolConfig);
|
|
177
|
+
captureReadRuntime(client);
|
|
176
178
|
return { client, origin: baseNormalized.origin, poolConfig };
|
|
177
179
|
},
|
|
178
180
|
};
|
package/dist/tools/meta.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { readRuntimeProof } from './read-runtime.js';
|
|
1
2
|
import { readBillingReview } from './billing-review-projection.js';
|
|
2
3
|
import { projectTimeEntryVerification } from './time-entry-verification.js';
|
|
3
4
|
/**
|
|
@@ -26,7 +27,7 @@ import { abortedAnswer, FIELD_CATALOG_MAX_BYTES, InputInvalidError, readOneItem,
|
|
|
26
27
|
import { zoneClock } from './clock.js';
|
|
27
28
|
import { typedErrorPayload } from './results/errors.js';
|
|
28
29
|
import { markResult, sanitiseVendorOutput } from './results/untrusted.js';
|
|
29
|
-
import { ok } from './results/envelope.js';
|
|
30
|
+
import { errorEnvelope, ok } from './results/envelope.js';
|
|
30
31
|
import { bm25Rank } from './rank.js';
|
|
31
32
|
import { playbooksFor } from './guide.js';
|
|
32
33
|
import { FIELD_INFO_EXPENSIVE, fieldLookupCall, udfCatalogCall } from './field-pointer.js';
|
|
@@ -602,6 +603,15 @@ export function buildRead(ctx) {
|
|
|
602
603
|
if ((args.operation === undefined) === (args.items === undefined)) {
|
|
603
604
|
throw new InputInvalidError('read: pass exactly one of operation (with args) or items', 'operation');
|
|
604
605
|
}
|
|
606
|
+
if (args.expectedReadRuntime !== undefined) {
|
|
607
|
+
const proof = readRuntimeProof(ctx.client);
|
|
608
|
+
if (proof.state !== 'available' || proof.sha256 !== args.expectedReadRuntime) {
|
|
609
|
+
return errorEnvelope({ error: true, code: proof.state === 'available' ? 'READ_RUNTIME_MISMATCH' : 'READ_RUNTIME_UNAVAILABLE',
|
|
610
|
+
category: 'policy', retryable: false, notSent: true,
|
|
611
|
+
message: 'Read runtime proof changed or is unavailable; obtain and validate current server.readRuntime before reading.',
|
|
612
|
+
correlationId: ctx.correlationId }, ctx.correlationId);
|
|
613
|
+
}
|
|
614
|
+
}
|
|
605
615
|
if (args.projection === 'billing_review_entry_v1')
|
|
606
616
|
return readBillingReview(ctx, args, signal);
|
|
607
617
|
if (args.projection !== undefined && args.projection !== 'default') {
|
|
@@ -679,7 +689,7 @@ export function buildTenantStatus(ctx) {
|
|
|
679
689
|
for (const part of parts) {
|
|
680
690
|
// Zero wire: this package's version (the same constant as serverInfo and /metadata), kept apart from the vendor `version` part.
|
|
681
691
|
if (part === 'server') {
|
|
682
|
-
data.server = { name: SERVER_NAME, version: SERVER_VERSION, sdkVersion: SDK_VERSION, profile: ctx.config.AUTOTASK_PROFILE };
|
|
692
|
+
data.server = { name: SERVER_NAME, version: SERVER_VERSION, sdkVersion: SDK_VERSION, profile: ctx.config.AUTOTASK_PROFILE, readRuntime: readRuntimeProof(ctx.client) };
|
|
683
693
|
continue;
|
|
684
694
|
}
|
|
685
695
|
// Zero wire: the users' zone (AUTOTASK_USER_TIMEZONE) and its clock (#171), so a client need not guess today's date or zone.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ToolClient } from './context/types.js';
|
|
2
|
+
export declare const READ_RUNTIME_CONTRACT = "autotask-read-runtime-v1";
|
|
3
|
+
/** Call synchronously at client construction/resolution, never replace an earlier capture. */
|
|
4
|
+
export declare function captureReadRuntime(client: ToolClient): void;
|
|
5
|
+
/** SDK 0.60 copies these scalars into HttpClient at construction; public config drift cannot re-attest it. */
|
|
6
|
+
export declare function readRuntimeProof(client: ToolClient): {
|
|
7
|
+
state: "unavailable";
|
|
8
|
+
contract: string;
|
|
9
|
+
} | {
|
|
10
|
+
sha256: string;
|
|
11
|
+
contract: string;
|
|
12
|
+
maintenanceMaxWaitMs: number;
|
|
13
|
+
maxRetries: number;
|
|
14
|
+
planHash: string;
|
|
15
|
+
reResolveZoneOn401: boolean;
|
|
16
|
+
sdkVersion: string;
|
|
17
|
+
state: "available";
|
|
18
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { BUILT_AGAINST_PLAN_HASH, SDK_VERSION } from './catalog-data.js';
|
|
3
|
+
export const READ_RUNTIME_CONTRACT = 'autotask-read-runtime-v1';
|
|
4
|
+
const KEYS = ['maintenanceMaxWaitMs', 'maxRetries', 'reResolveZoneOn401'];
|
|
5
|
+
// Construction facts only, never vendor data or a response cache; pool eviction releases these too.
|
|
6
|
+
const captures = new WeakMap();
|
|
7
|
+
function configOf(client) {
|
|
8
|
+
const value = Object.getOwnPropertyDescriptor(client, 'config')?.value;
|
|
9
|
+
return value !== null && typeof value === 'object' ? value : undefined;
|
|
10
|
+
}
|
|
11
|
+
function boundsOf(config) {
|
|
12
|
+
const maintenanceMaxWaitMs = Object.getOwnPropertyDescriptor(config, 'maintenanceMaxWaitMs')?.value;
|
|
13
|
+
const maxRetries = Object.getOwnPropertyDescriptor(config, 'maxRetries')?.value;
|
|
14
|
+
const reResolveZoneOn401 = Object.getOwnPropertyDescriptor(config, 'reResolveZoneOn401')?.value;
|
|
15
|
+
if (typeof maxRetries !== 'number' || !Number.isSafeInteger(maxRetries) || maxRetries < 0 ||
|
|
16
|
+
typeof maintenanceMaxWaitMs !== 'number' || !Number.isSafeInteger(maintenanceMaxWaitMs) || maintenanceMaxWaitMs < 0 ||
|
|
17
|
+
typeof reResolveZoneOn401 !== 'boolean')
|
|
18
|
+
return undefined;
|
|
19
|
+
return { maintenanceMaxWaitMs, maxRetries, reResolveZoneOn401 };
|
|
20
|
+
}
|
|
21
|
+
/** Call synchronously at client construction/resolution, never replace an earlier capture. */
|
|
22
|
+
export function captureReadRuntime(client) {
|
|
23
|
+
if (captures.has(client))
|
|
24
|
+
return;
|
|
25
|
+
const config = configOf(client);
|
|
26
|
+
const bounds = config === undefined ? undefined : boundsOf(config);
|
|
27
|
+
captures.set(client, config !== undefined && bounds !== undefined ? { config, bounds } : null);
|
|
28
|
+
}
|
|
29
|
+
/** SDK 0.60 copies these scalars into HttpClient at construction; public config drift cannot re-attest it. */
|
|
30
|
+
export function readRuntimeProof(client) {
|
|
31
|
+
const unavailable = { state: 'unavailable', contract: READ_RUNTIME_CONTRACT };
|
|
32
|
+
const capture = captures.get(client);
|
|
33
|
+
const config = configOf(client);
|
|
34
|
+
if (capture == null || config !== capture.config)
|
|
35
|
+
return unavailable;
|
|
36
|
+
const bounds = boundsOf(config);
|
|
37
|
+
if (bounds === undefined || KEYS.some(key => bounds[key] !== capture.bounds[key]))
|
|
38
|
+
return unavailable;
|
|
39
|
+
// Canonical UTF-8 JSON: these exact keys in alphabetical order, no whitespace, no other config.
|
|
40
|
+
const descriptor = {
|
|
41
|
+
contract: READ_RUNTIME_CONTRACT,
|
|
42
|
+
maintenanceMaxWaitMs: bounds.maintenanceMaxWaitMs,
|
|
43
|
+
maxRetries: bounds.maxRetries,
|
|
44
|
+
planHash: BUILT_AGAINST_PLAN_HASH,
|
|
45
|
+
reResolveZoneOn401: bounds.reResolveZoneOn401,
|
|
46
|
+
sdkVersion: SDK_VERSION,
|
|
47
|
+
};
|
|
48
|
+
return { state: 'available', ...descriptor, sha256: createHash('sha256').update(JSON.stringify(descriptor), 'utf8').digest('hex') };
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=read-runtime.js.map
|
package/dist/tools/reasons.js
CHANGED
|
@@ -64,6 +64,8 @@ const SDK_NEXT = new Set(['supply_input', 'retry', 'stop', 'choose_candidate']);
|
|
|
64
64
|
/** The reason code per error code where the code alone decides it (the rest go by category). */
|
|
65
65
|
const REASON_BY_CODE = {
|
|
66
66
|
POLICY_DENIED: 'POLICY_DENIED',
|
|
67
|
+
READ_RUNTIME_MISMATCH: 'POLICY_DENIED',
|
|
68
|
+
READ_RUNTIME_UNAVAILABLE: 'POLICY_DENIED',
|
|
67
69
|
HOST_POLICY_DENIED: 'HOST_POLICY_DENIED',
|
|
68
70
|
CREDENTIAL_MISSING: 'CREDENTIAL_MISSING',
|
|
69
71
|
CREDENTIAL_MALFORMED: 'CREDENTIAL_MALFORMED',
|
package/dist/tools/schemas.d.ts
CHANGED
|
@@ -209,6 +209,7 @@ export declare const READ_INPUT: z.ZodPipe<z.ZodObject<{
|
|
|
209
209
|
time_entry_verification_v1: "time_entry_verification_v1";
|
|
210
210
|
billing_review_entry_v1: "billing_review_entry_v1";
|
|
211
211
|
}>>, unknown>;
|
|
212
|
+
expectedReadRuntime: z.ZodOptional<z.ZodString>;
|
|
212
213
|
}, z.core.$strip>, z.ZodTransform<{
|
|
213
214
|
args: unknown[];
|
|
214
215
|
operation?: string | undefined;
|
|
@@ -217,6 +218,7 @@ export declare const READ_INPUT: z.ZodPipe<z.ZodObject<{
|
|
|
217
218
|
args: unknown[];
|
|
218
219
|
}[] | undefined;
|
|
219
220
|
projection?: "default" | "time_entry_verification_v1" | "billing_review_entry_v1" | undefined;
|
|
221
|
+
expectedReadRuntime?: string | undefined;
|
|
220
222
|
}, {
|
|
221
223
|
args: unknown[];
|
|
222
224
|
operation?: string | undefined;
|
|
@@ -225,6 +227,7 @@ export declare const READ_INPUT: z.ZodPipe<z.ZodObject<{
|
|
|
225
227
|
args: unknown[];
|
|
226
228
|
}[] | undefined;
|
|
227
229
|
projection?: "default" | "time_entry_verification_v1" | "billing_review_entry_v1" | undefined;
|
|
230
|
+
expectedReadRuntime?: string | undefined;
|
|
228
231
|
}>>;
|
|
229
232
|
export declare const RESOLVE_INPUT: z.ZodObject<{
|
|
230
233
|
identifier: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
package/dist/tools/schemas.js
CHANGED
|
@@ -239,6 +239,7 @@ export const READ_INPUT = z.object({
|
|
|
239
239
|
args: unset(ARGS),
|
|
240
240
|
items: unset(z.array(READ_ITEM).min(1).max(READ_MAX_ITEMS).optional()).describe('Batch reads in one call, each { operation, args }; use instead of operation.'),
|
|
241
241
|
projection: unset(z.enum(['default', 'time_entry_verification_v1', 'billing_review_entry_v1']).optional()).describe('default: normal read. time_entry_verification_v1: fresh metadata-only get. billing_review_entry_v1: fresh ticket-entry get or bounded query (limit<=25, no includeFields); full bounded display notes and raw hashes.'),
|
|
242
|
+
expectedReadRuntime: z.string().regex(/^[a-f0-9]{64}$/).optional().describe('Require server.readRuntime.sha256 from autotask_tenant_status; changed or unavailable runtime refuses before any vendor dispatch.'),
|
|
242
243
|
}).transform(v => v.projection === 'billing_review_entry_v1' ? v : numericQueryBag(v));
|
|
243
244
|
export const RESOLVE_INPUT = z.object({
|
|
244
245
|
identifier: z.union([z.number().int().nonnegative(), z.string().min(1).max(200)]).describe('Numeric id, name, ticket number, serial or email. resources: numeric identifiers are looked up as Resource ids.'),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iit-mcp-autotask",
|
|
3
|
-
"version": "0.58.
|
|
3
|
+
"version": "0.58.3",
|
|
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.60.
|
|
57
|
+
"node-autotask": "0.60.1",
|
|
58
58
|
"zod": "^4.6.7"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
@@ -62,10 +62,10 @@
|
|
|
62
62
|
"@types/node": "^24.19.1",
|
|
63
63
|
"eslint": "^10.14.0",
|
|
64
64
|
"globals": "^17.14.0",
|
|
65
|
-
"rimraf": "^6.
|
|
65
|
+
"rimraf": "^6.1.4",
|
|
66
66
|
"tsx": "^4.19.0",
|
|
67
67
|
"typescript": "^6.0.3",
|
|
68
68
|
"typescript-eslint": "^8.72.1",
|
|
69
|
-
"vitest": "^5.0
|
|
69
|
+
"vitest": "^5.1.0"
|
|
70
70
|
}
|
|
71
71
|
}
|
package/server.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iit-mcp-autotask",
|
|
3
|
-
"version": "0.58.
|
|
3
|
+
"version": "0.58.3",
|
|
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.60.
|
|
65
|
+
"versionRange": "0.60.1"
|
|
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 uses the credential on the apply request"
|