snow-flow 1.1.68 → 1.1.69
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/dist/mcp/servicenow-intelligent-mcp.js +102 -49
- package/dist/mcp/servicenow-intelligent-mcp.js.map +1 -1
- package/dist/mcp/servicenow-operations-mcp.js +556 -0
- package/dist/mcp/servicenow-operations-mcp.js.map +1 -1
- package/dist/orchestrator/flow-composer.d.ts +6 -0
- package/dist/orchestrator/flow-composer.d.ts.map +1 -1
- package/dist/orchestrator/flow-composer.js +106 -9
- package/dist/orchestrator/flow-composer.js.map +1 -1
- package/dist/strategies/global-scope-strategy.d.ts.map +1 -1
- package/dist/strategies/global-scope-strategy.js +8 -1
- package/dist/strategies/global-scope-strategy.js.map +1 -1
- package/dist/version.d.ts +6 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +30 -1
- package/dist/version.js.map +1 -1
- package/package.json +1 -1
|
@@ -2136,58 +2136,111 @@ class ServiceNowIntelligentMCP {
|
|
|
2136
2136
|
current_permissions: {},
|
|
2137
2137
|
required_actions: []
|
|
2138
2138
|
};
|
|
2139
|
-
//
|
|
2140
|
-
const
|
|
2141
|
-
sysparm_query: 'user_name=
|
|
2142
|
-
sysparm_fields: 'sys_id,user_name,
|
|
2139
|
+
// Get current user info
|
|
2140
|
+
const whoAmI = await this.client.get('/api/now/table/sys_user', {
|
|
2141
|
+
sysparm_query: 'user_name=admin', // Try admin user first
|
|
2142
|
+
sysparm_fields: 'sys_id,user_name,name,email',
|
|
2143
|
+
sysparm_limit: 1
|
|
2143
2144
|
});
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
}
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
}
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2145
|
+
const currentUser = whoAmI.result?.[0];
|
|
2146
|
+
if (!currentUser) {
|
|
2147
|
+
return { content: [{
|
|
2148
|
+
type: 'text',
|
|
2149
|
+
text: '❌ Could not identify current user. Please ensure you are logged in to ServiceNow.'
|
|
2150
|
+
}] };
|
|
2151
|
+
}
|
|
2152
|
+
// Get user roles
|
|
2153
|
+
const userRoles = await this.client.get('/api/now/table/sys_user_has_role', {
|
|
2154
|
+
sysparm_query: `user=${currentUser.sys_id}`,
|
|
2155
|
+
sysparm_fields: 'role.name,role.description,inherited'
|
|
2156
|
+
});
|
|
2157
|
+
const currentRoles = userRoles.result?.map((r) => r.role?.name).filter(Boolean) || [];
|
|
2158
|
+
const missingRoles = required_roles.filter((role) => !currentRoles.includes(role));
|
|
2159
|
+
// Get instance URL
|
|
2160
|
+
const instanceUrl = process.env.SNOW_INSTANCE ?
|
|
2161
|
+
`https://${process.env.SNOW_INSTANCE.replace(/\/$/, '')}.service-now.com` :
|
|
2162
|
+
'https://your-instance.service-now.com';
|
|
2163
|
+
if (missingRoles.length === 0) {
|
|
2164
|
+
return { content: [{
|
|
2165
|
+
type: 'text',
|
|
2166
|
+
text: `✅ **Permission Check Passed**\n\nYou already have all required roles:\n${required_roles.map((r) => `- ✓ ${r}`).join('\n')}\n\nNo escalation needed!`
|
|
2167
|
+
}] };
|
|
2168
|
+
}
|
|
2169
|
+
// Build actionable response
|
|
2170
|
+
let response = `🔐 **Permission Escalation Required**\n\n`;
|
|
2171
|
+
response += `**Current User:** ${currentUser.name} (${currentUser.user_name})\n`;
|
|
2172
|
+
response += `**Current Roles:** ${currentRoles.length > 0 ? currentRoles.join(', ') : 'None'}\n`;
|
|
2173
|
+
response += `**Missing Roles:** ${missingRoles.join(', ')}\n`;
|
|
2174
|
+
response += `**Reason:** ${reason}\n`;
|
|
2175
|
+
response += `**Duration:** ${duration}\n\n`;
|
|
2176
|
+
response += `## 🎯 Required Actions:\n\n`;
|
|
2177
|
+
// Provide specific instructions for each missing role
|
|
2178
|
+
for (const role of missingRoles) {
|
|
2179
|
+
response += `### ${role} Role\n`;
|
|
2180
|
+
switch (role) {
|
|
2181
|
+
case 'admin':
|
|
2182
|
+
response += `The **admin** role provides:\n`;
|
|
2183
|
+
response += `- Global scope access for creating widgets, flows, and applications\n`;
|
|
2184
|
+
response += `- Ability to modify system tables and configurations\n`;
|
|
2185
|
+
response += `- Access to all ServiceNow modules and features\n\n`;
|
|
2186
|
+
response += `**How to obtain:**\n`;
|
|
2187
|
+
response += `1. Contact your ServiceNow administrator\n`;
|
|
2188
|
+
response += `2. Or if you have admin access: [Click here to manage user roles](${instanceUrl}/sys_user.do?sys_id=${currentUser.sys_id})\n`;
|
|
2189
|
+
response += `3. In the "Roles" related list, click "Edit" and add "admin"\n\n`;
|
|
2190
|
+
break;
|
|
2191
|
+
case 'app_creator':
|
|
2192
|
+
response += `The **app_creator** role provides:\n`;
|
|
2193
|
+
response += `- Create custom applications and scoped apps\n`;
|
|
2194
|
+
response += `- Design application modules and menus\n`;
|
|
2195
|
+
response += `- Manage application artifacts\n\n`;
|
|
2196
|
+
response += `**How to obtain:**\n`;
|
|
2197
|
+
response += `1. Request from ServiceNow administrator\n`;
|
|
2198
|
+
response += `2. Or navigate to: [User Administration > Users](${instanceUrl}/sys_user_list.do)\n`;
|
|
2199
|
+
response += `3. Find your user record and add "app_creator" role\n\n`;
|
|
2200
|
+
break;
|
|
2201
|
+
case 'system_administrator':
|
|
2202
|
+
response += `The **system_administrator** role provides:\n`;
|
|
2203
|
+
response += `- Full system access and configuration\n`;
|
|
2204
|
+
response += `- Advanced scripting and development capabilities\n`;
|
|
2205
|
+
response += `- Access to all system properties and settings\n\n`;
|
|
2206
|
+
response += `**How to obtain:**\n`;
|
|
2207
|
+
response += `1. This is a highly privileged role - contact system admin\n`;
|
|
2208
|
+
response += `2. Requires approval from ServiceNow instance owner\n\n`;
|
|
2209
|
+
break;
|
|
2210
|
+
case 'global_admin':
|
|
2211
|
+
response += `The **global_admin** role provides:\n`;
|
|
2212
|
+
response += `- Cross-scope application access\n`;
|
|
2213
|
+
response += `- Global artifact creation and management\n`;
|
|
2214
|
+
response += `- Override scope restrictions\n\n`;
|
|
2215
|
+
response += `**How to obtain:**\n`;
|
|
2216
|
+
response += `1. Contact ServiceNow administrator\n`;
|
|
2217
|
+
response += `2. May require business justification\n\n`;
|
|
2218
|
+
break;
|
|
2219
|
+
default:
|
|
2220
|
+
response += `The **${role}** role is required for this operation.\n\n`;
|
|
2221
|
+
response += `**How to obtain:**\n`;
|
|
2222
|
+
response += `1. Contact your ServiceNow administrator\n`;
|
|
2223
|
+
response += `2. Request temporary access for: "${reason}"\n\n`;
|
|
2188
2224
|
}
|
|
2189
2225
|
}
|
|
2190
|
-
|
|
2226
|
+
response += `## 💡 Alternative Solutions:\n\n`;
|
|
2227
|
+
response += `1. **Use a development instance** where you have admin access\n`;
|
|
2228
|
+
response += `2. **Request a personal developer instance** from [developer.servicenow.com](https://developer.servicenow.com)\n`;
|
|
2229
|
+
response += `3. **Work with a team member** who has the required permissions\n`;
|
|
2230
|
+
response += `4. **Use Update Sets** to package changes for deployment by an admin\n\n`;
|
|
2231
|
+
response += `## 📋 Template Request for Admin:\n\n`;
|
|
2232
|
+
response += `\`\`\`\n`;
|
|
2233
|
+
response += `Subject: Temporary Permission Request - ${reason}\n\n`;
|
|
2234
|
+
response += `Hi Admin,\n\n`;
|
|
2235
|
+
response += `I need temporary access to the following roles for development:\n`;
|
|
2236
|
+
response += `- Roles needed: ${missingRoles.join(', ')}\n`;
|
|
2237
|
+
response += `- Reason: ${reason}\n`;
|
|
2238
|
+
response += `- Duration: ${duration}\n`;
|
|
2239
|
+
response += `- Context: ${workflow_context || 'ServiceNow multi-agent development'}\n\n`;
|
|
2240
|
+
response += `These permissions can be revoked after the ${duration === 'session' ? 'current session' : duration}.\n\n`;
|
|
2241
|
+
response += `Thank you!\n`;
|
|
2242
|
+
response += `\`\`\``;
|
|
2243
|
+
return { content: [{ type: 'text', text: response }] };
|
|
2191
2244
|
}
|
|
2192
2245
|
catch (error) {
|
|
2193
2246
|
return { content: [{
|