servicenow-mcp-server 2.1.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/.claude/settings.local.json +70 -0
- package/CLAUDE.md +777 -0
- package/LICENSE +21 -0
- package/README.md +562 -0
- package/assets/logo.svg +385 -0
- package/config/servicenow-instances.json.example +28 -0
- package/docs/403_TROUBLESHOOTING.md +329 -0
- package/docs/API_REFERENCE.md +1142 -0
- package/docs/APPLICATION_SCOPE_VALIDATION.md +681 -0
- package/docs/CLAUDE_DESKTOP_SETUP.md +373 -0
- package/docs/CONVENIENCE_TOOLS.md +601 -0
- package/docs/CONVENIENCE_TOOLS_SUMMARY.md +371 -0
- package/docs/FLOW_DESIGNER_GUIDE.md +1021 -0
- package/docs/IMPLEMENTATION_COMPLETE.md +165 -0
- package/docs/INSTANCE_SWITCHING_GUIDE.md +219 -0
- package/docs/MULTI_INSTANCE_CONFIGURATION.md +185 -0
- package/docs/NATURAL_LANGUAGE_SEARCH_IMPLEMENTATION.md +221 -0
- package/docs/PUPPETEER_INTEGRATION_PROPOSAL.md +1322 -0
- package/docs/QUICK_REFERENCE.md +395 -0
- package/docs/README.md +75 -0
- package/docs/RESOURCES_ARCHITECTURE.md +392 -0
- package/docs/RESOURCES_IMPLEMENTATION.md +276 -0
- package/docs/RESOURCES_SUMMARY.md +104 -0
- package/docs/SETUP_GUIDE.md +104 -0
- package/docs/UI_OPERATIONS_ARCHITECTURE.md +1219 -0
- package/docs/UI_OPERATIONS_DECISION_MATRIX.md +542 -0
- package/docs/UI_OPERATIONS_SUMMARY.md +507 -0
- package/docs/UPDATE_SET_VALIDATION.md +598 -0
- package/docs/UPDATE_SET_VALIDATION_SUMMARY.md +209 -0
- package/docs/VALIDATION_SUMMARY.md +479 -0
- package/jest.config.js +24 -0
- package/package.json +61 -0
- package/scripts/background_script_2025-09-29T20-19-35-101Z.js +23 -0
- package/scripts/link_ui_policy_actions_2025-09-29T20-17-15-218Z.js +90 -0
- package/scripts/set_update_set_Integration_Governance_Framework_2025-09-29T19-47-06-790Z.js +30 -0
- package/scripts/set_update_set_Integration_Governance_Framework_2025-09-29T19-59-33-152Z.js +30 -0
- package/scripts/set_update_set_current_2025-09-29T20-16-59-675Z.js +24 -0
- package/scripts/test_sys_dictionary_403.js +85 -0
- package/setup/setup-report.json +5313 -0
- package/src/config/comprehensive-table-definitions.json +2575 -0
- package/src/config/instance-config.json +4693 -0
- package/src/config/prompts.md +59 -0
- package/src/config/table-definitions.json +4681 -0
- package/src/config-manager.js +146 -0
- package/src/mcp-server-consolidated.js +2894 -0
- package/src/natural-language.js +472 -0
- package/src/resources.js +326 -0
- package/src/script-sync.js +428 -0
- package/src/server.js +125 -0
- package/src/servicenow-client.js +1625 -0
- package/src/stdio-server.js +52 -0
- package/start-mcp.sh +7 -0
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
# 403 Forbidden Error Troubleshooting Guide
|
|
2
|
+
|
|
3
|
+
**Last Updated:** 2025-09-29
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Issue: sys_dictionary 403 Errors
|
|
8
|
+
|
|
9
|
+
### Symptoms
|
|
10
|
+
- REST API calls to create `sys_dictionary` records return 403 Forbidden
|
|
11
|
+
- Error message: "User Not Authorized" or "Failed ACL Validation"
|
|
12
|
+
- Previously working operations now fail
|
|
13
|
+
|
|
14
|
+
### Root Causes
|
|
15
|
+
|
|
16
|
+
1. **Missing ACL Permissions**
|
|
17
|
+
- System tables like `sys_dictionary` require special permissions
|
|
18
|
+
- CREATE operations need explicit ACL grants
|
|
19
|
+
- Standard API roles don't include system table create permissions
|
|
20
|
+
|
|
21
|
+
2. **ServiceNow Version Changes**
|
|
22
|
+
- ACL permissions may change between versions
|
|
23
|
+
- Security hardening in newer versions
|
|
24
|
+
- Default roles may have been restricted
|
|
25
|
+
|
|
26
|
+
3. **Role Changes**
|
|
27
|
+
- API user's roles may have been modified
|
|
28
|
+
- Organization security policy changes
|
|
29
|
+
- ACL modifications by admins
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Quick Diagnosis
|
|
34
|
+
|
|
35
|
+
### Step 1: Test with Admin User
|
|
36
|
+
```bash
|
|
37
|
+
# Try the same operation with admin credentials
|
|
38
|
+
# If it works → Permission issue
|
|
39
|
+
# If it fails → Different problem (API issue, table doesn't exist, etc.)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Step 2: Check System Logs
|
|
43
|
+
```
|
|
44
|
+
Navigate to: System Logs → REST
|
|
45
|
+
Filter: Your API username
|
|
46
|
+
Look for: ACL validation failures
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Step 3: Check User Roles
|
|
50
|
+
```
|
|
51
|
+
Navigate to: User Administration → Users → [Your API User]
|
|
52
|
+
Verify roles include:
|
|
53
|
+
- web_service_admin (for REST API access)
|
|
54
|
+
- rest_api_explorer (for Table API)
|
|
55
|
+
- personalize_dictionary (for sys_dictionary access)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Solutions
|
|
61
|
+
|
|
62
|
+
### Solution 1: Grant personalize_dictionary Role ⚡ FASTEST
|
|
63
|
+
|
|
64
|
+
**When to Use:** Development/testing environments, trusted users
|
|
65
|
+
|
|
66
|
+
**Steps:**
|
|
67
|
+
1. Navigate to: `User Administration → Users`
|
|
68
|
+
2. Search for your API user
|
|
69
|
+
3. Click on the user
|
|
70
|
+
4. Under "Roles" tab, click "Edit"
|
|
71
|
+
5. Add role: `personalize_dictionary`
|
|
72
|
+
6. Click "Save"
|
|
73
|
+
|
|
74
|
+
**⚠️ Warning:** This grants FULL read/write access to dictionary tables
|
|
75
|
+
|
|
76
|
+
**Test:**
|
|
77
|
+
```bash
|
|
78
|
+
# Test API call
|
|
79
|
+
curl -X POST https://your-instance.service-now.com/api/now/table/sys_dictionary \
|
|
80
|
+
-H "Content-Type: application/json" \
|
|
81
|
+
-H "Authorization: Basic <your-base64-creds>" \
|
|
82
|
+
-d '{
|
|
83
|
+
"name": "test_table",
|
|
84
|
+
"element": "test_field",
|
|
85
|
+
"column_label": "Test Field",
|
|
86
|
+
"internal_type": "string",
|
|
87
|
+
"max_length": 40
|
|
88
|
+
}'
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
### Solution 2: Create Custom ACL 🔒 RECOMMENDED
|
|
94
|
+
|
|
95
|
+
**When to Use:** Production environments, principle of least privilege
|
|
96
|
+
|
|
97
|
+
**Steps:**
|
|
98
|
+
|
|
99
|
+
#### A. Create Custom Role
|
|
100
|
+
1. Navigate to: `User Administration → Roles`
|
|
101
|
+
2. Click "New"
|
|
102
|
+
3. Set:
|
|
103
|
+
- **Name:** `x_custom_dictionary_api`
|
|
104
|
+
- **Description:** "API access for dictionary operations"
|
|
105
|
+
4. Click "Submit"
|
|
106
|
+
|
|
107
|
+
#### B. Create ACL for CREATE Operation
|
|
108
|
+
1. **Elevate to security_admin:**
|
|
109
|
+
- Click your name (top right)
|
|
110
|
+
- Select "Elevate Role"
|
|
111
|
+
- Choose "security_admin"
|
|
112
|
+
- Enter password
|
|
113
|
+
|
|
114
|
+
2. **Navigate to:** `System Security → Access Control (ACL)`
|
|
115
|
+
3. **Click "New"**
|
|
116
|
+
4. **Set:**
|
|
117
|
+
- **Type:** record
|
|
118
|
+
- **Operation:** create
|
|
119
|
+
- **Name:** sys_dictionary
|
|
120
|
+
- **Description:** "Allow custom role to create dictionary entries"
|
|
121
|
+
- **Active:** true
|
|
122
|
+
5. **Under "Requires role" tab:**
|
|
123
|
+
- Add role: `x_custom_dictionary_api`
|
|
124
|
+
6. **Click "Submit"**
|
|
125
|
+
|
|
126
|
+
#### C. Assign Role to API User
|
|
127
|
+
1. Navigate to: `User Administration → Users`
|
|
128
|
+
2. Find your API user
|
|
129
|
+
3. Add role: `x_custom_dictionary_api`
|
|
130
|
+
4. Save
|
|
131
|
+
|
|
132
|
+
#### D. Test
|
|
133
|
+
```bash
|
|
134
|
+
# Test the same API call as above
|
|
135
|
+
# Should now succeed
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
### Solution 3: Use Fix Script 📝 WORKAROUND
|
|
141
|
+
|
|
142
|
+
**When to Use:** Cannot modify ACLs, temporary solution, one-off operations
|
|
143
|
+
|
|
144
|
+
**Steps:**
|
|
145
|
+
|
|
146
|
+
1. **Generate fix script using MCP:**
|
|
147
|
+
```javascript
|
|
148
|
+
await mcp__servicenow_nodejs__SN_Create_Fix_Script({
|
|
149
|
+
script_name: "create_dictionary_entries",
|
|
150
|
+
description: "Create dictionary entries for custom table",
|
|
151
|
+
script_content: `
|
|
152
|
+
// Dictionary entries to create
|
|
153
|
+
var entries = [
|
|
154
|
+
{
|
|
155
|
+
name: 'u_custom_table',
|
|
156
|
+
element: 'u_field1',
|
|
157
|
+
column_label: 'Field 1',
|
|
158
|
+
internal_type: 'string',
|
|
159
|
+
max_length: 40
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
name: 'u_custom_table',
|
|
163
|
+
element: 'u_field2',
|
|
164
|
+
column_label: 'Field 2',
|
|
165
|
+
internal_type: 'integer'
|
|
166
|
+
}
|
|
167
|
+
];
|
|
168
|
+
|
|
169
|
+
entries.forEach(function(entry) {
|
|
170
|
+
var gr = new GlideRecord('sys_dictionary');
|
|
171
|
+
gr.initialize();
|
|
172
|
+
gr.name = entry.name;
|
|
173
|
+
gr.element = entry.element;
|
|
174
|
+
gr.column_label = entry.column_label;
|
|
175
|
+
gr.internal_type = entry.internal_type;
|
|
176
|
+
if (entry.max_length) gr.max_length = entry.max_length;
|
|
177
|
+
|
|
178
|
+
var sysId = gr.insert();
|
|
179
|
+
if (sysId) {
|
|
180
|
+
gs.info('✅ Created dictionary entry: ' + entry.name + '.' + entry.element + ' (' + sysId + ')');
|
|
181
|
+
} else {
|
|
182
|
+
gs.error('❌ Failed to create: ' + entry.name + '.' + entry.element);
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
gs.info('Dictionary creation complete');
|
|
187
|
+
`,
|
|
188
|
+
auto_delete: true
|
|
189
|
+
});
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
2. **Run the script:**
|
|
193
|
+
- Open file from `/scripts/` directory
|
|
194
|
+
- Copy entire content
|
|
195
|
+
- Navigate to ServiceNow: `System Definition → Scripts - Background`
|
|
196
|
+
- Paste and click "Run script"
|
|
197
|
+
- Verify output shows success messages
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## Verification
|
|
202
|
+
|
|
203
|
+
### Confirm ACL is Working
|
|
204
|
+
```bash
|
|
205
|
+
# 1. Test CREATE operation
|
|
206
|
+
curl -X POST https://your-instance.service-now.com/api/now/table/sys_dictionary \
|
|
207
|
+
-H "Content-Type: application/json" \
|
|
208
|
+
-H "Authorization: Basic <creds>" \
|
|
209
|
+
-d '{"name":"test_table","element":"test_field","internal_type":"string"}'
|
|
210
|
+
|
|
211
|
+
# Should return 201 Created with sys_id
|
|
212
|
+
|
|
213
|
+
# 2. Test READ operation
|
|
214
|
+
curl -X GET https://your-instance.service-now.com/api/now/table/sys_dictionary?sysparm_limit=1 \
|
|
215
|
+
-H "Authorization: Basic <creds>"
|
|
216
|
+
|
|
217
|
+
# Should return dictionary records
|
|
218
|
+
|
|
219
|
+
# 3. Test UPDATE operation
|
|
220
|
+
curl -X PUT https://your-instance.service-now.com/api/now/table/sys_dictionary/<sys_id> \
|
|
221
|
+
-H "Content-Type: application/json" \
|
|
222
|
+
-H "Authorization: Basic <creds>" \
|
|
223
|
+
-d '{"column_label":"Updated Label"}'
|
|
224
|
+
|
|
225
|
+
# Should return updated record
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## Related System Tables
|
|
231
|
+
|
|
232
|
+
If you're getting 403s on other system tables, apply the same solutions:
|
|
233
|
+
|
|
234
|
+
| Table | Required Role | Purpose |
|
|
235
|
+
|-------|--------------|---------|
|
|
236
|
+
| `sys_dictionary` | personalize_dictionary | Field definitions |
|
|
237
|
+
| `sys_db_object` | personalize_dictionary | Table definitions |
|
|
238
|
+
| `sys_choice` | admin | Choice list values |
|
|
239
|
+
| `sys_glide_object` | admin | Data type definitions |
|
|
240
|
+
| `sys_ui_policy` | admin | UI policy definitions |
|
|
241
|
+
| `sys_script` | admin | Business rules |
|
|
242
|
+
| `sys_properties` | admin | System properties |
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## Prevention
|
|
247
|
+
|
|
248
|
+
### For Development
|
|
249
|
+
- Use dedicated API user with appropriate roles
|
|
250
|
+
- Document required roles in your integration docs
|
|
251
|
+
- Test permission changes in sub-production first
|
|
252
|
+
|
|
253
|
+
### For Production
|
|
254
|
+
- Use custom roles with minimal permissions
|
|
255
|
+
- Regular ACL audits
|
|
256
|
+
- Monitor system logs for permission failures
|
|
257
|
+
- Document all custom ACLs
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## Still Getting 403?
|
|
262
|
+
|
|
263
|
+
### Additional Checks
|
|
264
|
+
|
|
265
|
+
1. **IP Restrictions:**
|
|
266
|
+
- Check: `System Security → IP Address Access Control`
|
|
267
|
+
- Verify your IP is allowed
|
|
268
|
+
|
|
269
|
+
2. **Field-Level ACLs:**
|
|
270
|
+
- Some fields may have separate ACLs
|
|
271
|
+
- Check: `System Security → Access Control (ACL)` → Filter by table and field
|
|
272
|
+
|
|
273
|
+
3. **Table-Level ACLs:**
|
|
274
|
+
- The table itself may be restricted
|
|
275
|
+
- Check for `sys_dictionary` and `sys_dictionary.*` ACLs
|
|
276
|
+
|
|
277
|
+
4. **Update Set Context:**
|
|
278
|
+
- Some operations require active update set
|
|
279
|
+
- Create/set an update set first
|
|
280
|
+
|
|
281
|
+
5. **Application Scope:**
|
|
282
|
+
- Global vs scoped applications
|
|
283
|
+
- Check if table requires specific scope
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
## Quick Reference: MCP Tools
|
|
288
|
+
|
|
289
|
+
### Check Permissions
|
|
290
|
+
```javascript
|
|
291
|
+
// Query existing ACLs for sys_dictionary
|
|
292
|
+
await mcp__servicenow_nodejs__SN_Query_Table({
|
|
293
|
+
table_name: "sys_security_acl",
|
|
294
|
+
query: "name=sys_dictionary",
|
|
295
|
+
fields: "operation,roles,description"
|
|
296
|
+
});
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### Check User Roles
|
|
300
|
+
```javascript
|
|
301
|
+
// Get roles for API user
|
|
302
|
+
await mcp__servicenow_nodejs__SN_Query_Table({
|
|
303
|
+
table_name: "sys_user_has_role",
|
|
304
|
+
query: "user.user_name=YOUR_API_USER",
|
|
305
|
+
fields: "role.name,role.description"
|
|
306
|
+
});
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### Create Dictionary Entry (if permissions work)
|
|
310
|
+
```javascript
|
|
311
|
+
await mcp__servicenow_nodejs__SN_Create_Record({
|
|
312
|
+
table_name: "sys_dictionary",
|
|
313
|
+
data: {
|
|
314
|
+
name: "u_custom_table",
|
|
315
|
+
element: "u_custom_field",
|
|
316
|
+
column_label: "Custom Field",
|
|
317
|
+
internal_type: "string",
|
|
318
|
+
max_length: 100
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
## Contact & Resources
|
|
326
|
+
|
|
327
|
+
- **ServiceNow Community:** https://www.servicenow.com/community/
|
|
328
|
+
- **ACL Documentation:** Search "Access Control Rules" in ServiceNow docs
|
|
329
|
+
- **Your Instance Docs:** https://your-instance.service-now.com/nav_to.do?uri=sys_security_acl_list.do
|