@sonisoft/now-sdk-ext-mcp 4.2.0 → 4.4.0
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/LICENSE +21 -0
- package/README.md +2 -1
- package/dist/common/annotations.d.ts +50 -0
- package/dist/common/annotations.d.ts.map +1 -0
- package/dist/common/annotations.js +193 -0
- package/dist/common/annotations.js.map +1 -0
- package/dist/common/connection.d.ts +10 -0
- package/dist/common/connection.d.ts.map +1 -1
- package/dist/common/connection.js +11 -0
- package/dist/common/connection.js.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/resources/servicenow.d.ts +32 -0
- package/dist/resources/servicenow.d.ts.map +1 -0
- package/dist/resources/servicenow.js +165 -0
- package/dist/resources/servicenow.js.map +1 -0
- package/dist/tools/aggregate.d.ts.map +1 -1
- package/dist/tools/aggregate.js +4 -0
- package/dist/tools/aggregate.js.map +1 -1
- package/dist/tools/app-manager.d.ts.map +1 -1
- package/dist/tools/app-manager.js +9 -0
- package/dist/tools/app-manager.js.map +1 -1
- package/dist/tools/atf.d.ts.map +1 -1
- package/dist/tools/atf.js +3 -0
- package/dist/tools/atf.js.map +1 -1
- package/dist/tools/attachment.d.ts.map +1 -1
- package/dist/tools/attachment.js +4 -0
- package/dist/tools/attachment.js.map +1 -1
- package/dist/tools/batch.d.ts.map +1 -1
- package/dist/tools/batch.js +3 -0
- package/dist/tools/batch.js.map +1 -1
- package/dist/tools/catalog.d.ts.map +1 -1
- package/dist/tools/catalog.js +7 -0
- package/dist/tools/catalog.js.map +1 -1
- package/dist/tools/cmdb.d.ts.map +1 -1
- package/dist/tools/cmdb.js +3 -0
- package/dist/tools/cmdb.js.map +1 -1
- package/dist/tools/codesearch.d.ts.map +1 -1
- package/dist/tools/codesearch.js +5 -0
- package/dist/tools/codesearch.js.map +1 -1
- package/dist/tools/discovery.d.ts.map +1 -1
- package/dist/tools/discovery.js +3 -0
- package/dist/tools/discovery.js.map +1 -1
- package/dist/tools/execute-script.d.ts.map +1 -1
- package/dist/tools/execute-script.js +2 -0
- package/dist/tools/execute-script.js.map +1 -1
- package/dist/tools/find-atf-tests.d.ts.map +1 -1
- package/dist/tools/find-atf-tests.js +2 -0
- package/dist/tools/find-atf-tests.js.map +1 -1
- package/dist/tools/flow.d.ts.map +1 -1
- package/dist/tools/flow.js +12 -0
- package/dist/tools/flow.js.map +1 -1
- package/dist/tools/health.d.ts.map +1 -1
- package/dist/tools/health.js +2 -0
- package/dist/tools/health.js.map +1 -1
- package/dist/tools/knowledge.d.ts.map +1 -1
- package/dist/tools/knowledge.js +10 -0
- package/dist/tools/knowledge.js.map +1 -1
- package/dist/tools/lookup-app.d.ts.map +1 -1
- package/dist/tools/lookup-app.js +2 -0
- package/dist/tools/lookup-app.js.map +1 -1
- package/dist/tools/lookup-columns.d.ts.map +1 -1
- package/dist/tools/lookup-columns.js +2 -0
- package/dist/tools/lookup-columns.js.map +1 -1
- package/dist/tools/lookup-table.d.ts.map +1 -1
- package/dist/tools/lookup-table.js +2 -0
- package/dist/tools/lookup-table.js.map +1 -1
- package/dist/tools/query-batch.d.ts.map +1 -1
- package/dist/tools/query-batch.js +3 -0
- package/dist/tools/query-batch.js.map +1 -1
- package/dist/tools/query-syslog.d.ts.map +1 -1
- package/dist/tools/query-syslog.js +2 -0
- package/dist/tools/query-syslog.js.map +1 -1
- package/dist/tools/query-table.d.ts.map +1 -1
- package/dist/tools/query-table.js +2 -0
- package/dist/tools/query-table.js.map +1 -1
- package/dist/tools/schema.d.ts.map +1 -1
- package/dist/tools/schema.js +4 -0
- package/dist/tools/schema.js.map +1 -1
- package/dist/tools/scope.d.ts.map +1 -1
- package/dist/tools/scope.js +4 -0
- package/dist/tools/scope.js.map +1 -1
- package/dist/tools/scriptsync.d.ts.map +1 -1
- package/dist/tools/scriptsync.js +3 -0
- package/dist/tools/scriptsync.js.map +1 -1
- package/dist/tools/task.d.ts.map +1 -1
- package/dist/tools/task.js +7 -0
- package/dist/tools/task.js.map +1 -1
- package/dist/tools/updateset.d.ts.map +1 -1
- package/dist/tools/updateset.js +8 -0
- package/dist/tools/updateset.js.map +1 -1
- package/dist/tools/workflow.d.ts.map +1 -1
- package/dist/tools/workflow.js +2 -0
- package/dist/tools/workflow.js.map +1 -1
- package/dist/tools/xml-record.d.ts.map +1 -1
- package/dist/tools/xml-record.js +3 -0
- package/dist/tools/xml-record.js.map +1 -1
- package/package.json +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 SoniSoft Inc
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -207,7 +207,8 @@ test/
|
|
|
207
207
|
|
|
208
208
|
### Adding a New Tool
|
|
209
209
|
|
|
210
|
-
1. Create a new file in `src/
|
|
210
|
+
1. Create a new file in `src/resources/ # servicenow:// read-only resources
|
|
211
|
+
src/tools/` (e.g., `src/tools/query-table.ts`).
|
|
211
212
|
2. Export a registration function:
|
|
212
213
|
|
|
213
214
|
```typescript
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool annotations — the machine-readable risk classification for every tool.
|
|
3
|
+
*
|
|
4
|
+
* Until now the only signal that a tool deletes records rather than reads them
|
|
5
|
+
* was prose in its description ("IMPORTANT: This PERMANENTLY DELETES..."). A
|
|
6
|
+
* host client cannot act on prose, so it had to prompt for all 86 tools equally
|
|
7
|
+
* — including `query_table` and `count_records`, which cannot change anything.
|
|
8
|
+
* Prompting uniformly trains people to click through, which is worse than not
|
|
9
|
+
* prompting at all.
|
|
10
|
+
*
|
|
11
|
+
* Kept as ONE table rather than inlined at 86 registration sites, because
|
|
12
|
+
* NEX-40 (role-based tool filtering) needs exactly the same central metadata.
|
|
13
|
+
* Building it twice would guarantee the two drift.
|
|
14
|
+
*
|
|
15
|
+
* These are HINTS, not guarantees. The authority on what a tool may do is the
|
|
16
|
+
* ServiceNow ACLs of the authenticated user; this only describes intent.
|
|
17
|
+
*
|
|
18
|
+
* ---
|
|
19
|
+
*
|
|
20
|
+
* Classification rules used here, since the spec defaults are easy to misread:
|
|
21
|
+
*
|
|
22
|
+
* - `readOnlyHint: true` — cannot modify anything. destructive/idempotent are
|
|
23
|
+
* meaningless alongside it and are omitted.
|
|
24
|
+
* - `destructiveHint` — DEFAULTS TO TRUE, so it must be set false explicitly for
|
|
25
|
+
* writes that only add. Reserved for operations that can lose or overwrite
|
|
26
|
+
* data that already existed.
|
|
27
|
+
* - `idempotentHint` — repeating the call with identical arguments leaves the
|
|
28
|
+
* same end state. True for "set this field to X"; false for "append a comment"
|
|
29
|
+
* or "create a record", which accumulate.
|
|
30
|
+
* - `openWorldHint` — reserved here for arbitrary code execution, where the
|
|
31
|
+
* effect is genuinely unbounded and cannot be inferred from the arguments.
|
|
32
|
+
*/
|
|
33
|
+
export interface ToolAnnotations {
|
|
34
|
+
readOnlyHint?: boolean;
|
|
35
|
+
destructiveHint?: boolean;
|
|
36
|
+
idempotentHint?: boolean;
|
|
37
|
+
openWorldHint?: boolean;
|
|
38
|
+
}
|
|
39
|
+
export declare const TOOL_ANNOTATIONS: Record<string, ToolAnnotations>;
|
|
40
|
+
/**
|
|
41
|
+
* Annotations for a tool.
|
|
42
|
+
*
|
|
43
|
+
* Throws on an unknown name rather than returning a permissive default. An
|
|
44
|
+
* unannotated tool would silently inherit the spec defaults — `readOnlyHint`
|
|
45
|
+
* false, `destructiveHint` TRUE — which is safe, but it would also mean a new
|
|
46
|
+
* tool could ship with no deliberate classification and nobody would notice.
|
|
47
|
+
* Failing at registration makes that impossible.
|
|
48
|
+
*/
|
|
49
|
+
export declare function annotationsFor(toolName: string): ToolAnnotations;
|
|
50
|
+
//# sourceMappingURL=annotations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotations.d.ts","sourceRoot":"","sources":["../../src/common/annotations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,MAAM,WAAW,eAAe;IAC5B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,OAAO,CAAC;CAC3B;AAyBD,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAmJ5D,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,eAAe,CAShE"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool annotations — the machine-readable risk classification for every tool.
|
|
3
|
+
*
|
|
4
|
+
* Until now the only signal that a tool deletes records rather than reads them
|
|
5
|
+
* was prose in its description ("IMPORTANT: This PERMANENTLY DELETES..."). A
|
|
6
|
+
* host client cannot act on prose, so it had to prompt for all 86 tools equally
|
|
7
|
+
* — including `query_table` and `count_records`, which cannot change anything.
|
|
8
|
+
* Prompting uniformly trains people to click through, which is worse than not
|
|
9
|
+
* prompting at all.
|
|
10
|
+
*
|
|
11
|
+
* Kept as ONE table rather than inlined at 86 registration sites, because
|
|
12
|
+
* NEX-40 (role-based tool filtering) needs exactly the same central metadata.
|
|
13
|
+
* Building it twice would guarantee the two drift.
|
|
14
|
+
*
|
|
15
|
+
* These are HINTS, not guarantees. The authority on what a tool may do is the
|
|
16
|
+
* ServiceNow ACLs of the authenticated user; this only describes intent.
|
|
17
|
+
*
|
|
18
|
+
* ---
|
|
19
|
+
*
|
|
20
|
+
* Classification rules used here, since the spec defaults are easy to misread:
|
|
21
|
+
*
|
|
22
|
+
* - `readOnlyHint: true` — cannot modify anything. destructive/idempotent are
|
|
23
|
+
* meaningless alongside it and are omitted.
|
|
24
|
+
* - `destructiveHint` — DEFAULTS TO TRUE, so it must be set false explicitly for
|
|
25
|
+
* writes that only add. Reserved for operations that can lose or overwrite
|
|
26
|
+
* data that already existed.
|
|
27
|
+
* - `idempotentHint` — repeating the call with identical arguments leaves the
|
|
28
|
+
* same end state. True for "set this field to X"; false for "append a comment"
|
|
29
|
+
* or "create a record", which accumulate.
|
|
30
|
+
* - `openWorldHint` — reserved here for arbitrary code execution, where the
|
|
31
|
+
* effect is genuinely unbounded and cannot be inferred from the arguments.
|
|
32
|
+
*/
|
|
33
|
+
/** Cannot modify anything. */
|
|
34
|
+
const READ = { readOnlyHint: true };
|
|
35
|
+
/** Adds something new; nothing pre-existing is lost. Repeating accumulates. */
|
|
36
|
+
const CREATE = { readOnlyHint: false, destructiveHint: false, idempotentHint: false };
|
|
37
|
+
/** Sets state to a given value. Nothing is destroyed; repeating is a no-op. */
|
|
38
|
+
const SET = { readOnlyHint: false, destructiveHint: false, idempotentHint: true };
|
|
39
|
+
/** Overwrites or removes data that already existed. Repeating settles. */
|
|
40
|
+
const OVERWRITE = { readOnlyHint: false, destructiveHint: true, idempotentHint: true };
|
|
41
|
+
/** Overwrites or removes, and repeating does NOT settle. */
|
|
42
|
+
const OVERWRITE_ONCE = { readOnlyHint: false, destructiveHint: true, idempotentHint: false };
|
|
43
|
+
/** Runs caller-supplied logic. Effect is unbounded and not inferable from args. */
|
|
44
|
+
const ARBITRARY = {
|
|
45
|
+
readOnlyHint: false,
|
|
46
|
+
destructiveHint: true,
|
|
47
|
+
idempotentHint: false,
|
|
48
|
+
openWorldHint: true,
|
|
49
|
+
};
|
|
50
|
+
export const TOOL_ANNOTATIONS = {
|
|
51
|
+
// ---- aggregate: server-side counts, no writes
|
|
52
|
+
count_records: READ,
|
|
53
|
+
aggregate_query: READ,
|
|
54
|
+
aggregate_grouped: READ,
|
|
55
|
+
// ---- app lifecycle
|
|
56
|
+
get_app_details: READ,
|
|
57
|
+
list_company_apps: READ,
|
|
58
|
+
search_store_apps: READ,
|
|
59
|
+
// Checks whether an install WOULD work; performs no install itself.
|
|
60
|
+
validate_app_install: READ,
|
|
61
|
+
// Installs change what code runs on the instance and can replace an existing
|
|
62
|
+
// version, so destructive even though nothing is "deleted" in a table sense.
|
|
63
|
+
install_store_app: OVERWRITE_ONCE,
|
|
64
|
+
update_store_app: OVERWRITE_ONCE,
|
|
65
|
+
install_from_app_repo: OVERWRITE_ONCE,
|
|
66
|
+
publish_to_app_repo: OVERWRITE_ONCE,
|
|
67
|
+
// ---- ATF: tests execute real logic against the instance and routinely
|
|
68
|
+
// create and modify records as part of running.
|
|
69
|
+
find_atf_tests: READ,
|
|
70
|
+
run_atf_test: OVERWRITE_ONCE,
|
|
71
|
+
run_atf_test_suite: OVERWRITE_ONCE,
|
|
72
|
+
// ---- attachments
|
|
73
|
+
list_attachments: READ,
|
|
74
|
+
get_attachment_info: READ,
|
|
75
|
+
upload_attachment: CREATE,
|
|
76
|
+
// ---- batch
|
|
77
|
+
batch_create_records: CREATE,
|
|
78
|
+
batch_update_records: OVERWRITE,
|
|
79
|
+
// ---- catalog
|
|
80
|
+
list_catalog_items: READ,
|
|
81
|
+
get_catalog_item: READ,
|
|
82
|
+
list_catalog_categories: READ,
|
|
83
|
+
get_catalog_category: READ,
|
|
84
|
+
list_catalog_item_variables: READ,
|
|
85
|
+
submit_catalog_request: CREATE,
|
|
86
|
+
// ---- CMDB
|
|
87
|
+
get_cmdb_relationships: READ,
|
|
88
|
+
traverse_cmdb_graph: READ,
|
|
89
|
+
// ---- code search
|
|
90
|
+
code_search: READ,
|
|
91
|
+
list_code_search_groups: READ,
|
|
92
|
+
list_code_search_tables: READ,
|
|
93
|
+
// Registering the same table twice leaves the same configuration.
|
|
94
|
+
add_code_search_table: SET,
|
|
95
|
+
// ---- discovery
|
|
96
|
+
list_instance_tables: READ,
|
|
97
|
+
list_plugins: READ,
|
|
98
|
+
// ---- scripting: arbitrary server-side JavaScript with the caller's rights.
|
|
99
|
+
execute_script: ARBITRARY,
|
|
100
|
+
// ---- flows: running one executes whatever the flow author wrote.
|
|
101
|
+
execute_flow: ARBITRARY,
|
|
102
|
+
execute_subflow: ARBITRARY,
|
|
103
|
+
execute_action: ARBITRARY,
|
|
104
|
+
test_flow: ARBITRARY,
|
|
105
|
+
get_flow_context_status: READ,
|
|
106
|
+
get_flow_outputs: READ,
|
|
107
|
+
get_flow_error: READ,
|
|
108
|
+
get_flow_execution_details: READ,
|
|
109
|
+
get_flow_logs: READ,
|
|
110
|
+
// Terminates a running execution; whatever it had not yet done is lost.
|
|
111
|
+
cancel_flow: OVERWRITE,
|
|
112
|
+
copy_flow: CREATE,
|
|
113
|
+
// ---- health
|
|
114
|
+
check_instance_health: READ,
|
|
115
|
+
// ---- knowledge
|
|
116
|
+
list_knowledge_bases: READ,
|
|
117
|
+
get_knowledge_base: READ,
|
|
118
|
+
list_kb_categories: READ,
|
|
119
|
+
create_kb_category: CREATE,
|
|
120
|
+
list_kb_articles: READ,
|
|
121
|
+
get_kb_article: READ,
|
|
122
|
+
create_kb_article: CREATE,
|
|
123
|
+
update_kb_article: OVERWRITE,
|
|
124
|
+
// A state transition to published; repeating leaves it published.
|
|
125
|
+
publish_kb_article: SET,
|
|
126
|
+
// ---- lookups
|
|
127
|
+
lookup_app: READ,
|
|
128
|
+
lookup_columns: READ,
|
|
129
|
+
lookup_table: READ,
|
|
130
|
+
// ---- bulk query operations: dry-run by default, but confirm=true is the
|
|
131
|
+
// most destructive thing in the surface after execute_script.
|
|
132
|
+
query_update_records: OVERWRITE,
|
|
133
|
+
query_delete_records: OVERWRITE,
|
|
134
|
+
// ---- plain queries
|
|
135
|
+
query_syslog: READ,
|
|
136
|
+
query_table: READ,
|
|
137
|
+
// ---- schema
|
|
138
|
+
discover_table_schema: READ,
|
|
139
|
+
explain_field: READ,
|
|
140
|
+
validate_catalog: READ,
|
|
141
|
+
// ---- scope
|
|
142
|
+
get_current_scope: READ,
|
|
143
|
+
list_scoped_apps: READ,
|
|
144
|
+
set_current_scope: SET,
|
|
145
|
+
// ---- script sync
|
|
146
|
+
// Writes to the LOCAL filesystem and will overwrite an existing file. Read-only
|
|
147
|
+
// with respect to ServiceNow, but "read-only" means the environment, not the
|
|
148
|
+
// instance.
|
|
149
|
+
pull_script: OVERWRITE,
|
|
150
|
+
// Overwrites the script record on the instance.
|
|
151
|
+
push_script: OVERWRITE,
|
|
152
|
+
// ---- tasks: field updates and appends
|
|
153
|
+
find_task: READ,
|
|
154
|
+
// Appends; calling twice leaves two comments.
|
|
155
|
+
add_task_comment: CREATE,
|
|
156
|
+
assign_task: SET,
|
|
157
|
+
resolve_incident: SET,
|
|
158
|
+
close_incident: SET,
|
|
159
|
+
approve_change: SET,
|
|
160
|
+
// ---- update sets
|
|
161
|
+
get_current_update_set: READ,
|
|
162
|
+
list_update_sets: READ,
|
|
163
|
+
inspect_update_set: READ,
|
|
164
|
+
create_update_set: CREATE,
|
|
165
|
+
set_current_update_set: SET,
|
|
166
|
+
clone_update_set: CREATE,
|
|
167
|
+
// Relocates customisations out of one update set into another.
|
|
168
|
+
move_update_set_records: OVERWRITE,
|
|
169
|
+
// ---- workflow
|
|
170
|
+
create_workflow: CREATE,
|
|
171
|
+
// ---- XML
|
|
172
|
+
export_record_xml: READ,
|
|
173
|
+
// Imports can update existing records, matched by sys_id.
|
|
174
|
+
import_records_xml: OVERWRITE_ONCE,
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* Annotations for a tool.
|
|
178
|
+
*
|
|
179
|
+
* Throws on an unknown name rather than returning a permissive default. An
|
|
180
|
+
* unannotated tool would silently inherit the spec defaults — `readOnlyHint`
|
|
181
|
+
* false, `destructiveHint` TRUE — which is safe, but it would also mean a new
|
|
182
|
+
* tool could ship with no deliberate classification and nobody would notice.
|
|
183
|
+
* Failing at registration makes that impossible.
|
|
184
|
+
*/
|
|
185
|
+
export function annotationsFor(toolName) {
|
|
186
|
+
const annotations = TOOL_ANNOTATIONS[toolName];
|
|
187
|
+
if (!annotations) {
|
|
188
|
+
throw new Error(`No annotations defined for tool "${toolName}". Add it to TOOL_ANNOTATIONS ` +
|
|
189
|
+
`in src/common/annotations.ts — every tool must declare whether it is read-only.`);
|
|
190
|
+
}
|
|
191
|
+
return annotations;
|
|
192
|
+
}
|
|
193
|
+
//# sourceMappingURL=annotations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotations.js","sourceRoot":"","sources":["../../src/common/annotations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AASH,8BAA8B;AAC9B,MAAM,IAAI,GAAoB,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;AAErD,+EAA+E;AAC/E,MAAM,MAAM,GAAoB,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,cAAc,EAAE,KAA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?: string): Promise<Servi
|
|
|
17
17
|
* creates a fresh connection.
|
|
18
18
|
*/
|
|
19
19
|
export declare function clearInstance(authAlias?: string): void;
|
|
20
|
+
/** Patterns that indicate a connection/session problem worth retrying. */
|
|
21
|
+
/** Set by sn-credstore's shim once it has taken over credential storage. */
|
|
22
|
+
export declare const CRED_STORE_PATCHED_ENV = "NOW_SDK_KEYCHAIN_PATCHED";
|
|
23
|
+
/**
|
|
24
|
+
* True when credentials come from sn-credstore rather than the OS keyring.
|
|
25
|
+
*
|
|
26
|
+
* Exported so callers do not re-spell the variable name and the "=== 1"
|
|
27
|
+
* convention; both were already duplicated once.
|
|
28
|
+
*/
|
|
29
|
+
export declare function isCredStoreActive(): boolean;
|
|
20
30
|
/**
|
|
21
31
|
* Returns true if an HTTP response indicates a stale or dead session.
|
|
22
32
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../src/common/connection.ts"],"names":[],"mappings":"AACA,OAAO,EACL,kBAAkB,EAEnB,MAAM,4BAA4B,CAAC;AA4BpC;;;;;;;;;;;GAWG;AACH,wBAAsB,qBAAqB,CACzC,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,kBAAkB,CAAC,CAkD7B;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAKtD;
|
|
1
|
+
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../src/common/connection.ts"],"names":[],"mappings":"AACA,OAAO,EACL,kBAAkB,EAEnB,MAAM,4BAA4B,CAAC;AA4BpC;;;;;;;;;;;GAWG;AACH,wBAAsB,qBAAqB,CACzC,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,kBAAkB,CAAC,CAkD7B;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAKtD;AAED,0EAA0E;AAC1E,4EAA4E;AAC5E,eAAO,MAAM,sBAAsB,6BAA6B,CAAC;AAEjE;;;;;GAKG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C;AAeD;;GAEG;AACH,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"}
|
|
@@ -81,6 +81,17 @@ export function clearInstance(authAlias) {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
/** Patterns that indicate a connection/session problem worth retrying. */
|
|
84
|
+
/** Set by sn-credstore's shim once it has taken over credential storage. */
|
|
85
|
+
export const CRED_STORE_PATCHED_ENV = "NOW_SDK_KEYCHAIN_PATCHED";
|
|
86
|
+
/**
|
|
87
|
+
* True when credentials come from sn-credstore rather than the OS keyring.
|
|
88
|
+
*
|
|
89
|
+
* Exported so callers do not re-spell the variable name and the "=== 1"
|
|
90
|
+
* convention; both were already duplicated once.
|
|
91
|
+
*/
|
|
92
|
+
export function isCredStoreActive() {
|
|
93
|
+
return process.env[CRED_STORE_PATCHED_ENV] === "1";
|
|
94
|
+
}
|
|
84
95
|
const RETRYABLE_PATTERNS = /ECONNREFUSED|ECONNRESET|ETIMEDOUT|EPIPE|socket hang up|fetch failed|No response|Body not XML/i;
|
|
85
96
|
/**
|
|
86
97
|
* Returns true if the error looks like a transient connection or stale-session
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../../src/common/connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,c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;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,SAA6B,EAC7B,SAAuD;IAEvD,MAAM,UAAU,GAAG,MAAM,qBAAqB,CAAC,SAAS,CAAC,CAAC;IAC1D,IAAI,CAAC;QACH,OAAO,MAAM,SAAS,CAAC,UAAU,CAAC,CAAC;IACrC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;YAC5B,OAAO,CAAC,KAAK,CACX,2EAA2E,KAAK,EAAE,CACnF,CAAC;YACF,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"}
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// non-interactive child process, where the keyring cannot be unlocked.
|
|
5
5
|
import "./common/credstore-boot.js";
|
|
6
6
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
7
|
+
import { registerServiceNowResources } from "./resources/servicenow.js";
|
|
7
8
|
import { readServerVersion } from "./common/version.js";
|
|
8
9
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
9
10
|
import { registerExecuteScriptTool } from "./tools/execute-script.js";
|
|
@@ -44,8 +45,10 @@ const server = new McpServer({
|
|
|
44
45
|
// to advertise for it; the server just has to honour the token when it is sent.
|
|
45
46
|
capabilities: {
|
|
46
47
|
tools: {},
|
|
48
|
+
resources: {},
|
|
47
49
|
},
|
|
48
50
|
});
|
|
51
|
+
registerServiceNowResources(server);
|
|
49
52
|
// Register tools
|
|
50
53
|
registerExecuteScriptTool(server);
|
|
51
54
|
registerRunAtfTestTool(server);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read-only MCP resources over `servicenow://` URIs.
|
|
3
|
+
*
|
|
4
|
+
* Resources are for stable, addressable reference data a client may want to
|
|
5
|
+
* attach directly — table schemas, the current scope, the alias list. Tools stay
|
|
6
|
+
* for actions. Before this, every one of those required a tool call, which costs
|
|
7
|
+
* a round trip and puts transient reference data into the conversation as tool
|
|
8
|
+
* output.
|
|
9
|
+
*
|
|
10
|
+
* TWO RULES SHAPE EVERYTHING HERE:
|
|
11
|
+
*
|
|
12
|
+
* 1. Each resource is backed by the SAME core manager as its equivalent tool,
|
|
13
|
+
* and goes through `withConnectionRetry` exactly as tools do. A parallel
|
|
14
|
+
* fetch path is how you end up with a resource that returns nothing for
|
|
15
|
+
* users of the recommended credential setup while the tool beside it works.
|
|
16
|
+
*
|
|
17
|
+
* 2. Errors PROPAGATE rather than being returned as content. Tools return
|
|
18
|
+
* `{isError: true}` so a failure is visible in-band to a model that is
|
|
19
|
+
* reasoning about the result; a resource is attached, not reasoned over, so a
|
|
20
|
+
* failed read is a protocol error and the client decides how to surface it.
|
|
21
|
+
* Returning a JSON body describing a failure would look like successfully
|
|
22
|
+
* attached content that happens to say "failed".
|
|
23
|
+
*
|
|
24
|
+
* 3. The alias is part of the URI, not an implicit default. Tools take an
|
|
25
|
+
* optional `instance` argument; a resource has only its URI, so the instance
|
|
26
|
+
* has to be addressable — `servicenow://dev/schema/incident` is a different
|
|
27
|
+
* resource from `servicenow://prod/schema/incident`, and conflating them
|
|
28
|
+
* would be the cross-instance confusion the core guard exists to prevent.
|
|
29
|
+
*/
|
|
30
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
31
|
+
export declare function registerServiceNowResources(server: McpServer): void;
|
|
32
|
+
//# sourceMappingURL=servicenow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"servicenow.d.ts","sourceRoot":"","sources":["../../src/resources/servicenow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,SAAS,EAAoB,MAAM,yCAAyC,CAAC;AAqJtF,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA+CnE"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read-only MCP resources over `servicenow://` URIs.
|
|
3
|
+
*
|
|
4
|
+
* Resources are for stable, addressable reference data a client may want to
|
|
5
|
+
* attach directly — table schemas, the current scope, the alias list. Tools stay
|
|
6
|
+
* for actions. Before this, every one of those required a tool call, which costs
|
|
7
|
+
* a round trip and puts transient reference data into the conversation as tool
|
|
8
|
+
* output.
|
|
9
|
+
*
|
|
10
|
+
* TWO RULES SHAPE EVERYTHING HERE:
|
|
11
|
+
*
|
|
12
|
+
* 1. Each resource is backed by the SAME core manager as its equivalent tool,
|
|
13
|
+
* and goes through `withConnectionRetry` exactly as tools do. A parallel
|
|
14
|
+
* fetch path is how you end up with a resource that returns nothing for
|
|
15
|
+
* users of the recommended credential setup while the tool beside it works.
|
|
16
|
+
*
|
|
17
|
+
* 2. Errors PROPAGATE rather than being returned as content. Tools return
|
|
18
|
+
* `{isError: true}` so a failure is visible in-band to a model that is
|
|
19
|
+
* reasoning about the result; a resource is attached, not reasoned over, so a
|
|
20
|
+
* failed read is a protocol error and the client decides how to surface it.
|
|
21
|
+
* Returning a JSON body describing a failure would look like successfully
|
|
22
|
+
* attached content that happens to say "failed".
|
|
23
|
+
*
|
|
24
|
+
* 3. The alias is part of the URI, not an implicit default. Tools take an
|
|
25
|
+
* optional `instance` argument; a resource has only its URI, so the instance
|
|
26
|
+
* has to be addressable — `servicenow://dev/schema/incident` is a different
|
|
27
|
+
* resource from `servicenow://prod/schema/incident`, and conflating them
|
|
28
|
+
* would be the cross-instance confusion the core guard exists to prevent.
|
|
29
|
+
*/
|
|
30
|
+
import { ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
31
|
+
import { ScopeManager, UpdateSetManager, SchemaDiscovery } from "@sonisoft/now-sdk-ext-core";
|
|
32
|
+
import { listAliases } from "@sonisoft/sn-credstore";
|
|
33
|
+
import { withConnectionRetry, isCredStoreActive } from "../common/connection.js";
|
|
34
|
+
/**
|
|
35
|
+
* Projects an alias onto exactly the fields intended for publication.
|
|
36
|
+
*
|
|
37
|
+
* `listAliases` is documented as returning metadata only, and today it does.
|
|
38
|
+
* This does not rely on that. It is a positive allowlist rather than a filter,
|
|
39
|
+
* so a field added upstream is omitted by default instead of published by
|
|
40
|
+
* default — and this is the single most attachable resource in the server, the
|
|
41
|
+
* one most likely to be pasted wholesale into a conversation.
|
|
42
|
+
*/
|
|
43
|
+
function publicAliasFields(alias) {
|
|
44
|
+
return {
|
|
45
|
+
alias: alias.alias,
|
|
46
|
+
isDefault: alias.isDefault,
|
|
47
|
+
type: alias.type,
|
|
48
|
+
instanceUrl: alias.instanceUrl,
|
|
49
|
+
...(alias.username === undefined ? {} : { username: alias.username }),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function json(uri, body) {
|
|
53
|
+
return {
|
|
54
|
+
contents: [
|
|
55
|
+
{
|
|
56
|
+
uri,
|
|
57
|
+
mimeType: "application/json",
|
|
58
|
+
text: JSON.stringify(body, null, 2),
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* `servicenow://instances` — which instances this server can serve.
|
|
65
|
+
*
|
|
66
|
+
* Deliberately reports WHICH STORE it read. When the sn-credstore shim is not
|
|
67
|
+
* active the SDK's OS keyring is authoritative, and that cannot be enumerated —
|
|
68
|
+
* so the alias list is reported as unavailable rather than as empty. An empty
|
|
69
|
+
* list would read as "no credentials configured", which is precisely the
|
|
70
|
+
* ambiguity sn-credstore exists to remove.
|
|
71
|
+
*
|
|
72
|
+
* Contains no secret material: `listAliases` returns metadata only.
|
|
73
|
+
*/
|
|
74
|
+
function registerInstancesResource(server) {
|
|
75
|
+
server.registerResource("instances", "servicenow://instances", {
|
|
76
|
+
title: "Configured ServiceNow instances",
|
|
77
|
+
description: "Aliases this server can connect to, the alias used when a tool omits one, " +
|
|
78
|
+
"and which credential store those aliases were read from. Contains no secrets.",
|
|
79
|
+
mimeType: "application/json",
|
|
80
|
+
}, async (uri) => {
|
|
81
|
+
const shimActive = isCredStoreActive();
|
|
82
|
+
const defaultAlias = process.env.SN_AUTH_ALIAS ?? null;
|
|
83
|
+
if (!shimActive) {
|
|
84
|
+
return json(uri.href, {
|
|
85
|
+
defaultAlias,
|
|
86
|
+
credentialStore: "os-keyring",
|
|
87
|
+
aliases: null,
|
|
88
|
+
note: "The sn-credstore shim is not active, so credentials come from the OS " +
|
|
89
|
+
"keyring, which cannot be enumerated. This is not the same as having no " +
|
|
90
|
+
"credentials. Set SN_CRED_STORE_ENABLE=1 to read from sn-credstore instead.",
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
try {
|
|
94
|
+
const summary = await listAliases();
|
|
95
|
+
return json(uri.href, {
|
|
96
|
+
defaultAlias,
|
|
97
|
+
credentialStore: "sn-credstore",
|
|
98
|
+
aliases: summary.aliases.map(publicAliasFields),
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
// A store that cannot be read is a finding to report, not an
|
|
103
|
+
// empty list to hand back.
|
|
104
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
105
|
+
return json(uri.href, {
|
|
106
|
+
defaultAlias,
|
|
107
|
+
credentialStore: "sn-credstore",
|
|
108
|
+
aliases: null,
|
|
109
|
+
error: message,
|
|
110
|
+
remediation: error?.remediation,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Registers one alias-scoped resource template.
|
|
117
|
+
*
|
|
118
|
+
* `list` is explicitly `undefined` rather than omitted: the SDK requires the key
|
|
119
|
+
* so that forgetting to enumerate is a decision rather than an oversight. These
|
|
120
|
+
* cannot be enumerated anyway — listing every table on an instance would be a
|
|
121
|
+
* very expensive `resources/list`.
|
|
122
|
+
*/
|
|
123
|
+
function registerAliasScopedResource(server, name, uriTemplate, title, description, read) {
|
|
124
|
+
server.registerResource(name, new ResourceTemplate(uriTemplate, { list: undefined }), { title, description, mimeType: "application/json" }, async (uri, vars) => {
|
|
125
|
+
// UriTemplate yields string | string[] per variable; these templates
|
|
126
|
+
// only ever declare single-valued segments.
|
|
127
|
+
const flat = {};
|
|
128
|
+
for (const [k, v] of Object.entries(vars)) {
|
|
129
|
+
flat[k] = Array.isArray(v) ? v[0] : v;
|
|
130
|
+
}
|
|
131
|
+
const alias = flat.alias;
|
|
132
|
+
// The URI owning the alias is the headline guarantee of this module,
|
|
133
|
+
// and without this it would rest on an SDK implementation detail:
|
|
134
|
+
// resolveAlias() in connection.ts falls back on a FALSY alias
|
|
135
|
+
// (`authAlias || process.env.SN_AUTH_ALIAS`), so an empty capture
|
|
136
|
+
// would silently resolve against the ambient default — the exact
|
|
137
|
+
// cross-instance confusion this design prevents.
|
|
138
|
+
//
|
|
139
|
+
// Verified that the current SDK matcher returns null rather than an
|
|
140
|
+
// empty capture for `servicenow:///scope/current`, so this is not
|
|
141
|
+
// reachable today. It is here so the guarantee is local rather than
|
|
142
|
+
// dependent on that staying true.
|
|
143
|
+
if (!alias) {
|
|
144
|
+
throw new Error(`Resource URI ${uri.href} has no instance alias. ` +
|
|
145
|
+
`Use servicenow://<alias>/... — the alias is never inferred from the environment.`);
|
|
146
|
+
}
|
|
147
|
+
return json(uri.href, await read(alias, flat));
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
export function registerServiceNowResources(server) {
|
|
151
|
+
registerInstancesResource(server);
|
|
152
|
+
registerAliasScopedResource(server, "current-scope", "servicenow://{alias}/scope/current", "Current application scope", "The application scope currently selected on the instance, as get_current_scope reports it.", async (alias) => withConnectionRetry(alias, async (snInstance) => new ScopeManager(snInstance).getCurrentApplication()));
|
|
153
|
+
registerAliasScopedResource(server, "current-update-set", "servicenow://{alias}/update-set/current", "Current update set", "The update set currently capturing changes, as get_current_update_set reports it.", async (alias) => withConnectionRetry(alias, async (snInstance) => new UpdateSetManager(snInstance).getCurrentUpdateSet()));
|
|
154
|
+
registerAliasScopedResource(server, "table-schema", "servicenow://{alias}/schema/{table}", "Table schema", "Fields, types and references for a table. Mirrors discover_table_schema with its " +
|
|
155
|
+
"optional sections off, so this stays cheap enough to attach as context.", async (alias, vars) => withConnectionRetry(alias, async (snInstance) => new SchemaDiscovery(snInstance).discoverTableSchema(vars.table, {
|
|
156
|
+
// The expensive sections are opt-in on the tool for good reason;
|
|
157
|
+
// a resource is attached rather than deliberately invoked, so it
|
|
158
|
+
// should not silently pull choices and business rules too.
|
|
159
|
+
includeChoiceTables: false,
|
|
160
|
+
includeRelationships: false,
|
|
161
|
+
includeUIPolicies: false,
|
|
162
|
+
includeBusinessRules: false,
|
|
163
|
+
})));
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=servicenow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"servicenow.js","sourceRoot":"","sources":["../../src/resources/servicenow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAa,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7F,OAAO,EAAE,WAAW,EAAa,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjF;;;;;;;;GAQG;AACH,SAAS,iBAAiB,CAAC,KAAgB;IACvC,OAAO;QACH,KAAK,EAAE,KAA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EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,CAC5C,IAAI,eAAe,CAAC,UAAU,CAAC,CAAC,mBAAmB,CAAC,IAAI,CAAC,KAAK,EAAE;QAC5D,iEAAiE;QACjE,iEAAiE;QACjE,2DAA2D;QAC3D,mBAAmB,EAAE,KAAK;QAC1B,oBAAoB,EAAE,KAAK;QAC3B,iBAAiB,EAAE,KAAK;QACxB,oBAAoB,EAAE,KAAK;KAC9B,CAAC,CACL,CACR,CAAC;AACN,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aggregate.d.ts","sourceRoot":"","sources":["../../src/tools/aggregate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"aggregate.d.ts","sourceRoot":"","sources":["../../src/tools/aggregate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAMpE;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAoEhE;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAsHlE;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAiJpE"}
|