iit-mcp-autotask 0.58.2 → 0.58.4
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 -1
- package/dist/access/write-env.d.ts +2 -0
- package/dist/access/write-env.js +10 -0
- package/dist/http-guard.d.ts +1 -0
- package/dist/http-guard.js +4 -0
- package/dist/policy.js +1 -1
- package/dist/tools/server.js +3 -1
- package/dist/tools/write/preview.js +1 -1
- package/dist/write/evaluate.js +1 -1
- package/package.json +4 -4
- package/server.json +2 -2
package/README.md
CHANGED
|
@@ -405,6 +405,13 @@ its own tool list; a missing or unknown token is 401; each principal gets
|
|
|
405
405
|
static bearer map does not implement the MCP authorization spec's RFC 9728 metadata (deviation
|
|
406
406
|
D-14). For an operator deployment use a separate Autotask API user from the read deployments.
|
|
407
407
|
|
|
408
|
+
An optional token field `"writeOperations": ["time_entries.updateReviewFields", "ticket_notes.create"]`
|
|
409
|
+
restricts that token to these exact served write keys, intersected with `AUTOTASK_WRITE`. It cannot
|
|
410
|
+
grant globally denied operations or upgrade a readonly profile. Omit it to preserve existing authority;
|
|
411
|
+
`[]` denies all writes. Wildcards, unknown/read operations and duplicates refuse boot. Catalog, describe,
|
|
412
|
+
preview and apply share this restriction; changing it invalidates pending plans. Successful historical
|
|
413
|
+
replays only return their recorded result. These limits do not change read access or company scope.
|
|
414
|
+
|
|
408
415
|
### Local (stdio)
|
|
409
416
|
|
|
410
417
|
Needs Node 24+ and your Autotask zone origin. The CLI defaults to `http`, so local clients pass
|
|
@@ -792,7 +799,7 @@ See [docs/architecture.md](docs/architecture.md) section 5 for intentional omiss
|
|
|
792
799
|
|
|
793
800
|
Authenticated `GET /configuration/autotask` returns versioned named zone choices filtered by the deployment host policy. `POST /configuration/autotask/resolve-zone` accepts `{ "username": "api-user@example.com" }`, calls the fixed Autotask ZoneInformation endpoint without credentials, and returns an allowed HTTPS zone origin/label. Discovery follows no redirects; errors return safe codes. Both routes use the normal Host/Origin, bearer and rate-limit guard. Health/readiness remain zero-wire. The zone catalogue follows the vendor REST zone table; custom zones still require existing host-policy approval.
|
|
794
801
|
|
|
795
|
-
For token rotation, two hashes may name the same principal only with identical complete token entries (profile, toolsets and
|
|
802
|
+
For token rotation, two hashes may name the same principal only with identical complete token entries (profile, toolsets, run scope and write operations; write-operation list order is immaterial). Install both hashes, restart to load them, switch the client secret, verify and remove the old hash after an overlap. Different authorities under one principal still fail boot. Secrets are never part of discovery metadata.
|
|
796
803
|
|
|
797
804
|
### Complete time-entry note verification
|
|
798
805
|
|
|
@@ -24,6 +24,8 @@ export interface LoadedPolicy {
|
|
|
24
24
|
transport: Transport;
|
|
25
25
|
warnings: string[];
|
|
26
26
|
}
|
|
27
|
+
/** Token restrictions only narrow global policy; omitted preserves legacy plans byte-for-byte. */
|
|
28
|
+
export declare function restrictWritePolicy(loaded: LoadedPolicy, operations?: readonly string[]): LoadedPolicy;
|
|
27
29
|
/** The hard rule an op hits whatever its payload (`always`), or the move escalation it may hit (`move`). */
|
|
28
30
|
export declare function hardRuleOf(key: string): 'always' | 'move' | undefined;
|
|
29
31
|
/** `transport` defaults to stdio for the unit tests; every boot caller passes MCP_TRANSPORT. */
|
package/dist/access/write-env.js
CHANGED
|
@@ -9,6 +9,16 @@ import { ConfigError } from '../config/schema.js';
|
|
|
9
9
|
import { hashOf } from '../write/canonical.js';
|
|
10
10
|
import { hardRuleFor, MOVE_OPS, writeShape } from '../write/hard-rules.js';
|
|
11
11
|
import { RECORDS, recordById } from '../tools/catalog-data.js';
|
|
12
|
+
/** Token restrictions only narrow global policy; omitted preserves legacy plans byte-for-byte. */
|
|
13
|
+
export function restrictWritePolicy(loaded, operations) {
|
|
14
|
+
if (operations === undefined)
|
|
15
|
+
return loaded;
|
|
16
|
+
const allowed = new Set(operations);
|
|
17
|
+
return { ...loaded,
|
|
18
|
+
table: new Map([...loaded.table].filter(([operation]) => allowed.has(operation))),
|
|
19
|
+
policyHash: hashOf({ basePolicyHash: loaded.policyHash, writeOperations: [...allowed].sort() }),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
12
22
|
const MODES = ['allow', 'deny', 'confirm', 'unattended'];
|
|
13
23
|
const SERVER_GATED = ['confirm', 'unattended'];
|
|
14
24
|
const FAMILY = /^[a-z][a-z0-9_]*\.\*$/;
|
package/dist/http-guard.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ declare const TOKEN_ENTRY: z.ZodObject<{
|
|
|
21
21
|
}, z.core.$strict>, z.ZodObject<{
|
|
22
22
|
companyIds: z.ZodArray<z.ZodNumber>;
|
|
23
23
|
}, z.core.$strict>]>>;
|
|
24
|
+
writeOperations: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>>;
|
|
24
25
|
}, z.core.$strict>;
|
|
25
26
|
export type TokenEntry = z.infer<typeof TOKEN_ENTRY>;
|
|
26
27
|
/** The loaded tokens file: entries by their SHA-256 key (the token itself is never held). */
|
package/dist/http-guard.js
CHANGED
|
@@ -20,6 +20,8 @@ import { readFileSync } from 'node:fs';
|
|
|
20
20
|
import { hostHeaderValidationResponse, localhostAllowedHostnames, localhostAllowedOrigins, originValidationResponse, } from '@modelcontextprotocol/server';
|
|
21
21
|
import * as z from 'zod';
|
|
22
22
|
import { ConfigError, PROFILES, TOOLSETS, RUN_SCOPE, isLoopbackHost } from './config/schema.js';
|
|
23
|
+
import { recordById } from './tools/catalog-data.js';
|
|
24
|
+
import { hardRuleFor } from './write/hard-rules.js';
|
|
23
25
|
/** The request body cap on the HTTP transport (M10). */
|
|
24
26
|
export const MAX_BODY_BYTES = 1024 * 1024;
|
|
25
27
|
/**
|
|
@@ -33,6 +35,8 @@ const TOKEN_ENTRY = z
|
|
|
33
35
|
profile: z.enum(PROFILES),
|
|
34
36
|
toolsets: z.array(z.enum([...TOOLSETS, 'all'])).optional(),
|
|
35
37
|
runScope: RUN_SCOPE.optional(),
|
|
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
|
+
.transform((operations) => [...operations].sort()).optional(),
|
|
36
40
|
})
|
|
37
41
|
.strict();
|
|
38
42
|
const TOKENS_FILE = z.record(z.string().regex(/^[0-9a-f]{64}$/, 'keys are the lowercase hex SHA-256 of a token'), TOKEN_ENTRY);
|
package/dist/policy.js
CHANGED
|
@@ -45,7 +45,7 @@ export function refusalReason(operation, record, config, writable = new Set()) {
|
|
|
45
45
|
return null;
|
|
46
46
|
if (config.AUTOTASK_PROFILE !== 'operator')
|
|
47
47
|
return 'refused: profile readonly serves reads only';
|
|
48
|
-
return writable.has(operation) ? null : 'refused: not
|
|
48
|
+
return writable.has(operation) ? null : 'refused: not admitted by the effective write policy (unlisted writes are read-only)';
|
|
49
49
|
}
|
|
50
50
|
/** The `POLICY_DENIED` error: deployment policy is fixed for the life of the process, so the
|
|
51
51
|
* model is told no argument it can choose will satisfy the gate (a `CONFIG_ERROR` here would
|
package/dist/tools/server.js
CHANGED
|
@@ -32,6 +32,7 @@ import { FILTER_OPS } from './schemas.js';
|
|
|
32
32
|
import { UNSCOPED_WALK_THRESHOLD } from 'node-autotask';
|
|
33
33
|
import { registerTools } from './register.js';
|
|
34
34
|
import { configForToken } from '../http-guard.js';
|
|
35
|
+
import { restrictWritePolicy } from '../access/write-env.js';
|
|
35
36
|
/** The wire identity of this server (the initialize answer + the `/metadata` payload). */
|
|
36
37
|
import { SERVER_NAME, SERVER_VERSION } from './server-version.js';
|
|
37
38
|
export { SERVER_NAME, SERVER_VERSION };
|
|
@@ -154,7 +155,8 @@ export function createMcpServerFactory(config, log, options = {}) {
|
|
|
154
155
|
...(requestConfig.AUTOTASK_PROFILE === 'operator' && write !== undefined
|
|
155
156
|
? {
|
|
156
157
|
write: {
|
|
157
|
-
runtime: write
|
|
158
|
+
runtime: entry?.writeOperations === undefined ? write
|
|
159
|
+
: { ...write, loaded: restrictWritePolicy(write.loaded, entry.writeOperations) },
|
|
158
160
|
principal: identity !== undefined ? identity.principal : (entry?.principal ?? config.AUTOTASK_PRINCIPAL),
|
|
159
161
|
runScope: tokens === undefined ? config.AUTOTASK_RUN_SCOPE : entry?.runScope,
|
|
160
162
|
...(identity?.clientId !== undefined ? { clientId: identity.clientId } : {}),
|
|
@@ -242,7 +242,7 @@ async function execute(ctx, args, signal) {
|
|
|
242
242
|
const hard = hardRuleFor(op, found);
|
|
243
243
|
const rule = loaded.table.get(op);
|
|
244
244
|
if (hard.never !== undefined || rule === undefined || rule.mode === 'deny') {
|
|
245
|
-
const why = hard.never !== undefined ? `${op}: ${hard.never}` : rule === undefined ? `${op} is not
|
|
245
|
+
const why = hard.never !== undefined ? `${op}: ${hard.never}` : rule === undefined ? `${op} is not admitted by the effective write policy (unlisted writes are read-only)` : `AUTOTASK_WRITE denies ${op}`;
|
|
246
246
|
const rs = [reason('OP_NOT_ALLOWED', why)];
|
|
247
247
|
audit('denied', rs);
|
|
248
248
|
return answer('denied', 'stop', rs, { operation: op });
|
package/dist/write/evaluate.js
CHANGED
|
@@ -53,7 +53,7 @@ export function evaluate(loaded, facts, runScope, counters) {
|
|
|
53
53
|
return deny('OP_NOT_ALLOWED', `${facts.op}: ${hard.never}`, []);
|
|
54
54
|
const row = loaded.table.get(facts.op);
|
|
55
55
|
if (row === undefined)
|
|
56
|
-
return deny('OP_NOT_ALLOWED', `${facts.op} is not
|
|
56
|
+
return deny('OP_NOT_ALLOWED', `${facts.op} is not admitted by the effective write policy (unlisted writes are read-only)`, hard.hazards);
|
|
57
57
|
if (row.mode === 'deny')
|
|
58
58
|
return deny('OP_NOT_ALLOWED', `AUTOTASK_WRITE denies ${facts.op}`, hard.hazards);
|
|
59
59
|
if (runScope === undefined)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iit-mcp-autotask",
|
|
3
|
-
"version": "0.58.
|
|
3
|
+
"version": "0.58.4",
|
|
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.4",
|
|
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"
|