iit-mcp-autotask 0.59.3 → 0.59.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/dist/tools/write/preview.js +7 -1
- package/dist/write/evaluate.d.ts +7 -0
- package/dist/write/evaluate.js +17 -0
- package/package.json +4 -4
- package/server.json +2 -2
|
@@ -6,7 +6,7 @@ import { cleanUntrustedText, markResult } from '../results/untrusted.js';
|
|
|
6
6
|
import { assertOperationPermitted } from '../../policy.js';
|
|
7
7
|
import { WRITE_INPUT, closedInput } from '../schemas.js';
|
|
8
8
|
import { planHashOf } from '../../write/canonical.js';
|
|
9
|
-
import { dedupFor, evaluate, pinAudit } from '../../write/evaluate.js';
|
|
9
|
+
import { accountWideScopeReason, dedupFor, evaluate, pinAudit } from '../../write/evaluate.js';
|
|
10
10
|
import { hardRuleFor, writeShape } from '../../write/hard-rules.js';
|
|
11
11
|
import { PLAN_TTL_MS } from '../../write/store.js';
|
|
12
12
|
import { Cancelled, writeDeps, tenantIdentity, answer, reason } from './common.js';
|
|
@@ -253,6 +253,12 @@ async function execute(ctx, args, signal) {
|
|
|
253
253
|
if ('code' in parsed)
|
|
254
254
|
return answer('error', 'supply_input', [parsed], { operation: op });
|
|
255
255
|
const a = { record, shape, parsed, rule };
|
|
256
|
+
// #377: an account-wide record belongs to no company; refuse it under a company run scope before any live read
|
|
257
|
+
const accountWide = accountWideScopeReason(op, hard.hazards, w.runScope);
|
|
258
|
+
if (accountWide !== undefined) {
|
|
259
|
+
audit('deny', [accountWide], undefined, parsed.targets);
|
|
260
|
+
return answer('denied', 'stop', [accountWide], { operation: op, targets: parsed.targets });
|
|
261
|
+
}
|
|
256
262
|
let snap;
|
|
257
263
|
try {
|
|
258
264
|
snap = await takeSnapshot(ctx, record, parsed, dedupFor(loaded, op), signal);
|
package/dist/write/evaluate.d.ts
CHANGED
|
@@ -74,4 +74,11 @@ export interface Decision {
|
|
|
74
74
|
export declare function dedupFor(loaded: LoadedPolicy, op: string): readonly string[] | undefined;
|
|
75
75
|
/** Strict match of a payload's submitterID to the pin: an integer, or a canonical digit string (no padding, sign, point, list or container). */
|
|
76
76
|
export declare function matchesPin(submitter: unknown, pin: number): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Issue #377: an account-wide operation (hazard `account_wide`, the SDK's `metadata.accountWide`: tenant
|
|
79
|
+
* configuration such as UDF definitions and their list items) writes a record that belongs to no company, so
|
|
80
|
+
* a company run scope can never admit it, whatever the payload or parent. Refused up front with a reason that
|
|
81
|
+
* says so, before any live read (preview) and on every re-evaluation (apply); `{all: true}` keeps the normal path.
|
|
82
|
+
*/
|
|
83
|
+
export declare function accountWideScopeReason(op: string, hazards: readonly Hazard[], runScope: RunScope | undefined): Reason | undefined;
|
|
77
84
|
export declare function evaluate(loaded: LoadedPolicy, facts: WriteFacts, runScope: RunScope | undefined, counters: Counters): Decision;
|
package/dist/write/evaluate.js
CHANGED
|
@@ -41,6 +41,20 @@ export function matchesPin(submitter, pin) {
|
|
|
41
41
|
function pinAdmits(loaded, facts) {
|
|
42
42
|
return facts.op === PIN_OP && loaded.expensePin !== undefined && facts.pin !== undefined && facts.pin.extraFields.length === 0 && matchesPin(facts.pin.submitter, loaded.expensePin);
|
|
43
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Issue #377: an account-wide operation (hazard `account_wide`, the SDK's `metadata.accountWide`: tenant
|
|
46
|
+
* configuration such as UDF definitions and their list items) writes a record that belongs to no company, so
|
|
47
|
+
* a company run scope can never admit it, whatever the payload or parent. Refused up front with a reason that
|
|
48
|
+
* says so, before any live read (preview) and on every re-evaluation (apply); `{all: true}` keeps the normal path.
|
|
49
|
+
*/
|
|
50
|
+
export function accountWideScopeReason(op, hazards, runScope) {
|
|
51
|
+
if (runScope === undefined || !('companyIds' in runScope) || !hazards.includes('account_wide'))
|
|
52
|
+
return undefined;
|
|
53
|
+
return {
|
|
54
|
+
code: 'TARGET_NOT_IN_SCOPE',
|
|
55
|
+
detail: `${op} is account-wide (tenant configuration that belongs to no company), so a company run scope never admits it; only a run scope of {"all":true} does`,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
44
58
|
/** Every company the write touches must be in the run scope; a write with no company passes only `{all: true}`. */
|
|
45
59
|
function inScope(facts, runScope) {
|
|
46
60
|
if (!('companyIds' in runScope))
|
|
@@ -58,6 +72,9 @@ export function evaluate(loaded, facts, runScope, counters) {
|
|
|
58
72
|
return deny('OP_NOT_ALLOWED', `AUTOTASK_WRITE denies ${facts.op}`, hard.hazards);
|
|
59
73
|
if (runScope === undefined)
|
|
60
74
|
return deny('TARGET_NOT_IN_SCOPE', 'this principal has no run scope', hard.hazards);
|
|
75
|
+
const accountWide = accountWideScopeReason(facts.op, hard.hazards, runScope);
|
|
76
|
+
if (accountWide !== undefined)
|
|
77
|
+
return { decision: 'deny', reasons: [accountWide], hazards: hard.hazards };
|
|
61
78
|
let pinned = false;
|
|
62
79
|
if (!inScope(facts, runScope)) {
|
|
63
80
|
// The pin only ever replaces a missing company: an anchored payload (companyIds non-empty) keeps the normal path.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iit-mcp-autotask",
|
|
3
|
-
"version": "0.59.
|
|
3
|
+
"version": "0.59.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,18 +54,18 @@
|
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@modelcontextprotocol/server": "^2.2.0",
|
|
57
|
-
"node-autotask": "0.64.
|
|
57
|
+
"node-autotask": "0.64.1",
|
|
58
58
|
"zod": "^4.6.7"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@eslint/js": "^10.0.1",
|
|
62
62
|
"@types/node": "^24.19.1",
|
|
63
|
-
"eslint": "^10.
|
|
63
|
+
"eslint": "^10.15.0",
|
|
64
64
|
"globals": "^17.14.0",
|
|
65
65
|
"rimraf": "^6.1.4",
|
|
66
66
|
"tsx": "^4.19.0",
|
|
67
67
|
"typescript": "^6.0.3",
|
|
68
|
-
"typescript-eslint": "^8.72.
|
|
68
|
+
"typescript-eslint": "^8.72.2",
|
|
69
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.59.
|
|
3
|
+
"version": "0.59.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.64.
|
|
65
|
+
"versionRange": "0.64.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"
|