@sonisoft/now-sdk-ext-mcp 4.8.0 → 4.8.2

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 CHANGED
@@ -2,21 +2,42 @@
2
2
 
3
3
  An MCP (Model Context Protocol) server that enables AI assistants to interact directly with ServiceNow instances — executing background scripts, querying data, running ATF tests, tailing logs, and more.
4
4
 
5
- Built on [`@modelcontextprotocol/sdk`](https://github.com/modelcontextprotocol/typescript-sdk) and [`@sonisoft/now-sdk-ext-core`](https://git.sonisoft.io).
5
+ Built on [`@modelcontextprotocol/sdk`](https://github.com/modelcontextprotocol/typescript-sdk) and [`@sonisoft/now-sdk-ext-core`](https://github.com/sonisoft-cnanda/now-sdk-ext-core).
6
6
 
7
- Use [table behavior discovery](docs/table-behavior.md) to inspect automation, field requirements, and related artifact details.
7
+ Use [table behavior discovery](#table-behavior-discovery) to inspect automation, field requirements, and related artifact details. Available in MCP **4.8.0**, using core **6.4.1**.
8
8
 
9
9
  ## Quick Start
10
10
 
11
11
  ### Prerequisites
12
12
 
13
- - **Node.js** >= 22
13
+ - **Node.js** >= 26
14
14
  - **ServiceNow CLI credentials** configured via `now-sdk auth --add`
15
15
 
16
- ### Install and Build
16
+ ### Use the Published Package
17
+
18
+ Configure your MCP client to launch `npx --yes @sonisoft/now-sdk-ext-mcp`:
19
+
20
+ ```json
21
+ {
22
+ "mcpServers": {
23
+ "servicenow": {
24
+ "command": "npx",
25
+ "args": ["--yes", "@sonisoft/now-sdk-ext-mcp"],
26
+ "env": {
27
+ "SN_AUTH_ALIAS": "dev",
28
+ "MCP_TOOL_PACKAGE": "readonly"
29
+ }
30
+ }
31
+ }
32
+ }
33
+ ```
34
+
35
+ The `readonly` package includes schema and behavior discovery. Omit `MCP_TOOL_PACKAGE` for all tools, or select a [tool package](TOOLS.md#tool-packages) for your workflow.
36
+
37
+ ### Build from Source
17
38
 
18
39
  ```bash
19
- git clone <repo-url>
40
+ git clone https://github.com/sonisoft-cnanda/now-sdk-ext-mcp.git
20
41
  cd now-sdk-ext-mcp
21
42
  npm install
22
43
  npm run build
@@ -27,10 +48,11 @@ npm run build
27
48
  This server uses the same credential store as the ServiceNow CLI. If you haven't already, configure your instance credentials:
28
49
 
29
50
  ```bash
30
- now-sdk auth --add <instance_alias>
51
+ npm install -g @servicenow/sdk
52
+ now-sdk auth --add https://dev12345.service-now.com --alias dev --type oauth
31
53
  ```
32
54
 
33
- This stores credentials locally so the MCP server can authenticate without prompting.
55
+ This stores credentials locally. For clients that cannot unlock the OS keyring, import credentials into `@sonisoft/sn-credstore` and set `SN_CRED_STORE_ENABLE=1` in the server environment; see [credential storage](CLAUDE.md#credential-storage).
34
56
 
35
57
  > **Breaking Change in v2.0.0 (ServiceNow SDK 4.3.0)**
36
58
  >
@@ -45,7 +67,7 @@ This stores credentials locally so the MCP server can authenticate without promp
45
67
  > npm install -g @servicenow/sdk@4.3.0
46
68
  >
47
69
  > # 2. Re-add each instance alias
48
- > now-sdk auth --add <your-alias>
70
+ > now-sdk auth --add https://dev12345.service-now.com --alias dev --type oauth
49
71
  >
50
72
  > # 3. Verify your aliases work
51
73
  > now-sdk auth --list
@@ -112,7 +134,7 @@ Add to your `.vscode/mcp.json` or Cursor MCP settings:
112
134
 
113
135
  ### Claude Code
114
136
 
115
- Add to your `.claude/settings.json` or project-level `.mcp.json`:
137
+ Add to your project-level `.mcp.json`:
116
138
 
117
139
  ```json
118
140
  {
@@ -157,13 +179,93 @@ Once connected, you can talk to your AI assistant naturally:
157
179
 
158
180
  > "Query the sys_user table for users with the admin role on prod"
159
181
 
160
- The AI will:
161
- 1. Write the appropriate ServiceNow server-side JavaScript
162
- 2. Call the `execute_script` tool with the instance alias and script
163
- 3. Return the results in a readable format
182
+ > "Inspect change_request behavior on dev. Identify transition requirements and flow conditions needed for Change Management ATF coverage."
183
+
184
+ The assistant selects the appropriate tools, supplies the instance alias, and interprets their results. Schema tools describe fields; behavior tools retrieve automation configuration and dependencies. Script execution is available when the task calls for server-side JavaScript.
164
185
 
165
186
  The `instance` parameter can be passed explicitly per-request or defaulted via the `SN_AUTH_ALIAS` environment variable, so if you only work with one instance you can set-and-forget.
166
187
 
188
+ ## Table Behavior Discovery
189
+
190
+ Use `discover_table_behavior` to inventory configuration affecting a table and `get_behavior_details` to retrieve known artifacts without rescanning. Both tools are read-only and available in the `full`, `readonly`, `developer`, and `flow_developer` packages.
191
+
192
+ | Category | Functional context |
193
+ | --- | --- |
194
+ | `business_rules` | Before/after/async timing, operation flags, order, conditions and scripts |
195
+ | `ui_actions` | Form/list/workspace placement, roles, conditions and scripts |
196
+ | `client_scripts` | Client events, target fields, views and inherited applicability |
197
+ | `ui_policies` | Conditions and mandatory, visible or read-only field actions |
198
+ | `data_policies` | Server field requirements and enforcement settings |
199
+ | `workflows` | Legacy workflow versions, start conditions, activities and transitions |
200
+ | `flows` | Record triggers, conditions and optional current flow definitions |
201
+ | `state_models` | State fields, transition gates and required fields in supported generic layouts |
202
+
203
+ Pass these **tool arguments** to `discover_table_behavior` for a compact inventory:
204
+
205
+ ```json
206
+ {
207
+ "instance": "dev",
208
+ "table": "change_request"
209
+ }
210
+ ```
211
+
212
+ Defaults: active configuration, applicable ancestors, all eight categories, 50 items per category and a 65,536-byte JSON budget. Summaries include conditions and declarative field actions. Request scripts, definitions and dependencies in the first call when needed:
213
+
214
+ ```json
215
+ {
216
+ "instance": "dev",
217
+ "table": "change_request",
218
+ "categories": ["business_rules", "flows", "state_models"],
219
+ "details": ["scripts", "definitions", "dependencies"],
220
+ "dependency_depth": 1,
221
+ "max_bytes": 262144
222
+ }
223
+ ```
224
+
225
+ For known artifacts, pass 1–50 `references` to `get_behavior_details`. Replace example IDs with real source IDs. Reference objects preserve the core API's camelCase keys even though tool options use snake_case:
226
+
227
+ ```json
228
+ {
229
+ "instance": "dev",
230
+ "references": [
231
+ {
232
+ "kind": "flows",
233
+ "sourceTable": "sys_hub_flow",
234
+ "sysId": "0123456789abcdef0123456789abcdef"
235
+ }
236
+ ],
237
+ "details": ["definitions", "dependencies"],
238
+ "dependency_depth": 1,
239
+ "max_bytes": 262144
240
+ }
241
+ ```
242
+
243
+ References from discovery can be passed through unchanged. Flow discovery can return trigger references; a known flow ID uses `kind: "flows"` and `sourceTable: "sys_hub_flow"`. Detail retrieval also supports subflows, actions, Script Includes and decision tables.
244
+
245
+ **Controls and continuation:**
246
+
247
+ - Filter discovery with `categories`, metadata `name`, or up to 50 `sys_ids`. Use `include_inherited: false` for direct table associations and `include_inactive: true` for inactive/draft candidates where available.
248
+ - `limit` accepts 1–200 items per category. `max_bytes` accepts 4,096–1,048,576 bytes on either tool.
249
+ - `dependency_depth` defaults to 0; 1 requires `details` containing `dependencies` and expands at most 50 unique dependency references. `scope` selects the transaction scope for flow definition reads.
250
+ - Pass each category's `nextCursor` in `cursors`, retaining the original table, filters and detail selection. For example, after a `business_rules`-only inventory:
251
+
252
+ ```json
253
+ {
254
+ "instance": "dev",
255
+ "table": "change_request",
256
+ "categories": ["business_rules"],
257
+ "cursors": {
258
+ "business_rules": "<nextCursor from the previous response>"
259
+ }
260
+ }
261
+ ```
262
+
263
+ Both tools return the core result in `structuredContent` and a short text summary. Discovery includes category `status` (`complete`, `partial`, `unavailable`, or `failed`), `items`, `warnings` and optional `nextCursor`. Detail batches include `remainingReferences`. Oversized details are omitted whole with `omittedDetails` and warnings; increase the budget or narrow the batch. Empty pages can still need continuation, and empty results only describe the account's accessible configuration.
264
+
265
+ **Change Management ATF workflow:** combine schema fields and choices with behavior conditions, required fields, state transitions, approval steps and dependent artifacts. Keep UI behavior separate from server enforcement. Preserve source references and runtime/design provenance: current flow definitions can differ from the version associated with runtime trigger metadata. Conditions are not evaluated and execution order is not predicted. Validate the resulting test assumptions with ATF results, logs and flow contexts.
266
+
267
+ Live behavior validation used an Australia instance; Zurich validation remains outstanding. See the [behavior guide](docs/table-behavior.md), [tool parameters](TOOLS.md#discover_table_behavior), and [core API reference](https://github.com/sonisoft-cnanda/now-sdk-ext-core/blob/main/docs/TableBehaviorDiscovery.md).
268
+
167
269
  ## Available Tools
168
270
 
169
271
  See **[TOOLS.md](TOOLS.md)** for the full list of available tools with parameters and examples.
@@ -173,6 +275,9 @@ See **[TOOLS.md](TOOLS.md)** for the full list of available tools with parameter
173
275
  | Variable | Default | Description |
174
276
  |----------|---------|-------------|
175
277
  | `SN_AUTH_ALIAS` | _(none)_ | Default ServiceNow auth alias. Used when a tool call doesn't specify an `instance` parameter. |
278
+ | `MCP_TOOL_PACKAGE` | `full` | Tool package or comma-separated union; see [tool packages](TOOLS.md#tool-packages). |
279
+ | `SN_CRED_STORE_ENABLE` | _(unset)_ | Set to `1` to use the imported headless credential store; see [credential storage](CLAUDE.md#credential-storage). |
280
+ | `NEX_LOG_LEVEL` | `info` | Diagnostic log level; logs go to stderr. See [debugging](#debugging) for file logging. |
176
281
 
177
282
  ## Development
178
283
 
@@ -181,8 +286,10 @@ See **[TOOLS.md](TOOLS.md)** for the full list of available tools with parameter
181
286
  ```
182
287
  src/
183
288
  ├── index.ts # Server entry point — registers tools, starts stdio transport
184
- ├── tools/ # MCP tool implementations (one file per tool)
185
- │ └── execute-script.ts # execute_script tool
289
+ ├── tools/ # Tool implementations and registry.ts
290
+ │ └── behavior.ts # Discovery and batched behavior detail tools
291
+ ├── config/tool-packages.ts # Role package definitions
292
+ ├── resources/ # Read-only servicenow:// resources
186
293
  └── common/
187
294
  └── connection.ts # ServiceNow connection manager (credential resolution + caching)
188
295
 
@@ -209,52 +316,16 @@ test/
209
316
 
210
317
  ### Adding a New Tool
211
318
 
212
- 1. Create a new file in `src/resources/ # servicenow:// read-only resources
213
- src/tools/` (e.g., `src/tools/query-table.ts`).
214
- 2. Export a registration function:
215
-
216
- ```typescript
217
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
218
- import { z } from "zod";
219
- import { getServiceNowInstance } from "../common/connection.js";
220
-
221
- export function registerQueryTableTool(server: McpServer): void {
222
- server.registerTool(
223
- "query_table",
224
- {
225
- title: "Query Table",
226
- description: "Query records from a ServiceNow table.",
227
- inputSchema: {
228
- instance: z.string().optional().describe("ServiceNow instance auth alias"),
229
- table: z.string().describe("Table name to query"),
230
- // ... more params
231
- },
232
- },
233
- async ({ instance, table }) => {
234
- const snInstance = await getServiceNowInstance(instance);
235
- // ... use core library to query
236
- return {
237
- content: [{ type: "text" as const, text: "results here" }],
238
- };
239
- }
240
- );
241
- }
242
- ```
243
-
244
- 3. Register it in `src/index.ts`:
245
-
246
- ```typescript
247
- import { registerQueryTableTool } from "./tools/query-table.js";
248
-
249
- registerQueryTableTool(server);
250
- ```
251
-
252
- 4. Add tests in `test/unit/tools/` following the existing pattern.
253
- 5. Document the tool in [`TOOLS.md`](TOOLS.md).
319
+ 1. Add a registration function under `src/tools/`; [behavior.ts](src/tools/behavior.ts) demonstrates input validation, structured output and error handling.
320
+ 2. Route ServiceNow calls through `withConnectionRetry` and delegate reusable behavior to core.
321
+ 3. Add the tool to `TOOL_REGISTRY` in [registry.ts](src/tools/registry.ts) and classify its effects in [annotations.ts](src/common/annotations.ts). Registration rejects unclassified tools.
322
+ 4. Add it to relevant role packages in [tool-packages.ts](src/config/tool-packages.ts). The full package uses the registry; the readonly package uses annotations.
323
+ 5. Test listing and invocation through the MCP client in `test/unit/tools/`, and cover package membership where relevant.
324
+ 6. Document parameters and examples in [TOOLS.md](TOOLS.md) and update user-facing README guidance.
254
325
 
255
326
  ### Testing Approach
256
327
 
257
- Tests use the MCP SDK's `InMemoryTransport` to create linked client+server pairs entirely in-process. This means tests go through the full MCP protocol stack (JSON-RPC serialization, schema validation, handler dispatch) without spawning processes or touching the network.
328
+ Tool tests use the MCP SDK's `InMemoryTransport` for linked client/server pairs and exercise JSON-RPC, schema validation and handler dispatch without ServiceNow calls. Logging tests also spawn the real server to verify stdout purity, stderr redaction and shutdown flushing.
258
329
 
259
330
  - **Unit tests** (`test/unit/`): Mock external dependencies (`@sonisoft/now-sdk-ext-core`, `@servicenow/sdk-cli`) using `jest.unstable_mockModule()` for ESM compatibility. Test tool behavior through the MCP client.
260
331
  - **Integration tests** (`test/integration/`): Verify the MCP protocol lifecycle (handshake, tool listing, sequential calls) without mocking.
@@ -263,8 +334,8 @@ Tests use the MCP SDK's `InMemoryTransport` to create linked client+server pairs
263
334
 
264
335
  This MCP server wraps the same core library used by the CLI:
265
336
 
266
- - **Core library**: [`@sonisoft/now-sdk-ext-core`](../now-sdk-ext-core) — all ServiceNow communication (auth, HTTP, WebSocket, script execution, ATF, syslog)
267
- - **CLI**: [`@sonisoft/now-sdk-ext-cli`](../now-sdk-ext-cli) — the `nex` CLI that wraps the core library with oclif
337
+ - **Core library**: [`@sonisoft/now-sdk-ext-core`](https://github.com/sonisoft-cnanda/now-sdk-ext-core) — all ServiceNow communication (auth, HTTP, WebSocket, script execution, ATF, syslog)
338
+ - **CLI**: [`@sonisoft/now-sdk-ext-cli`](https://github.com/sonisoft-cnanda/now-sdk-ext-cli) — the `nex` CLI that wraps the core library with oclif
268
339
 
269
340
  When adding new MCP tools, reference the corresponding CLI command in `now-sdk-ext-cli/src/commands/` for the expected behavior and data flow.
270
341
 
@@ -305,7 +376,7 @@ There are three layers of testing for this project:
305
376
 
306
377
  #### 1. Automated Tests (Jest)
307
378
 
308
- Unit and integration tests run entirely in-process using the MCP SDK's `InMemoryTransport` — no server process, no network, no credentials needed.
379
+ Protocol tests use `InMemoryTransport`; logging checks also launch the real server. Automated tests do not require ServiceNow credentials or call a live instance.
309
380
 
310
381
  ```bash
311
382
  npm test # Unit tests (default, fast)
@@ -427,7 +498,7 @@ printf '%s\n%s\n%s\n' \
427
498
 
428
499
  Since stdout is reserved for JSON-RPC, **never use `console.log()` in server code** — it corrupts the protocol stream. Use these approaches instead:
429
500
 
430
- - **`console.error()`** — writes to stderr, which is safe and visible in the MCP Inspector's Notifications pane and in Claude Desktop's log files (`~/Library/Logs/Claude/mcp*.log`).
501
+ - **Shared logger** — use `getLogger()` from `src/common/logging.ts`. It sends diagnostics to stderr and redacts structured metadata and recognized credential patterns. Avoid raw `console.error()` with errors or session data.
431
502
  - **MCP Inspector** — run the server under the inspector to see all JSON-RPC messages and stderr output in real time.
432
503
  - **File logging** — off by default. This server's working directory is chosen by whoever launched it, so it writes no files unless asked. Configure with environment variables:
433
504
 
@@ -439,7 +510,7 @@ Since stdout is reserved for JSON-RPC, **never use `console.log()` in server cod
439
510
  | `NEX_POLICY_DENY` | `write`, `execute`, or `all` — refuses matching instance changes. Malformed values **fail closed** |
440
511
  | `NEX_POLICY_ALLOW` | Grants verbs. Inert while changes are permitted by default |
441
512
 
442
- Diagnostics always go to **stderr**, never stdout — stdout carries JSON-RPC. Credential material is stripped from both metadata and message text before anything is written.
513
+ Diagnostics always go to **stderr**, never stdout — stdout carries JSON-RPC. SDK diagnostics use the same redacting logger. Redaction covers structured credential fields and recognized message patterns; never interpolate arbitrary secrets into log messages. SIGINT and SIGTERM wait for log flushing within a two-second shutdown bound. Core 6.4.1 also waits for the underlying file stream to finish pending writes.
443
514
 
444
515
  ### Code Conventions
445
516
 
@@ -453,3 +524,18 @@ Since stdout is reserved for JSON-RPC, **never use `console.log()` in server cod
453
524
  ## License
454
525
 
455
526
  MIT
527
+
528
+ ## OAuth renewal
529
+
530
+ Alias-bound connections provide core with a credential resolver. Core can refresh
531
+ OAuth and rebuild session cookies during long-running operations; the 30-minute
532
+ connection cache is not an authentication lifetime.
533
+
534
+ Core owns authentication retries. MCP does not retry `NEX_AUTH_*` or
535
+ `NEX_SESSION_*` errors again. Writes and stateful sessions require an explicit safe
536
+ restart after expiry. Rejected refresh credentials require a new login; temporary
537
+ store/network failures do not establish that interactive reauthentication is needed.
538
+
539
+ When upgrading a shared store, stop all clients first, upgrade every client
540
+ (including standalone `now-sdk-x`) to sn-credstore 1.1.1 or later, then restart.
541
+ The new lock protocol cannot safely run alongside older clients.
@@ -1 +1 @@
1
- {"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../src/common/connection.ts"],"names":[],"mappings":"AACA,OAA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,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,GACpE,OAAO,CAIT;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,mBAAmB,CAAC,CAAC,EACzC,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,SAAS,EAAE,CAAC,QAAQ,EAAE,kBAAkB,KAAK,OAAO,CAAC,CAAC,CAAC,GACtD,OAAO,CAAC,CAAC,CAAC,CAeZ"}
@@ -1,4 +1,4 @@
1
- import { getCredentials } from "@servicenow/sdk-cli/dist/auth/index.js";
1
+ import { resolveSessionCredentials } from "@sonisoft/now-sdk-ext-core";
2
2
  import { ServiceNowInstance, } from "@sonisoft/now-sdk-ext-core";
3
3
  import { getLogger } from "./logging.js";
4
4
  const log = getLogger("connection");
@@ -41,7 +41,7 @@ export async function getServiceNowInstance(authAlias) {
41
41
  log.debug("Cache TTL expired, refreshing session", { alias: resolvedAlias });
42
42
  instanceCache.delete(resolvedAlias);
43
43
  }
44
- const credential = await getCredentials(resolvedAlias);
44
+ const credential = await resolveSessionCredentials(resolvedAlias);
45
45
  if (!credential) {
46
46
  // The previous text told users to run "snc configure", which is not a
47
47
  // command this SDK has ever shipped — so the one actionable line in the
@@ -64,6 +64,7 @@ export async function getServiceNowInstance(authAlias) {
64
64
  const snSettings = {
65
65
  alias: resolvedAlias,
66
66
  credential,
67
+ credentialProvider: () => resolveSessionCredentials(resolvedAlias),
67
68
  };
68
69
  const instance = new ServiceNowInstance(snSettings);
69
70
  instanceCache.set(resolvedAlias, {
@@ -102,6 +103,9 @@ const RETRYABLE_PATTERNS = /ECONNREFUSED|ECONNRESET|ETIMEDOUT|EPIPE|socket hang
102
103
  function isRetryableError(error) {
103
104
  if (!error)
104
105
  return false;
106
+ if (typeof error === "object" && "code" in error &&
107
+ typeof error.code === "string" && /^(NEX_AUTH_|NEX_SESSION_)/.test(error.code))
108
+ return false;
105
109
  const msg = error instanceof Error ? error.message : String(error);
106
110
  return RETRYABLE_PATTERNS.test(msg);
107
111
  }
@@ -1 +1 @@
1
- {"version":3,"file":"connection.js","sourceRoot":"","sources":["../../src/common/connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EACL,kBAAkB,GAEnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,MAAM,GAAG,GAAG,SAAS,CAAC,YAAY,CAAC,CAAC;AAQpC,oFAAoF;AACpF,MAAM,YAAY,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEpC,MAAM,aAAa,GAAG,IAAI,GAAG,EAAsB,CAAC;AAEpD;;;GAGG;AACH,SAAS,YAAY,CAAC,SAAkB;IACtC,MAAM,QAAQ,GAAG,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;IACxD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CACb,uDAAuD;YACrD,oFAAoF,CACvF,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,SAAkB;IAElB,MAAM,aAAa,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;IAE9C,MAAM,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IAChD,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC,SAAS,CAAC;QAC1C,IAAI,GAAG,GAAG,YAAY,EAAE,CAAC;YACvB,OAAO,MAAM,CAAC,QAAQ,CAAC;QACzB,CAAC;QACD,uCAAuC;QACvC,GAAG,CAAC,KAAK,CAAC,uCAAuC,EA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CAAC;YAC5B,+EAA+E;YAC/E,sEAAsE;YACtE,GAAG,CAAC,IAAI,CAAC,kDAAkD,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;YACxE,aAAa,CAAC,SAAS,CAAC,CAAC;YACzB,MAAM,aAAa,GAAG,MAAM,qBAAqB,CAAC,SAAS,CAAC,CAAC;YAC7D,OAAO,MAAM,SAAS,CAAC,aAAa,CAAC,CAAC;QACxC,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"execute-script.d.ts","sourceRoot":"","sources":["../../src/tools/execute-script.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAMpE;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAkIjE"}
1
+ {"version":3,"file":"execute-script.d.ts","sourceRoot":"","sources":["../../src/tools/execute-script.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AASpE;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAgJjE"}
@@ -2,6 +2,8 @@ import { z } from "zod";
2
2
  import { BackgroundScriptExecutor } from "@sonisoft/now-sdk-ext-core";
3
3
  import { withConnectionRetry } from "../common/connection.js";
4
4
  import { annotationsFor } from "../common/annotations.js";
5
+ /** The `code` core puts on ScriptScopeError. */
6
+ const SCRIPT_SCOPE_ERROR_CODE = "NEX_SCRIPT_SCOPE_UNAVAILABLE";
5
7
  /**
6
8
  * Registers the execute_script tool on the MCP server.
7
9
  *
@@ -15,13 +17,16 @@ export function registerExecuteScriptTool(server) {
15
17
  description: "Execute JavaScript on a ServiceNow instance using Scripts - Background " +
16
18
  "(the /sys.scripts.do endpoint). The script runs server-side with full " +
17
19
  "GlideSystem API access (gs, GlideRecord, GlideAggregate, GlideDateTime, " +
18
- "GlideUser, etc.). Use gs.print() or gs.info() to produce output.\n\n" +
20
+ "GlideUser, etc.). Use gs.info() to produce output (gs.print() also works in global, but prints nothing in a scoped app).\n\n" +
19
21
  "SCOPE BEHAVIOR: Scripts execute within the specified application scope. " +
20
22
  "When running in a scoped app (e.g., scope: 'x_myapp_custom'), you can " +
21
23
  "reference that scope's Script Includes and classes directly by name " +
22
24
  "(e.g., MyUtil.doSomething()) without fully-qualifying them. When running " +
23
25
  "in global scope, scoped classes must be fully-qualified " +
24
- "(e.g., x_myapp_custom.MyUtil.doSomething()).\n\n" +
26
+ "(e.g., x_myapp_custom.MyUtil.doSomething()). Only 'global' and applications " +
27
+ "developed on the instance (sys_app) can be used; installed store apps " +
28
+ "(sys_store_app) cannot — run in global and call their APIs fully-qualified. " +
29
+ "In a scoped app, use gs.info() for output: gs.print() is global-only.\n\n" +
25
30
  "IMPORTANT: This executes code directly on the ServiceNow instance. " +
26
31
  "Always review scripts before execution and prefer read-only operations " +
27
32
  "unless modification is explicitly intended.",
@@ -37,7 +42,7 @@ export function registerExecuteScriptTool(server) {
37
42
  script: z
38
43
  .string()
39
44
  .describe("The JavaScript code to execute on the ServiceNow instance. " +
40
- "Use gs.print() or gs.info() to output results — these are the only " +
45
+ "Use gs.info() (or, in global only, gs.print()) to output results — these are the only " +
41
46
  "ways to capture output from background scripts. The script runs in " +
42
47
  "the server-side Rhino engine with access to all ServiceNow server-side " +
43
48
  "APIs: GlideRecord, GlideAggregate, GlideDateTime, GlideUser, " +
@@ -46,9 +51,11 @@ export function registerExecuteScriptTool(server) {
46
51
  scope: z
47
52
  .string()
48
53
  .default("global")
49
- .describe("The application scope to execute the script in. Accepts either:\n" +
50
- '- A scope name (e.g., "global", "x_myapp_custom", "x_snc_app") — ' +
51
- "automatically resolved to the corresponding sys_id via the sys_scope table.\n" +
54
+ .describe("The application scope to execute the script in. Accepts:\n" +
55
+ '- "global" — the Global scope.\n' +
56
+ '- The scope of an application developed on the instance (a sys_app, e.g. ' +
57
+ '"x_myapp_custom") — resolved to its sys_id via the sys_app table. ' +
58
+ "Installed store apps (sys_store_app) are rejected with an explanation.\n" +
52
59
  "- A sys_id directly (32-character hex string) if already known.\n\n" +
53
60
  'Defaults to "global". Set this to the target app scope when you need ' +
54
61
  "to access scoped Script Includes, Business Rules, or other scoped " +
@@ -82,7 +89,7 @@ export function registerExecuteScriptTool(server) {
82
89
  content: [
83
90
  {
84
91
  type: "text",
85
- text: "Script executed but returned no output. If you expected output, make sure your script uses gs.print() or gs.info().",
92
+ text: "Script executed but returned no output. If you expected output, make sure your script uses gs.print() or gs.info() (gs.info() in a scoped app, where gs.print() prints nothing).",
86
93
  },
87
94
  ],
88
95
  };
@@ -108,11 +115,19 @@ export function registerExecuteScriptTool(server) {
108
115
  }
109
116
  catch (error) {
110
117
  const message = error instanceof Error ? error.message : String(error);
118
+ // An unusable scope (store app, typo, …) fails before the script is sent, and
119
+ // core's message already says why and what to do — say that, not "error
120
+ // executing script", which reads as if the script itself ran and failed.
121
+ // Matched by code, not by importing ScriptScopeError, so an older core
122
+ // without that export cannot break this module at load.
123
+ const isScopeError = error?.code === SCRIPT_SCOPE_ERROR_CODE;
111
124
  return {
112
125
  content: [
113
126
  {
114
127
  type: "text",
115
- text: `Error executing script: ${message}`,
128
+ text: isScopeError
129
+ ? `Script not run. ${message}`
130
+ : `Error executing script: ${message}`,
116
131
  },
117
132
  ],
118
133
  isError: true,
@@ -1 +1 @@
1
- {"version":3,"file":"execute-script.js","sourceRoot":"","sources":["../../src/tools/execute-script.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CAAC,MAAiB;IACzD,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ACxB,IAAI,MAAM,CAAC,eAAe,EAAE,CAAC;gBAC3B,UAAU,IAAI,0BAA0B,MAAM,CAAC,eAAe,GAAG,CAAC;YACpE,CAAC;YAED,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,UAAU,IAAI,6BAA6B;qBAClD;iBACF;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,OAAO,GACX,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACzD,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,2BAA2B,OAAO,EAAE;qBAC3C;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"execute-script.js","sourceRoot":"","sources":["../../src/tools/execute-script.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,gDAAgD;AAChD,MAAM,uBAAuB,GAAG,8BAA8B,CAAC;AAE/D;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CAAC,MAAiB;IACzD,MAAM,CAAC,YAAY,CACjB,gBAAgB,EAChB;QACE,WAAW,EAAE,cAAc,CAAC,gBAAgB,CAAC;QAC7C,KAAK,EAAE,2BAA2B;QAClC,WAAW,EACT,yEAAyE;YACzE,wEAAwE;YACxE,0EAA0E;YAC1E,8HAA8H;YAC9H,0EAA0E;YAC1E,wEAAwE;YACxE,sEAAsE;YACtE,2EAA2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I,EAAE,MAAe;wBACrB,IAAI,EAAE,UAAU,IAAI,6BAA6B;qBAClD;iBACF;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,OAAO,GACX,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACzD,8EAA8E;YAC9E,wEAAwE;YACxE,yEAAyE;YACzE,uEAAuE;YACvE,wDAAwD;YACxD,MAAM,YAAY,GACf,KAAmC,EAAE,IAAI,KAAK,uBAAuB,CAAC;YACzE,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,YAAY;4BAChB,CAAC,CAAC,mBAAmB,OAAO,EAAE;4BAC9B,CAAC,CAAC,2BAA2B,OAAO,EAAE;qBACzC;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonisoft/now-sdk-ext-mcp",
3
- "version": "4.8.0",
3
+ "version": "4.8.2",
4
4
  "description": "MCP server for interacting with ServiceNow instances via @sonisoft/now-sdk-ext-core",
5
5
  "keywords": [
6
6
  "servicenow",
@@ -48,8 +48,8 @@
48
48
  "@servicenow/sdk-cli": "4.9.2",
49
49
  "@servicenow/sdk-cli-core": "3.0.3",
50
50
  "@servicenow/sdk-core": "4.9.2",
51
- "@sonisoft/now-sdk-ext-core": "^6.4.1",
52
- "@sonisoft/sn-credstore": "1.1.0",
51
+ "@sonisoft/now-sdk-ext-core": "^6.6.2",
52
+ "@sonisoft/sn-credstore": "1.4.0",
53
53
  "zod": "^3.23.8"
54
54
  },
55
55
  "devDependencies": {