@onlyflows/servicenow-mcp 2.0.0 → 2.2.0-dev.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/CHANGELOG.md +85 -1
- package/README.md +5 -4
- package/dist/atf-config.d.ts +72 -0
- package/dist/atf-config.d.ts.map +1 -0
- package/dist/atf-config.js +179 -0
- package/dist/atf-config.js.map +1 -0
- package/dist/atf-policy.d.ts +46 -0
- package/dist/atf-policy.d.ts.map +1 -0
- package/dist/atf-policy.js +83 -0
- package/dist/atf-policy.js.map +1 -0
- package/dist/atf-result-cache.d.ts +104 -0
- package/dist/atf-result-cache.d.ts.map +1 -0
- package/dist/atf-result-cache.js +260 -0
- package/dist/atf-result-cache.js.map +1 -0
- package/dist/config.d.ts +8 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +15 -0
- package/dist/config.js.map +1 -1
- package/dist/execution-context.d.ts +7 -3
- package/dist/execution-context.d.ts.map +1 -1
- package/dist/execution-context.js +8 -2
- package/dist/execution-context.js.map +1 -1
- package/dist/field-policy.d.ts.map +1 -1
- package/dist/field-policy.js +42 -0
- package/dist/field-policy.js.map +1 -1
- package/dist/http-entrypoint.d.ts.map +1 -1
- package/dist/http-entrypoint.js +3 -0
- package/dist/http-entrypoint.js.map +1 -1
- package/dist/http-observability.js +10 -1
- package/dist/http-observability.js.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/profile-manager.d.ts +12 -0
- package/dist/profile-manager.d.ts.map +1 -1
- package/dist/profile-manager.js +30 -3
- package/dist/profile-manager.js.map +1 -1
- package/dist/setup-prompts.js +1 -1
- package/dist/setup-prompts.js.map +1 -1
- package/dist/setup.d.ts.map +1 -1
- package/dist/setup.js +11 -4
- package/dist/setup.js.map +1 -1
- package/dist/tools/atf-author-module.d.ts +35 -0
- package/dist/tools/atf-author-module.d.ts.map +1 -0
- package/dist/tools/atf-author-module.js +125 -0
- package/dist/tools/atf-author-module.js.map +1 -0
- package/dist/tools/atf.d.ts +2 -2
- package/dist/tools/catalog.d.ts +2 -2
- package/dist/tools/catalog.d.ts.map +1 -1
- package/dist/tools/catalog.js +2 -0
- package/dist/tools/catalog.js.map +1 -1
- package/dist/tools/create-module.d.ts.map +1 -1
- package/dist/tools/create-module.js +23 -19
- package/dist/tools/create-module.js.map +1 -1
- package/dist/tools/index.d.ts +3 -3
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +44 -9
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/markdown.d.ts +77 -0
- package/dist/tools/markdown.d.ts.map +1 -0
- package/dist/tools/markdown.js +279 -0
- package/dist/tools/markdown.js.map +1 -0
- package/dist/tools/nl.d.ts +2 -2
- package/dist/tools/record-write-shared.d.ts +7 -0
- package/dist/tools/record-write-shared.d.ts.map +1 -0
- package/dist/tools/{incident-write-shared.js → record-write-shared.js} +9 -8
- package/dist/tools/record-write-shared.js.map +1 -0
- package/dist/tools/result-envelope.d.ts +94 -16
- package/dist/tools/result-envelope.d.ts.map +1 -1
- package/dist/tools/result-envelope.js +92 -3
- package/dist/tools/result-envelope.js.map +1 -1
- package/dist/tools/tool-module.d.ts +11 -3
- package/dist/tools/tool-module.d.ts.map +1 -1
- package/dist/tools/tool-module.js +1 -0
- package/dist/tools/tool-module.js.map +1 -1
- package/dist/tools/update-module.d.ts.map +1 -1
- package/dist/tools/update-module.js +21 -17
- package/dist/tools/update-module.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/write-value-policy.d.ts +56 -0
- package/dist/write-value-policy.d.ts.map +1 -0
- package/dist/write-value-policy.js +310 -0
- package/dist/write-value-policy.js.map +1 -0
- package/docs/CLIENT-SETUP.md +2 -2
- package/docs/CONTAINER-DEPLOYMENT.md +11 -0
- package/docs/CROSS-CLIENT-RELEASE-MATRIX.md +1 -1
- package/docs/PROFILE-CREDENTIALS.md +63 -0
- package/docs/RELEASE-VALIDATION.md +29 -2
- package/docs/TESTING-OAUTH.md +1 -1
- package/package.json +2 -2
- package/scripts/release-validate.mjs +14 -4
- package/dist/incident-write-policy.d.ts +0 -20
- package/dist/incident-write-policy.d.ts.map +0 -1
- package/dist/incident-write-policy.js +0 -196
- package/dist/incident-write-policy.js.map +0 -1
- package/dist/tools/incident-write-shared.d.ts +0 -6
- package/dist/tools/incident-write-shared.d.ts.map +0 -1
- package/dist/tools/incident-write-shared.js.map +0 -1
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Bounded, code-owned value policy for generic creates and updates.
|
|
4
|
+
*
|
|
5
|
+
* Which tables may be written is decided entirely by the configured
|
|
6
|
+
* `tableAccess` and field policies -- this module never gates on table
|
|
7
|
+
* identity. It only bounds the *values* a write may carry, so a grant the
|
|
8
|
+
* operator issued is the grant that takes effect. The `incident` table keeps
|
|
9
|
+
* a strict typed value map because its ordinary fields are a known, closed
|
|
10
|
+
* set; every other table gets generic bounds.
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.WriteValuePolicyError = exports.GENERIC_WRITE_VALUE_MAX_UTF8_BYTES = exports.GENERIC_WRITE_VALUE_MAX_CHARACTERS = exports.INCIDENT_CHOICE_MAX_UTF8_BYTES = exports.INCIDENT_CHOICE_MAX_CHARACTERS = exports.INCIDENT_LONG_TEXT_MAX_UTF8_BYTES = exports.INCIDENT_LONG_TEXT_MAX_CHARACTERS = exports.INCIDENT_SHORT_DESCRIPTION_MAX_UTF8_BYTES = exports.INCIDENT_SHORT_DESCRIPTION_MAX_CHARACTERS = void 0;
|
|
14
|
+
exports.isWriteValuePolicyError = isWriteValuePolicyError;
|
|
15
|
+
exports.writeValueDenialMessage = writeValueDenialMessage;
|
|
16
|
+
exports.normalizeWriteTable = normalizeWriteTable;
|
|
17
|
+
exports.prepareWriteFieldValues = prepareWriteFieldValues;
|
|
18
|
+
const node_buffer_1 = require("node:buffer");
|
|
19
|
+
const field_policy_js_1 = require("./field-policy.js");
|
|
20
|
+
const servicenow_identifiers_js_1 = require("./servicenow-identifiers.js");
|
|
21
|
+
const table_policy_js_1 = require("./table-policy.js");
|
|
22
|
+
exports.INCIDENT_SHORT_DESCRIPTION_MAX_CHARACTERS = 160;
|
|
23
|
+
exports.INCIDENT_SHORT_DESCRIPTION_MAX_UTF8_BYTES = 640;
|
|
24
|
+
exports.INCIDENT_LONG_TEXT_MAX_CHARACTERS = 4_000;
|
|
25
|
+
exports.INCIDENT_LONG_TEXT_MAX_UTF8_BYTES = 16_000;
|
|
26
|
+
exports.INCIDENT_CHOICE_MAX_CHARACTERS = 80;
|
|
27
|
+
exports.INCIDENT_CHOICE_MAX_UTF8_BYTES = 320;
|
|
28
|
+
/**
|
|
29
|
+
* Generic bounds for tables without a typed value map. Large enough for real
|
|
30
|
+
* script and template bodies; small enough that a single field cannot be used
|
|
31
|
+
* to push an unbounded payload upstream.
|
|
32
|
+
*/
|
|
33
|
+
exports.GENERIC_WRITE_VALUE_MAX_CHARACTERS = 100_000;
|
|
34
|
+
exports.GENERIC_WRITE_VALUE_MAX_UTF8_BYTES = 400_000;
|
|
35
|
+
const FIELD_KINDS = Object.freeze({
|
|
36
|
+
short_description: "short_text",
|
|
37
|
+
description: "long_text",
|
|
38
|
+
caller_id: "reference",
|
|
39
|
+
assignment_group: "reference",
|
|
40
|
+
assigned_to: "reference",
|
|
41
|
+
impact: "impact_urgency",
|
|
42
|
+
urgency: "impact_urgency",
|
|
43
|
+
priority: "priority",
|
|
44
|
+
category: "choice",
|
|
45
|
+
subcategory: "choice",
|
|
46
|
+
state: "state",
|
|
47
|
+
close_code: "choice",
|
|
48
|
+
close_notes: "long_text",
|
|
49
|
+
contact_type: "choice",
|
|
50
|
+
});
|
|
51
|
+
const UNSAFE_SINGLE_LINE = /[\p{Cc}\p{Cf}\p{Cs}\p{Zl}\p{Zp}]/u;
|
|
52
|
+
const UNSAFE_MULTILINE = /[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F\p{Cf}\p{Cs}\p{Zl}\p{Zp}]/u;
|
|
53
|
+
const UNSAFE_CHOICE_METACHARACTER = /[\^=,]/u;
|
|
54
|
+
const LEADING_JAVASCRIPT = /^javascript:/iu;
|
|
55
|
+
const STATE_TOKEN = /^-?[0-9]{1,4}$/u;
|
|
56
|
+
const ISSUED_WRITE_VALUE_POLICY_ERRORS = new WeakSet();
|
|
57
|
+
/** Normalized table identifiers are the only value ever placed in a message. */
|
|
58
|
+
const SAFE_TABLE_NAME = /^[a-z][a-z0-9_]{0,79}$/u;
|
|
59
|
+
class WriteValuePolicyError extends Error {
|
|
60
|
+
reason;
|
|
61
|
+
table;
|
|
62
|
+
constructor(reason, table) {
|
|
63
|
+
super("Write denied by the bounded value policy");
|
|
64
|
+
this.name = "WriteValuePolicyError";
|
|
65
|
+
this.reason = reason;
|
|
66
|
+
if (typeof table === "string" && SAFE_TABLE_NAME.test(table)) {
|
|
67
|
+
this.table = table;
|
|
68
|
+
}
|
|
69
|
+
ISSUED_WRITE_VALUE_POLICY_ERRORS.add(this);
|
|
70
|
+
Object.freeze(this);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.WriteValuePolicyError = WriteValuePolicyError;
|
|
74
|
+
function isWriteValuePolicyError(error) {
|
|
75
|
+
return (typeof error === "object" &&
|
|
76
|
+
error !== null &&
|
|
77
|
+
ISSUED_WRITE_VALUE_POLICY_ERRORS.has(error));
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Safe fixed guidance per failure reason. A bounded-value denial is not a
|
|
81
|
+
* table-access denial: it is not fixed in tableAccess.writeTables, so
|
|
82
|
+
* reporting it as a table denial points the operator at a key that cannot
|
|
83
|
+
* change the outcome. Only the already-normalized table identifier is ever
|
|
84
|
+
* interpolated.
|
|
85
|
+
*/
|
|
86
|
+
function writeValueDenialMessage(error, tool) {
|
|
87
|
+
const subject = typeof tool === "string" && tool.trim() !== "" ? tool.trim() : "This tool";
|
|
88
|
+
switch (error.reason) {
|
|
89
|
+
case "unsupported_table":
|
|
90
|
+
return (`Write denied by policy: ${subject} received a table name that is not a ` +
|
|
91
|
+
`valid ServiceNow identifier. ` +
|
|
92
|
+
(error.table === undefined
|
|
93
|
+
? "Pass a table name such as \"incident\"."
|
|
94
|
+
: `Table ${JSON.stringify(error.table)} is not usable.`));
|
|
95
|
+
case "missing_short_description":
|
|
96
|
+
return (`Write denied by policy: ${subject} requires a non-empty bounded ` +
|
|
97
|
+
`short_description when creating an incident.`);
|
|
98
|
+
case "invalid_value":
|
|
99
|
+
return (`Write denied by policy: ${subject} rejected a field value. The field is ` +
|
|
100
|
+
`not writable under the configured field policy for this table, or its ` +
|
|
101
|
+
`value is outside the bounds this code policy enforces. On the incident ` +
|
|
102
|
+
`table only the approved ordinary fields are accepted, and journal fields ` +
|
|
103
|
+
`require the dedicated sn_incident_add_comment and sn_incident_add_work_note ` +
|
|
104
|
+
`tools.`);
|
|
105
|
+
case "invalid_mode":
|
|
106
|
+
return `Write denied by policy: ${subject} requested an unsupported write mode.`;
|
|
107
|
+
default:
|
|
108
|
+
return `Write denied by policy: ${subject} denied the write by the bounded value policy.`;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Normalize a caller-supplied table name into the canonical identifier used
|
|
113
|
+
* for both the policy decision and the upstream request path, so the value
|
|
114
|
+
* evaluated is the value used.
|
|
115
|
+
*/
|
|
116
|
+
function normalizeWriteTable(candidate) {
|
|
117
|
+
try {
|
|
118
|
+
return (0, table_policy_js_1.normalizeTableName)(candidate);
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
throw new WriteValuePolicyError("unsupported_table");
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Validate keys through the shared field policy, then validate and
|
|
126
|
+
* canonicalize every value.
|
|
127
|
+
*
|
|
128
|
+
* The table itself is never gated here: whether a table may be written is the
|
|
129
|
+
* configured table policy's decision, evaluated by the dispatcher. Incident
|
|
130
|
+
* keeps its typed value map; every other granted table gets generic bounds.
|
|
131
|
+
*/
|
|
132
|
+
function prepareWriteFieldValues(mode, tableCandidate, fieldsCandidate) {
|
|
133
|
+
if (mode !== "create" && mode !== "update") {
|
|
134
|
+
throw new WriteValuePolicyError("invalid_mode");
|
|
135
|
+
}
|
|
136
|
+
const table = normalizeWriteTable(tableCandidate);
|
|
137
|
+
const approved = (0, field_policy_js_1.validateWritableFields)(table, fieldsCandidate);
|
|
138
|
+
if (table !== "incident") {
|
|
139
|
+
const generic = {};
|
|
140
|
+
for (const [field, value] of Object.entries(approved)) {
|
|
141
|
+
defineValue(generic, field, genericValue(value));
|
|
142
|
+
}
|
|
143
|
+
return Object.freeze(generic);
|
|
144
|
+
}
|
|
145
|
+
if (mode === "create" && !Object.hasOwn(approved, "short_description")) {
|
|
146
|
+
throw new WriteValuePolicyError("missing_short_description", table);
|
|
147
|
+
}
|
|
148
|
+
const output = {};
|
|
149
|
+
for (const [field, value] of Object.entries(approved)) {
|
|
150
|
+
if (!Object.hasOwn(FIELD_KINDS, field)) {
|
|
151
|
+
throw new WriteValuePolicyError("invalid_value", table);
|
|
152
|
+
}
|
|
153
|
+
defineValue(output, field, canonicalValue(FIELD_KINDS[field], value));
|
|
154
|
+
}
|
|
155
|
+
return Object.freeze(output);
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Bounded canonicalization for a table with no typed value map. Field
|
|
159
|
+
* *selection* is already the field policy's decision; this only ensures the
|
|
160
|
+
* value is a plain bounded scalar that cannot smuggle control characters or
|
|
161
|
+
* an unbounded payload upstream. An empty string is allowed so a granted
|
|
162
|
+
* field can be cleared.
|
|
163
|
+
*/
|
|
164
|
+
function genericValue(value) {
|
|
165
|
+
try {
|
|
166
|
+
if (typeof value === "boolean")
|
|
167
|
+
return String(value);
|
|
168
|
+
if (typeof value === "number") {
|
|
169
|
+
if (!Number.isSafeInteger(value))
|
|
170
|
+
throw new Error("invalid numeric primitive");
|
|
171
|
+
return String(value);
|
|
172
|
+
}
|
|
173
|
+
if (typeof value !== "string")
|
|
174
|
+
throw new Error("value must be a scalar");
|
|
175
|
+
if (!isWellFormedUnicode(value))
|
|
176
|
+
throw new Error("value is not Unicode");
|
|
177
|
+
if (UNSAFE_MULTILINE.test(value)) {
|
|
178
|
+
throw new Error("value contains an unsafe control character");
|
|
179
|
+
}
|
|
180
|
+
if ([...value].length > exports.GENERIC_WRITE_VALUE_MAX_CHARACTERS) {
|
|
181
|
+
throw new Error("value exceeds the character limit");
|
|
182
|
+
}
|
|
183
|
+
if (node_buffer_1.Buffer.byteLength(value, "utf8") > exports.GENERIC_WRITE_VALUE_MAX_UTF8_BYTES) {
|
|
184
|
+
throw new Error("value exceeds the byte limit");
|
|
185
|
+
}
|
|
186
|
+
return value;
|
|
187
|
+
}
|
|
188
|
+
catch {
|
|
189
|
+
throw new WriteValuePolicyError("invalid_value");
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
function canonicalValue(kind, value) {
|
|
193
|
+
try {
|
|
194
|
+
switch (kind) {
|
|
195
|
+
case "short_text":
|
|
196
|
+
return boundedText(value, {
|
|
197
|
+
maximumCharacters: exports.INCIDENT_SHORT_DESCRIPTION_MAX_CHARACTERS,
|
|
198
|
+
maximumBytes: exports.INCIDENT_SHORT_DESCRIPTION_MAX_UTF8_BYTES,
|
|
199
|
+
multiline: false,
|
|
200
|
+
trim: true,
|
|
201
|
+
});
|
|
202
|
+
case "long_text":
|
|
203
|
+
return boundedText(value, {
|
|
204
|
+
maximumCharacters: exports.INCIDENT_LONG_TEXT_MAX_CHARACTERS,
|
|
205
|
+
maximumBytes: exports.INCIDENT_LONG_TEXT_MAX_UTF8_BYTES,
|
|
206
|
+
multiline: true,
|
|
207
|
+
trim: false,
|
|
208
|
+
});
|
|
209
|
+
case "reference":
|
|
210
|
+
return (0, servicenow_identifiers_js_1.normalizeServiceNowSysId)(value);
|
|
211
|
+
case "impact_urgency":
|
|
212
|
+
return boundedInteger(value, 1, 3);
|
|
213
|
+
case "priority":
|
|
214
|
+
return boundedInteger(value, 1, 5);
|
|
215
|
+
case "state": {
|
|
216
|
+
const token = primitiveString(value);
|
|
217
|
+
if (!STATE_TOKEN.test(token))
|
|
218
|
+
throw new Error("invalid state token");
|
|
219
|
+
const numeric = Number(token);
|
|
220
|
+
if (!Number.isSafeInteger(numeric) || numeric < -9_999 || numeric > 9_999) {
|
|
221
|
+
throw new Error("state token is out of range");
|
|
222
|
+
}
|
|
223
|
+
return String(numeric);
|
|
224
|
+
}
|
|
225
|
+
case "choice": {
|
|
226
|
+
const choice = boundedText(value, {
|
|
227
|
+
maximumCharacters: exports.INCIDENT_CHOICE_MAX_CHARACTERS,
|
|
228
|
+
maximumBytes: exports.INCIDENT_CHOICE_MAX_UTF8_BYTES,
|
|
229
|
+
multiline: false,
|
|
230
|
+
trim: true,
|
|
231
|
+
});
|
|
232
|
+
if (UNSAFE_CHOICE_METACHARACTER.test(choice) ||
|
|
233
|
+
LEADING_JAVASCRIPT.test(choice)) {
|
|
234
|
+
throw new Error("unsafe choice token");
|
|
235
|
+
}
|
|
236
|
+
return choice;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
catch {
|
|
241
|
+
throw new WriteValuePolicyError("invalid_value", "incident");
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
function boundedInteger(value, minimum, maximum) {
|
|
245
|
+
const token = primitiveString(value);
|
|
246
|
+
if (!/^[0-9]{1,3}$/u.test(token)) {
|
|
247
|
+
throw new Error("invalid integer token");
|
|
248
|
+
}
|
|
249
|
+
const numeric = Number(token);
|
|
250
|
+
if (!Number.isSafeInteger(numeric) || numeric < minimum || numeric > maximum) {
|
|
251
|
+
throw new Error("integer token is out of range");
|
|
252
|
+
}
|
|
253
|
+
return String(numeric);
|
|
254
|
+
}
|
|
255
|
+
function primitiveString(value) {
|
|
256
|
+
if (typeof value === "number") {
|
|
257
|
+
if (!Number.isSafeInteger(value))
|
|
258
|
+
throw new Error("invalid numeric primitive");
|
|
259
|
+
return String(value);
|
|
260
|
+
}
|
|
261
|
+
if (typeof value !== "string")
|
|
262
|
+
throw new Error("value must be a string or integer");
|
|
263
|
+
const trimmed = value.trim();
|
|
264
|
+
if (trimmed.length === 0)
|
|
265
|
+
throw new Error("value must not be blank");
|
|
266
|
+
return trimmed;
|
|
267
|
+
}
|
|
268
|
+
function boundedText(value, options) {
|
|
269
|
+
if (typeof value !== "string")
|
|
270
|
+
throw new Error("value must be a string");
|
|
271
|
+
const canonical = options.trim ? value.trim() : value;
|
|
272
|
+
if (canonical.trim().length === 0)
|
|
273
|
+
throw new Error("value must not be blank");
|
|
274
|
+
if (!isWellFormedUnicode(canonical))
|
|
275
|
+
throw new Error("value is not Unicode");
|
|
276
|
+
if ((options.multiline ? UNSAFE_MULTILINE : UNSAFE_SINGLE_LINE).test(canonical)) {
|
|
277
|
+
throw new Error("value contains an unsafe control character");
|
|
278
|
+
}
|
|
279
|
+
if ([...canonical].length > options.maximumCharacters) {
|
|
280
|
+
throw new Error("value exceeds the character limit");
|
|
281
|
+
}
|
|
282
|
+
if (node_buffer_1.Buffer.byteLength(canonical, "utf8") > options.maximumBytes) {
|
|
283
|
+
throw new Error("value exceeds the byte limit");
|
|
284
|
+
}
|
|
285
|
+
return canonical;
|
|
286
|
+
}
|
|
287
|
+
function isWellFormedUnicode(value) {
|
|
288
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
289
|
+
const codeUnit = value.charCodeAt(index);
|
|
290
|
+
if (codeUnit >= 0xd800 && codeUnit <= 0xdbff) {
|
|
291
|
+
const next = value.charCodeAt(index + 1);
|
|
292
|
+
if (next < 0xdc00 || next > 0xdfff)
|
|
293
|
+
return false;
|
|
294
|
+
index += 1;
|
|
295
|
+
}
|
|
296
|
+
else if (codeUnit >= 0xdc00 && codeUnit <= 0xdfff) {
|
|
297
|
+
return false;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
return true;
|
|
301
|
+
}
|
|
302
|
+
function defineValue(target, key, value) {
|
|
303
|
+
Object.defineProperty(target, key, {
|
|
304
|
+
value,
|
|
305
|
+
enumerable: true,
|
|
306
|
+
configurable: false,
|
|
307
|
+
writable: false,
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
//# sourceMappingURL=write-value-policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-value-policy.js","sourceRoot":"","sources":["../src/write-value-policy.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAoFH,0DAQC;AASD,0DAkCC;AAOD,kDAMC;AAUD,0DA+BC;AA3LD,6CAAqC;AAErC,uDAA2D;AAC3D,2EAAuE;AACvE,uDAAuD;AAE1C,QAAA,yCAAyC,GAAG,GAAG,CAAC;AAChD,QAAA,yCAAyC,GAAG,GAAG,CAAC;AAChD,QAAA,iCAAiC,GAAG,KAAK,CAAC;AAC1C,QAAA,iCAAiC,GAAG,MAAM,CAAC;AAC3C,QAAA,8BAA8B,GAAG,EAAE,CAAC;AACpC,QAAA,8BAA8B,GAAG,GAAG,CAAC;AAkBlD;;;;GAIG;AACU,QAAA,kCAAkC,GAAG,OAAO,CAAC;AAC7C,QAAA,kCAAkC,GAAG,OAAO,CAAC;AAE1D,MAAM,WAAW,GAAwC,MAAM,CAAC,MAAM,CAAC;IACrE,iBAAiB,EAAE,YAAY;IAC/B,WAAW,EAAE,WAAW;IACxB,SAAS,EAAE,WAAW;IACtB,gBAAgB,EAAE,WAAW;IAC7B,WAAW,EAAE,WAAW;IACxB,MAAM,EAAE,gBAAgB;IACxB,OAAO,EAAE,gBAAgB;IACzB,QAAQ,EAAE,UAAU;IACpB,QAAQ,EAAE,QAAQ;IAClB,WAAW,EAAE,QAAQ;IACrB,KAAK,EAAE,OAAO;IACd,UAAU,EAAE,QAAQ;IACpB,WAAW,EAAE,WAAW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C,KAAK,GAAG,CAAC,CAAC,CAAC;YACzC,IAAI,IAAI,GAAG,MAAM,IAAI,IAAI,GAAG,MAAM;gBAAE,OAAO,KAAK,CAAC;YACjD,KAAK,IAAI,CAAC,CAAC;QACb,CAAC;aAAM,IAAI,QAAQ,IAAI,MAAM,IAAI,QAAQ,IAAI,MAAM,EAAE,CAAC;YACpD,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,WAAW,CAAC,MAA8B,EAAE,GAAW,EAAE,KAAa;IAC7E,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE;QACjC,KAAK;QACL,UAAU,EAAE,IAAI;QAChB,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,KAAK;KAChB,CAAC,CAAC;AACL,CAAC"}
|
package/docs/CLIENT-SETUP.md
CHANGED
|
@@ -415,7 +415,7 @@ runtime and immutable image. See `CROSS-CLIENT-RELEASE-MATRIX.md`.
|
|
|
415
415
|
|
|
416
416
|
## 5. Profile selection, results, and audit evidence
|
|
417
417
|
|
|
418
|
-
All
|
|
418
|
+
All 20 tools require a non-empty `profile`. Missing, empty, unknown, or invalid
|
|
419
419
|
names fail before credentials or a ServiceNow client. There is no default,
|
|
420
420
|
active, current, selected-session, or switch-profile operation. To work across
|
|
421
421
|
instances, make separate calls and include the intended name each time:
|
|
@@ -659,7 +659,7 @@ have been separately authorized. The current official OpenAI flow is:
|
|
|
659
659
|
create a developer-mode app, choose **Tunnel** under **Connection**, and
|
|
660
660
|
select the associated tunnel. Do not enter a public MCP URL or a second
|
|
661
661
|
Authorization value in the app.
|
|
662
|
-
4. Scan tools and compare the
|
|
662
|
+
4. Scan tools and compare the 20 names, schemas, and annotations with the
|
|
663
663
|
frozen release manifest. Keep the app private and draft-only.
|
|
664
664
|
5. On every use, name the profile in the request. For example, instruct the
|
|
665
665
|
app to invoke `sn_query` with these exact non-secret arguments:
|
|
@@ -308,3 +308,14 @@ docker image inspect servicenow-mcp:1.2.0 \
|
|
|
308
308
|
|
|
309
309
|
Changing an AI client changes only client configuration: the HTTPS MCP URL and
|
|
310
310
|
bearer token. It never changes the image build inputs.
|
|
311
|
+
|
|
312
|
+
### ATF result-cache storage
|
|
313
|
+
|
|
314
|
+
The ATF result-cache library defaults to `~/.servicenow-mcp/atf-results` and
|
|
315
|
+
supports a per-profile absolute `atf.resultCacheDir`. Use a dedicated directory
|
|
316
|
+
owned by the runtime user with mode 0700; files are written atomically at 0600.
|
|
317
|
+
It rejects symlink cache files/directories and does not change permissions on
|
|
318
|
+
an existing shared directory. On a read-only or unavailable filesystem it
|
|
319
|
+
warns once on stderr and uses bounded memory until restart. Corrupt or oversized
|
|
320
|
+
files are discarded with a warning. The library is not yet connected to an
|
|
321
|
+
execution/results tool, so current tools do not persist ATF runs.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
This is the release contract for the HTTP MCP surface. A release must expose
|
|
4
4
|
one immutable server artifact at `/mcp` and pass the same contract through both
|
|
5
5
|
the official Model Context Protocol SDK client and an independent Fetch
|
|
6
|
-
JSON-RPC client. The required production catalog contains exactly
|
|
6
|
+
JSON-RPC client. The required production catalog contains exactly 20 tools.
|
|
7
7
|
User-facing configuration and examples for both clients are in
|
|
8
8
|
`docs/CLIENT-SETUP.md`.
|
|
9
9
|
|
|
@@ -124,3 +124,66 @@ rejected instead of being loaded or silently falling back to environment
|
|
|
124
124
|
configuration. To recover such a file, keep any backup owner-only, remove every
|
|
125
125
|
plaintext secret from the active configuration, and recreate or rotate each
|
|
126
126
|
credential through the protected administration entry point.
|
|
127
|
+
|
|
128
|
+
## ATF authoring and result cache
|
|
129
|
+
|
|
130
|
+
`sn_atf_author` supports `create_test`, `create_suite`, and
|
|
131
|
+
`add_tests_to_suite`. A profile needs explicit writes for the corresponding
|
|
132
|
+
`sys_atf_test`, `sys_atf_test_suite`, or `sys_atf_test_suite_test` table and
|
|
133
|
+
field grants for the values being written. For example:
|
|
134
|
+
|
|
135
|
+
```sh
|
|
136
|
+
servicenow-mcp-setup grant --profile pdi --atf --dry-run
|
|
137
|
+
servicenow-mcp-setup grant --profile pdi --atf
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
The preset binds five authoring tables to `sn_atf_author`: the three above,
|
|
141
|
+
plus `sys_atf_step` and `sys_variable_value` reserved for future step support.
|
|
142
|
+
It does not enable execution or script authoring, and does not add authoring
|
|
143
|
+
to unrelated table targets. Existing grants remain in place.
|
|
144
|
+
|
|
145
|
+
Create a test with `{"profile":"pdi","action":"create_test","name":"Example"}`.
|
|
146
|
+
Creation accepts optional `description`, `active` (default true), and
|
|
147
|
+
`application_scope` (a scope sys_id). Membership accepts `suite_sys_id`,
|
|
148
|
+
`test_sys_ids` (1–100 unique IDs), and optional `start_order` (default 100).
|
|
149
|
+
Orders increment by one; existing memberships are not deduplicated or reordered.
|
|
150
|
+
The instance enforces reference integrity, application scope, and ACLs.
|
|
151
|
+
|
|
152
|
+
Successful calls report `data.outcome: "created"`. A failed attempt reports
|
|
153
|
+
`data.outcome: "failed"`, `rolled_back`, `rollback_failed`, and
|
|
154
|
+
`uncertain_insert`. Check the outcome before treating the call as successful.
|
|
155
|
+
Rollback deletes only records confirmed created by that invocation. A timeout,
|
|
156
|
+
connection loss, unusable create response, cancellation, or failed delete can
|
|
157
|
+
require manual inspection before retrying; this is not a database transaction.
|
|
158
|
+
|
|
159
|
+
Profiles accept an optional `atf` block:
|
|
160
|
+
|
|
161
|
+
```json
|
|
162
|
+
{
|
|
163
|
+
"atf": {
|
|
164
|
+
"execute": false,
|
|
165
|
+
"allowScriptSteps": false,
|
|
166
|
+
"resultCacheSize": 10
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
`resultCacheSize` accepts 1–100; `resultCacheDir` optionally selects an absolute
|
|
172
|
+
owner-only directory. Cache tuning falls back to `SN_ATF_RESULT_CACHE_SIZE`
|
|
173
|
+
and `SN_ATF_RESULT_CACHE_DIR`. `SN_ATF_EXECUTE` and
|
|
174
|
+
`SN_ATF_ALLOW_SCRIPT_STEPS` grant permissions only to an environment-only
|
|
175
|
+
profile, never to stored profiles.
|
|
176
|
+
|
|
177
|
+
The result-cache library is available for the forthcoming execution/results
|
|
178
|
+
tools. No current tool populates it yet. It stores compact run summaries and
|
|
179
|
+
at most 500 characters of the first failure per test, without raw step output.
|
|
180
|
+
Files default to `~/.servicenow-mcp/atf-results/<sha256-profile-name>.json`;
|
|
181
|
+
hashed profile names prevent path traversal. Each file is bound to the
|
|
182
|
+
instance origin and credential fingerprint, with up to 200 suites and a 16 MiB
|
|
183
|
+
file cap. Least-recently-used suites are evicted when those bounds are reached.
|
|
184
|
+
Changing instance or credentials discards the old history. Cache directories
|
|
185
|
+
and files must be private (0700/0600 on POSIX).
|
|
186
|
+
|
|
187
|
+
The four-tool ATF workflow is still under development: readiness, CI/CD suite
|
|
188
|
+
execution, history/compare, and step authoring are not implemented yet.
|
|
189
|
+
Legacy `sn_atf run` and `run-suite` remain policy-denied even with `execute: true`.
|
|
@@ -26,7 +26,7 @@ npm audit --omit=dev --audit-level=moderate
|
|
|
26
26
|
|
|
27
27
|
The unit and protocol commands are deliberately separate release records even
|
|
28
28
|
though the complete unit suite contains the focused protocol cases. The
|
|
29
|
-
protocol gate includes the all-
|
|
29
|
+
protocol gate includes the all-20-tool missing-profile rejection matrix through
|
|
30
30
|
the official SDK and independent Fetch clients, plus the catalog-wide resolved
|
|
31
31
|
profile/result/audit contract. The profile gate covers encryption,
|
|
32
32
|
secret-reference resolution, operator administration, and profile isolation.
|
|
@@ -68,7 +68,7 @@ bearer header in argv. In the local UI:
|
|
|
68
68
|
|
|
69
69
|
1. Select Streamable HTTP and enter the exact `MCP_URL` shown by the launcher.
|
|
70
70
|
2. Enter the bearer directly from the approved secret store in the local UI.
|
|
71
|
-
3. Run `tools/list`; verify exactly
|
|
71
|
+
3. Run `tools/list`; verify exactly 20 tools and required non-empty `profile`
|
|
72
72
|
schemas.
|
|
73
73
|
4. Call `sn_profile` once without `profile` and verify rejection.
|
|
74
74
|
5. Call it again with the exact `MCP_PROFILE`; verify
|
|
@@ -138,3 +138,30 @@ the target; stable-tag publication fails unless the tag exactly matches them.
|
|
|
138
138
|
|
|
139
139
|
The Inspector operating model and security constraints are documented by the
|
|
140
140
|
[official MCP Inspector project](https://github.com/modelcontextprotocol/inspector).
|
|
141
|
+
|
|
142
|
+
## Dev releases
|
|
143
|
+
|
|
144
|
+
A development release uses a unique version such as `2.2.0-dev.1` in
|
|
145
|
+
`package.json`, both root entries in `package-lock.json`, and `src/version.ts`.
|
|
146
|
+
Commit the version and changelog, then push the matching Git tag:
|
|
147
|
+
|
|
148
|
+
```sh
|
|
149
|
+
git tag -a v2.2.0-dev.1 -m "Development release 2.2.0-dev.1"
|
|
150
|
+
git push origin v2.2.0-dev.1
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
The existing `publish.yml` workflow runs the release gates and publishes through
|
|
154
|
+
npm trusted publishing. The validator maps stable versions to `latest` and
|
|
155
|
+
`X.Y.Z-dev.N` versions to `dev`; other prerelease channels and mismatched tags
|
|
156
|
+
are rejected. Every published version must be unique. GitHub prereleases can
|
|
157
|
+
be created for these tags without marking them as the latest stable release.
|
|
158
|
+
|
|
159
|
+
Install the newest development build or pin an exact build:
|
|
160
|
+
|
|
161
|
+
```sh
|
|
162
|
+
npm install -g @onlyflows/servicenow-mcp@dev
|
|
163
|
+
npm install -g @onlyflows/servicenow-mcp@2.2.0-dev.1
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Restart the MCP client after updating. To return to the stable channel, install
|
|
167
|
+
`@onlyflows/servicenow-mcp@latest` and restart the client again.
|
package/docs/TESTING-OAUTH.md
CHANGED
|
@@ -60,7 +60,7 @@ npm run smoke
|
|
|
60
60
|
The smoke client uses the official MCP Streamable HTTP client and verifies:
|
|
61
61
|
|
|
62
62
|
- initialization and discovery over `/mcp`;
|
|
63
|
-
- exactly
|
|
63
|
+
- exactly 20 tools;
|
|
64
64
|
- every discovered schema requires a non-empty `profile`;
|
|
65
65
|
- `sn_profile` returns `structuredContent.profile` without credentials;
|
|
66
66
|
- a version health check and a bounded incident query return that same resolved
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onlyflows/servicenow-mcp",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"description": "stdio ServiceNow MCP server with
|
|
3
|
+
"version": "2.2.0-dev.1",
|
|
4
|
+
"description": "stdio ServiceNow MCP server with 20 tools for CRUD, CMDB traversal, ATF testing, and explicit multi-instance profiles.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"bin": {
|
|
@@ -43,7 +43,8 @@ export function validateReleaseContract(options = {}) {
|
|
|
43
43
|
const inspectorSource = read("scripts/inspector.mjs");
|
|
44
44
|
const releaseGuide = read("docs/RELEASE-VALIDATION.md");
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
const channel = releaseChannel(packageJson.version);
|
|
47
|
+
assert(read("src/version.ts").includes(`export const VERSION = "${packageJson.version}";`), "runtime version differs from package version");
|
|
47
48
|
assert(packageLock.version === packageJson.version, "package-lock version differs from package version");
|
|
48
49
|
assert(
|
|
49
50
|
packageLock.packages?.[""]?.version === packageJson.version,
|
|
@@ -155,6 +156,7 @@ export function validateReleaseContract(options = {}) {
|
|
|
155
156
|
|
|
156
157
|
return Object.freeze({
|
|
157
158
|
version: packageJson.version,
|
|
159
|
+
channel,
|
|
158
160
|
tag: tag ?? null,
|
|
159
161
|
inspectorVersion: inspectorPackage.dependencies["@modelcontextprotocol/inspector"],
|
|
160
162
|
portableGateCount: PORTABLE_RELEASE_GATES.length,
|
|
@@ -164,11 +166,18 @@ export function validateReleaseContract(options = {}) {
|
|
|
164
166
|
});
|
|
165
167
|
}
|
|
166
168
|
|
|
169
|
+
/** Only reviewed stable and dev channels can be published. */
|
|
170
|
+
export function releaseChannel(version) {
|
|
171
|
+
const match = /^(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)(-dev\.(?:0|[1-9][0-9]*))?$/u.exec(version);
|
|
172
|
+
assert(typeof version === "string" && match !== null && match[0] === version, "package version must be stable semver or a dev.N prerelease");
|
|
173
|
+
return match[1] === undefined ? "latest" : "dev";
|
|
174
|
+
}
|
|
175
|
+
|
|
167
176
|
function releaseTagFromEnvironment(environment) {
|
|
168
177
|
if (environment.GITHUB_REF_TYPE !== "tag") return undefined;
|
|
169
178
|
const tag = environment.GITHUB_REF_NAME;
|
|
170
|
-
if (typeof tag !== "string" || !/^v[0-9]
|
|
171
|
-
throw new Error("tag release is missing a valid stable GITHUB_REF_NAME");
|
|
179
|
+
if (typeof tag !== "string" || !/^v(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)(?:-dev\.(?:0|[1-9][0-9]*))?$/u.test(tag)) {
|
|
180
|
+
throw new Error("tag release is missing a valid stable or dev GITHUB_REF_NAME");
|
|
172
181
|
}
|
|
173
182
|
return tag;
|
|
174
183
|
}
|
|
@@ -191,7 +200,8 @@ function isMainModule() {
|
|
|
191
200
|
|
|
192
201
|
if (isMainModule()) {
|
|
193
202
|
try {
|
|
194
|
-
|
|
203
|
+
const result = validateReleaseContract();
|
|
204
|
+
process.stdout.write(`${process.argv.includes("--npm-tag") ? result.channel : JSON.stringify(result)}\n`);
|
|
195
205
|
} catch (error) {
|
|
196
206
|
process.stderr.write(
|
|
197
207
|
`${error instanceof Error ? error.message : "Release contract validation failed"}\n`
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/** Bounded, code-owned value policy for ordinary incident creates and updates. */
|
|
2
|
-
export declare const INCIDENT_SHORT_DESCRIPTION_MAX_CHARACTERS = 160;
|
|
3
|
-
export declare const INCIDENT_SHORT_DESCRIPTION_MAX_UTF8_BYTES = 640;
|
|
4
|
-
export declare const INCIDENT_LONG_TEXT_MAX_CHARACTERS = 4000;
|
|
5
|
-
export declare const INCIDENT_LONG_TEXT_MAX_UTF8_BYTES = 16000;
|
|
6
|
-
export declare const INCIDENT_CHOICE_MAX_CHARACTERS = 80;
|
|
7
|
-
export declare const INCIDENT_CHOICE_MAX_UTF8_BYTES = 320;
|
|
8
|
-
type IncidentWriteMode = "create" | "update";
|
|
9
|
-
export type IncidentWritePolicyFailureReason = "unsupported_table" | "invalid_mode" | "missing_short_description" | "invalid_value";
|
|
10
|
-
export declare class IncidentWritePolicyError extends Error {
|
|
11
|
-
readonly reason: IncidentWritePolicyFailureReason;
|
|
12
|
-
constructor(reason: IncidentWritePolicyFailureReason);
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Validate keys through the shared field policy, then validate and canonicalize
|
|
16
|
-
* every ordinary incident value. No runtime configuration can extend this map.
|
|
17
|
-
*/
|
|
18
|
-
export declare function prepareIncidentWriteFields(mode: IncidentWriteMode, tableCandidate: unknown, fieldsCandidate: unknown): Readonly<Record<string, string>>;
|
|
19
|
-
export {};
|
|
20
|
-
//# sourceMappingURL=incident-write-policy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"incident-write-policy.d.ts","sourceRoot":"","sources":["../src/incident-write-policy.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAQlF,eAAO,MAAM,yCAAyC,MAAM,CAAC;AAC7D,eAAO,MAAM,yCAAyC,MAAM,CAAC;AAC7D,eAAO,MAAM,iCAAiC,OAAQ,CAAC;AACvD,eAAO,MAAM,iCAAiC,QAAS,CAAC;AACxD,eAAO,MAAM,8BAA8B,KAAK,CAAC;AACjD,eAAO,MAAM,8BAA8B,MAAM,CAAC;AAElD,KAAK,iBAAiB,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAU7C,MAAM,MAAM,gCAAgC,GACxC,mBAAmB,GACnB,cAAc,GACd,2BAA2B,GAC3B,eAAe,CAAC;AA0BpB,qBAAa,wBAAyB,SAAQ,KAAK;IACrC,QAAQ,CAAC,MAAM,EAAE,gCAAgC;gBAAxC,MAAM,EAAE,gCAAgC;CAK9D;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,iBAAiB,EACvB,cAAc,EAAE,OAAO,EACvB,eAAe,EAAE,OAAO,GACvB,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CA2BlC"}
|