snow-flow 8.31.34 → 8.31.36
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/cli/auth.d.ts +5 -0
- package/dist/cli/auth.d.ts.map +1 -1
- package/dist/cli/auth.js +167 -1
- package/dist/cli/auth.js.map +1 -1
- package/dist/cli/enterprise.d.ts.map +1 -1
- package/dist/cli/enterprise.js +9 -0
- package/dist/cli/enterprise.js.map +1 -1
- package/dist/cli.js +4 -4
- package/dist/cli.js.map +1 -1
- package/dist/mcp/servicenow-mcp-unified/server.d.ts +10 -2
- package/dist/mcp/servicenow-mcp-unified/server.d.ts.map +1 -1
- package/dist/mcp/servicenow-mcp-unified/server.js +113 -22
- package/dist/mcp/servicenow-mcp-unified/server.js.map +1 -1
- package/dist/templates/readme-template.d.ts +1 -1
- package/dist/templates/readme-template.d.ts.map +1 -1
- package/dist/templates/readme-template.js +3 -3
- package/package.json +2 -9
- package/scripts/test-auth-flow.js +172 -0
|
@@ -10,11 +10,47 @@
|
|
|
10
10
|
*
|
|
11
11
|
* This eliminates ~15,000 LOC of duplicate code.
|
|
12
12
|
*/
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
30
|
+
var ownKeys = function(o) {
|
|
31
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
32
|
+
var ar = [];
|
|
33
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
34
|
+
return ar;
|
|
35
|
+
};
|
|
36
|
+
return ownKeys(o);
|
|
37
|
+
};
|
|
38
|
+
return function (mod) {
|
|
39
|
+
if (mod && mod.__esModule) return mod;
|
|
40
|
+
var result = {};
|
|
41
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
42
|
+
__setModuleDefault(result, mod);
|
|
43
|
+
return result;
|
|
44
|
+
};
|
|
45
|
+
})();
|
|
13
46
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
47
|
exports.ServiceNowUnifiedServer = void 0;
|
|
15
48
|
const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
|
|
16
49
|
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
17
50
|
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
|
51
|
+
const fs = __importStar(require("fs"));
|
|
52
|
+
const path = __importStar(require("path"));
|
|
53
|
+
const os = __importStar(require("os"));
|
|
18
54
|
const tool_registry_js_1 = require("./shared/tool-registry.js");
|
|
19
55
|
const auth_js_1 = require("./shared/auth.js");
|
|
20
56
|
const error_handler_js_1 = require("./shared/error-handler.js");
|
|
@@ -39,13 +75,55 @@ class ServiceNowUnifiedServer {
|
|
|
39
75
|
this.setupHandlers();
|
|
40
76
|
}
|
|
41
77
|
/**
|
|
42
|
-
* Load ServiceNow
|
|
78
|
+
* Load ServiceNow credentials from snow-code auth.json
|
|
79
|
+
* Returns undefined if auth.json doesn't exist or credentials are invalid
|
|
80
|
+
*/
|
|
81
|
+
loadFromAuthJson() {
|
|
82
|
+
try {
|
|
83
|
+
const authPath = path.join(os.homedir(), '.local', 'share', 'snow-code', 'auth.json');
|
|
84
|
+
if (!fs.existsSync(authPath)) {
|
|
85
|
+
return undefined;
|
|
86
|
+
}
|
|
87
|
+
const authData = JSON.parse(fs.readFileSync(authPath, 'utf-8'));
|
|
88
|
+
const servicenowCreds = authData['servicenow'];
|
|
89
|
+
if (!servicenowCreds || servicenowCreds.type !== 'servicenow-oauth') {
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
// Validate credentials are not placeholders
|
|
93
|
+
const isPlaceholder = (val) => !val || val.includes('your-') || val.includes('placeholder');
|
|
94
|
+
if (isPlaceholder(servicenowCreds.instance) ||
|
|
95
|
+
isPlaceholder(servicenowCreds.clientId) ||
|
|
96
|
+
isPlaceholder(servicenowCreds.clientSecret)) {
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
console.log('[Auth] Loaded credentials from snow-code auth.json');
|
|
100
|
+
return {
|
|
101
|
+
instanceUrl: servicenowCreds.instance.startsWith('http')
|
|
102
|
+
? servicenowCreds.instance
|
|
103
|
+
: `https://${servicenowCreds.instance}`,
|
|
104
|
+
clientId: servicenowCreds.clientId,
|
|
105
|
+
clientSecret: servicenowCreds.clientSecret,
|
|
106
|
+
refreshToken: servicenowCreds.refreshToken,
|
|
107
|
+
username: undefined,
|
|
108
|
+
password: undefined
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
console.warn('[Auth] Failed to load from auth.json:', error.message);
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Load ServiceNow context from environment variables OR auth.json fallback
|
|
43
118
|
* Note: Server will start even without credentials (unauthenticated mode)
|
|
44
119
|
*
|
|
45
|
-
*
|
|
120
|
+
* Priority:
|
|
121
|
+
* 1. Environment variables (SERVICENOW_* or SNOW_*)
|
|
122
|
+
* 2. snow-code auth.json (~/.local/share/snow-code/auth.json)
|
|
123
|
+
* 3. Unauthenticated mode (empty credentials)
|
|
46
124
|
*/
|
|
47
125
|
loadContext() {
|
|
48
|
-
//
|
|
126
|
+
// STEP 1: Try environment variables first
|
|
49
127
|
const instanceUrl = process.env.SERVICENOW_INSTANCE_URL ||
|
|
50
128
|
(process.env.SNOW_INSTANCE ? `https://${process.env.SNOW_INSTANCE}` : undefined);
|
|
51
129
|
const clientId = process.env.SERVICENOW_CLIENT_ID || process.env.SNOW_CLIENT_ID;
|
|
@@ -57,29 +135,42 @@ class ServiceNowUnifiedServer {
|
|
|
57
135
|
const normalizeCredential = (val) => val && val.trim() !== '' ? val : undefined;
|
|
58
136
|
// Check for placeholder values
|
|
59
137
|
const isPlaceholder = (val) => !val || val.includes('your-') || val.includes('placeholder');
|
|
60
|
-
//
|
|
61
|
-
|
|
62
|
-
isPlaceholder(instanceUrl)
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
138
|
+
// Check if env vars are valid
|
|
139
|
+
const hasValidEnvVars = instanceUrl && clientId && clientSecret &&
|
|
140
|
+
!isPlaceholder(instanceUrl) &&
|
|
141
|
+
!isPlaceholder(clientId) &&
|
|
142
|
+
!isPlaceholder(clientSecret);
|
|
143
|
+
if (hasValidEnvVars) {
|
|
144
|
+
console.log('[Auth] Using credentials from environment variables');
|
|
67
145
|
return {
|
|
68
|
-
instanceUrl:
|
|
69
|
-
clientId:
|
|
70
|
-
clientSecret:
|
|
71
|
-
refreshToken:
|
|
72
|
-
username:
|
|
73
|
-
password:
|
|
146
|
+
instanceUrl: instanceUrl,
|
|
147
|
+
clientId: clientId,
|
|
148
|
+
clientSecret: clientSecret,
|
|
149
|
+
refreshToken: normalizeCredential(refreshToken),
|
|
150
|
+
username: normalizeCredential(username),
|
|
151
|
+
password: normalizeCredential(password)
|
|
74
152
|
};
|
|
75
153
|
}
|
|
154
|
+
// STEP 2: Try snow-code auth.json fallback
|
|
155
|
+
const authJsonContext = this.loadFromAuthJson();
|
|
156
|
+
if (authJsonContext) {
|
|
157
|
+
return authJsonContext;
|
|
158
|
+
}
|
|
159
|
+
// STEP 3: No valid credentials found - start in unauthenticated mode
|
|
160
|
+
console.error('[Auth] Warning: No ServiceNow credentials found');
|
|
161
|
+
console.error('[Auth] Checked:');
|
|
162
|
+
console.error('[Auth] 1. Environment variables (SERVICENOW_* or SNOW_*)');
|
|
163
|
+
console.error('[Auth] 2. snow-code auth.json (~/.local/share/snow-code/auth.json)');
|
|
164
|
+
console.error('[Auth] Server starting in UNAUTHENTICATED mode - tools will return authentication errors');
|
|
165
|
+
console.error('[Auth] To configure credentials, run: snow-flow auth login');
|
|
166
|
+
// Return empty context - tools will fail with clear auth errors
|
|
76
167
|
return {
|
|
77
|
-
instanceUrl,
|
|
78
|
-
clientId,
|
|
79
|
-
clientSecret,
|
|
80
|
-
refreshToken:
|
|
81
|
-
username:
|
|
82
|
-
password:
|
|
168
|
+
instanceUrl: '',
|
|
169
|
+
clientId: '',
|
|
170
|
+
clientSecret: '',
|
|
171
|
+
refreshToken: undefined,
|
|
172
|
+
username: undefined,
|
|
173
|
+
password: undefined
|
|
83
174
|
};
|
|
84
175
|
}
|
|
85
176
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/mcp/servicenow-mcp-unified/server.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/mcp/servicenow-mcp-unified/server.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,wEAAmE;AACnE,wEAAiF;AACjF,iEAK4C;AAC5C,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AAEzB,gEAAyD;AACzD,8CAA+C;AAC/C,gEAAmG;AAEnG,8EAA+H;AAE/H;;GAEG;AACH,MAAa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1,2 +1,2 @@
|
|
|
1
|
-
export declare const README_TEMPLATE = "# Snow-Flow: AI-Powered ServiceNow Development Platform \uD83D\uDE80\n\nSnow-Flow is a powerful AI development platform for ServiceNow that combines **22 specialized MCP servers** with **multi-agent orchestration** to revolutionize ServiceNow development. Build widgets, flows, workspaces, and complete applications using natural language commands.\n\n## \uD83C\uDFAF What Can Snow-Flow Do?\n\n- **Create ServiceNow Widgets** - \"Create an incident dashboard widget with real-time updates\"\n- **Build Agent Workspaces** - \"Create a workspace for IT support agents with incident lists\"\n- **Process Mining** - \"Discover hidden inefficiencies in ITSM workflows\"\n- **Deploy UI Builder Pages** - \"Build a customer portal page with service catalog\"\n- **Manage CMDB** - \"Find all Windows servers and update their maintenance windows\"\n- **Train ML Models** - \"Create a Predictive Intelligence solution to categorize incidents\"\n- **And much more!** - 22 MCP servers with 400+ tools for complete ServiceNow development\n\n## \uD83D\uDE80 Quick Start (5 Minutes)\n\n### 1. Install Snow-Flow\n\n```bash\nnpm install -g snow-flow\n```\n\n### 2. Initialize Your Project\n\n```bash\n# Create a new directory or use existing project\nmkdir my-servicenow-project\ncd my-servicenow-project\n\n# Initialize Snow-Flow (creates .env, CLAUDE.md, MCP config)\nsnow-flow init\n```\n\n### 3. Authenticate\n\n```bash\n# Authenticate with LLM provider (Claude/OpenAI/Gemini) AND ServiceNow\nsnow-flow auth login\n```\n\nThis will:\n- \u2705 Authenticate with your preferred LLM provider (via SnowCode)\n- \u2705 Save your provider choice to .env\n- \u2705 Configure ServiceNow OAuth credentials\n- \u2705 Test the connection and show your username\n\n### 4. Start Building!\n\n```bash\n# Use the swarm command to build anything in ServiceNow\nsnow-flow swarm \"create an incident dashboard widget\"\n\n# Or use SnowCode/Claude Code directly (MCP servers auto-configured)\nsnowcode # All 22 MCP servers available automatically\n```\n\n## \uD83C\uDFAF Key Features\n\n### \uD83E\uDD16 22 Specialized MCP Servers (400+ Tools)\n\nSnow-Flow includes the most comprehensive ServiceNow MCP server collection:\n\n1. **ServiceNow Deployment** - Widget, flow, and artifact deployment\n2. **ServiceNow Operations** - Core CRUD operations and queries\n3. **ServiceNow Automation** - Background scripts and job scheduling\n4. **ServiceNow Platform Development** - Script includes, business rules, client scripts\n5. **ServiceNow Integration** - REST messages, web services, data imports\n6. **ServiceNow System Properties** - Property management and configuration\n7. **ServiceNow Update Set** - Change management and deployment tracking\n8. **ServiceNow Development Assistant** - Intelligent artifact search and editing\n9. **ServiceNow Security & Compliance** - ACLs, security policies, vulnerability scanning\n10. **ServiceNow Reporting & Analytics** - Reports, dashboards, and KPIs\n11. **ServiceNow Machine Learning** - Predictive Intelligence + TensorFlow.js\n12. **ServiceNow Knowledge & Catalog** - Knowledge base and service catalog\n13. **ServiceNow Change, Virtual Agent & PA** - Change management, chatbots, performance analytics\n14. **ServiceNow Flow, Workspace & Mobile** - Flow Designer, Agent Workspace, UI Builder\n15. **ServiceNow CMDB, Event, HR, CSM & DevOps** - Configuration management, HR services, customer service\n16. **ServiceNow Advanced Features** - Batch operations, query optimization, process mining\n17. **ServiceNow Local Development** - Artifact sync with local files for debugging\n18. **Snow-Flow Orchestration** - Multi-agent coordination and task management\n19. **Snow-Flow Memory** - Persistent memory and context management\n20. **Snow-Flow Neural** - Neural network training with TensorFlow.js\n21. **Snow-Flow Graph** - Relationship tracking and impact analysis\n22. **Snow-Flow Performance** - Performance monitoring and optimization\n\n### \uD83D\uDD04 Multi-Agent Orchestration\n\nThe `swarm` command coordinates multiple specialized agents to handle complex tasks:\n\n```bash\n# Single command handles everything: planning, execution, testing, deployment\nsnow-flow swarm \"build a complete incident management workspace with dashboards\"\n```\n\n### \uD83C\uDFA8 SnowCode + Claude Code Support\n\nSnow-Flow works seamlessly with both AI platforms:\n\n- **SnowCode**: Native Task() integration, all 22 MCP servers auto-configured\n- **Claude Code**: Full MCP support via .claude/config.json\n- **Both**: Share the same CLAUDE.md instructions and .env configuration\n\n### \uD83D\uDD10 Secure Authentication\n\n- **LLM Providers**: Authenticate via SnowCode (supports Claude, OpenAI, Google, Ollama)\n- **ServiceNow**: OAuth 2.0 with automatic token refresh\n- **Credentials**: Stored securely in .env (never committed to git)\n\n### \uD83E\uDDEA Local Development with Artifact Sync\n\nPull ServiceNow artifacts to local files, edit with your favorite tools, and push back:\n\n```bash\n# Example via SnowCode/Claude Code with MCP tools:\n# 1. Pull widget to local files\nsnow_pull_artifact({ sys_id: 'widget_sys_id', table: 'sp_widget' })\n\n# 2. Edit locally with full IDE features (search, refactor, etc.)\n# Files created in /tmp/snow-flow-artifacts/widgets/my_widget/\n\n# 3. Validate coherence\nsnow_validate_artifact_coherence({ sys_id: 'widget_sys_id' })\n\n# 4. Push changes back\nsnow_push_artifact({ sys_id: 'widget_sys_id' })\n```\n\n## \uD83D\uDCDA Usage Examples\n\n### Create a Service Portal Widget\n\n```bash\nsnow-flow swarm \"create a widget showing top 10 open incidents with priority indicators\"\n```\n\n### Build an Agent Workspace\n\n```bash\nsnow-flow swarm \"create an agent workspace for ITIL fulfillment with task lists and approvals\"\n```\n\n### Design a Flow Designer Flow\n\n```bash\nsnow-flow swarm \"create an approval flow for purchase requests over $5000\"\n```\n\n### Train a Machine Learning Model\n\n```bash\nsnow-flow swarm \"create a Predictive Intelligence solution to predict incident categories\"\n```\n\n### Build a UI Builder Page\n\n```bash\nsnow-flow swarm \"create a UI Builder page with a list of incidents and a detail panel\"\n```\n\n### Update CMDB Configuration Items\n\n```bash\nsnow-flow swarm \"find all Linux servers in Boston datacenter and update their support group\"\n```\n\n### Generate Reports and Dashboards\n\n```bash\nsnow-flow swarm \"create a dashboard showing SLA compliance trends for the last 30 days\"\n```\n\n## \uD83D\uDD27 Commands Reference\n\n### Authentication\n```bash\nsnow-flow auth login # Authenticate with LLM provider and ServiceNow\nsnow-flow auth logout # Logout from ServiceNow\nsnow-flow auth status # Check authentication status\n```\n\n### Project Management\n```bash\nsnow-flow init # Initialize Snow-Flow in current directory\nsnow-flow version # Show Snow-Flow version\n```\n\n### Development\n```bash\nsnow-flow swarm \"<task>\" # Multi-agent orchestration for complex tasks\n```\n\n### Direct AI Usage\n```bash\nsnowcode # Start SnowCode with all 22 MCP servers\nclaude # Start Claude Code with MCP servers (if installed)\n```\n\n## \uD83D\uDEE0\uFE0F Configuration\n\n### .env File\n\nCreated by `snow-flow init`, configure these variables:\n\n```env\n# ServiceNow Instance\nSNOW_INSTANCE=your-instance.service-now.com\nSNOW_CLIENT_ID=your-oauth-client-id\nSNOW_CLIENT_SECRET=your-oauth-client-secret\n\n# LLM Provider (auto-set by auth login)\nDEFAULT_LLM_PROVIDER=anthropic # or openai, google, ollama\n\n# Optional: Direct API key (skips SnowCode auth)\nANTHROPIC_API_KEY=sk-ant-...\n```\n\n### ServiceNow OAuth Setup\n\n1. Log into ServiceNow as admin\n2. Navigate to: **System OAuth > Application Registry**\n3. Click **New** > **Create an OAuth API endpoint for external clients**\n4. Fill in:\n - **Name**: Snow-Flow\n - **Client ID**: (auto-generated, copy this)\n - **Client Secret**: (auto-generated, copy this)\n - **Redirect URL**: http://localhost:3000/oauth/callback\n5. Save and copy Client ID and Secret to your .env file\n6. Run `snow-flow auth login` to complete authentication\n\n## \uD83D\uDCC1 Project Structure\n\nAfter running `snow-flow init`:\n\n```\nyour-project/\n\u251C\u2500\u2500 .env # Environment configuration (DO NOT COMMIT)\n\u251C\u2500\u2500 .env.example # Example environment template\n\u251C\u2500\u2500 CLAUDE.md # AI instructions (primary)\n\u251C\u2500\u2500 AGENTS.md # AI instructions (SnowCode copy)\n\u251C\u2500\u2500 .snowcode/ # SnowCode configuration\n\u2502 \u2514\u2500\u2500 config.json # MCP servers for SnowCode\n\u251C\u2500\u2500 .claude/ # Claude Code configuration\n\u2502 \u2514\u2500\u2500 config.json # MCP servers for Claude Code\n\u251C\u2500\u2500 .mcp.json # Unified MCP server configuration\n\u251C\u2500\u2500 .snow-flow/ # Snow-Flow workspace\n\u2502 \u251C\u2500\u2500 memory/ # Persistent agent memory\n\u2502 \u2514\u2500\u2500 artifacts/ # Local artifact cache\n\u2514\u2500\u2500 README.md # This file\n```\n\n## \uD83C\uDF93 Learning Resources\n\n### Documentation Files\n\n- **CLAUDE.md** / **AGENTS.md** - Complete AI instructions and best practices\n- **SERVICENOW-OAUTH-SETUP.md** - Detailed OAuth configuration guide\n- **TRADEMARK.md** - Brand guidelines and usage\n\n### Online Resources\n\n- [ServiceNow Developer Portal](https://developer.servicenow.com)\n- [ServiceNow Flow Designer Documentation](https://docs.servicenow.com/flow-designer)\n- [ServiceNow REST API Reference](https://docs.servicenow.com/rest-api)\n\n## \uD83D\uDD12 Security Best Practices\n\n1. **Never commit .env** - Already in .gitignore\n2. **Use OAuth 2.0** - More secure than basic authentication\n3. **Rotate credentials** - Change OAuth secrets periodically\n4. **Test in dev first** - Always test in development instances\n5. **Use Update Sets** - Track all changes professionally\n6. **Review AI output** - Always review generated code before deployment\n\n## \uD83D\uDC1B Troubleshooting\n\n### \"SnowCode is not installed\"\n\n```bash\nnpm install -g snowcode-ai\n```\n\n### \"ServiceNow authentication failed\"\n\n1. Check your .env credentials are correct\n2. Verify OAuth application is configured in ServiceNow\n3. Ensure redirect URL is http://localhost:3000/oauth/callback\n4. Run `snow-flow auth status` to see detailed error\n\n### \"MCP servers not loading\"\n\n1. Make sure you ran `snow-flow init` in your project directory\n2. Check that .snowcode/config.json exists\n3. Restart SnowCode/Claude Code after running init\n\n### \"Widget coherence validation failed\"\n\nThis means your widget's HTML, client script, and server script don't communicate properly. Use Local Sync to debug:\n\n```javascript\n// In SnowCode/Claude Code:\nsnow_pull_artifact({ sys_id: 'your_widget_sys_id', table: 'sp_widget' })\n// Edit locally, then push back\nsnow_push_artifact({ sys_id: 'your_widget_sys_id' })\n```\n\n## \uD83E\uDD1D Contributing\n\nWe welcome contributions! Snow-Flow is open source.\n\n## \uD83D\uDCDD License\n\nElastic License 2.0 - see LICENSE file for details\n\n**What this means:**\n- \u2705 Free to use, modify, and redistribute\n- \u2705 Can be used commercially\n- \u2705 Full source code access\n- \u26A0\uFE0F Cannot provide Snow-Flow as a managed service to third parties\n- \u26A0\uFE0F Cannot remove or obscure licensing/copyright notices\n\nFor full license details: https://www.elastic.co/licensing/elastic-license\n\n## \uD83D\uDE4F Acknowledgments\n\nBuilt with \u2764\uFE0F using:\n- [ServiceNow Platform](https://www.servicenow.com)\n- [Anthropic Claude](https://www.anthropic.com/claude)\n- [SnowCode AI](https://snowcode.ai)\n- [Model Context Protocol (MCP)](https://modelcontextprotocol.io)\n\n---\n\n**Ready to revolutionize your ServiceNow development?**\n\n```bash\nnpm install -g snow-flow\nsnow-flow init\nsnow-flow auth login\nsnow-flow swarm \"create an awesome ServiceNow widget\"\n```\n\n\uD83D\uDE80 **Happy building!**\n";
|
|
1
|
+
export declare const README_TEMPLATE = "# Snow-Flow: AI-Powered ServiceNow Development Platform \uD83D\uDE80\n\nSnow-Flow is a powerful AI development platform for ServiceNow that combines **22 specialized MCP servers** with **multi-agent orchestration** to revolutionize ServiceNow development. Build widgets, flows, workspaces, and complete applications using natural language commands.\n\n## \uD83C\uDFAF What Can Snow-Flow Do?\n\n- **Create ServiceNow Widgets** - \"Create an incident dashboard widget with real-time updates\"\n- **Build Agent Workspaces** - \"Create a workspace for IT support agents with incident lists\"\n- **Process Mining** - \"Discover hidden inefficiencies in ITSM workflows\"\n- **Deploy UI Builder Pages** - \"Build a customer portal page with service catalog\"\n- **Manage CMDB** - \"Find all Windows servers and update their maintenance windows\"\n- **Train ML Models** - \"Create a Predictive Intelligence solution to categorize incidents\"\n- **And much more!** - 22 MCP servers with 400+ tools for complete ServiceNow development\n\n## \uD83D\uDE80 Quick Start (5 Minutes)\n\n### 1. Install Snow-Flow\n\n```bash\nnpm install -g snow-flow\n```\n\n### 2. Initialize Your Project\n\n```bash\n# Create a new directory or use existing project\nmkdir my-servicenow-project\ncd my-servicenow-project\n\n# Initialize Snow-Flow (creates .env, CLAUDE.md, MCP config)\nsnow-flow init\n```\n\n### 3. Authenticate\n\n```bash\n# Authenticate with LLM provider (Claude/OpenAI/Gemini) AND ServiceNow\nsnow-flow auth login\n```\n\nThis will:\n- \u2705 Authenticate with your preferred LLM provider (via SnowCode)\n- \u2705 Save your provider choice to .env\n- \u2705 Configure ServiceNow OAuth credentials\n- \u2705 Test the connection and show your username\n\n### 4. Start Building!\n\n```bash\n# Use the swarm command to build anything in ServiceNow\nsnow-flow swarm \"create an incident dashboard widget\"\n\n# Or use SnowCode/Claude Code directly (MCP servers auto-configured)\nsnow-code # All 22 MCP servers available automatically\n```\n\n## \uD83C\uDFAF Key Features\n\n### \uD83E\uDD16 22 Specialized MCP Servers (400+ Tools)\n\nSnow-Flow includes the most comprehensive ServiceNow MCP server collection:\n\n1. **ServiceNow Deployment** - Widget, flow, and artifact deployment\n2. **ServiceNow Operations** - Core CRUD operations and queries\n3. **ServiceNow Automation** - Background scripts and job scheduling\n4. **ServiceNow Platform Development** - Script includes, business rules, client scripts\n5. **ServiceNow Integration** - REST messages, web services, data imports\n6. **ServiceNow System Properties** - Property management and configuration\n7. **ServiceNow Update Set** - Change management and deployment tracking\n8. **ServiceNow Development Assistant** - Intelligent artifact search and editing\n9. **ServiceNow Security & Compliance** - ACLs, security policies, vulnerability scanning\n10. **ServiceNow Reporting & Analytics** - Reports, dashboards, and KPIs\n11. **ServiceNow Machine Learning** - Predictive Intelligence + TensorFlow.js\n12. **ServiceNow Knowledge & Catalog** - Knowledge base and service catalog\n13. **ServiceNow Change, Virtual Agent & PA** - Change management, chatbots, performance analytics\n14. **ServiceNow Flow, Workspace & Mobile** - Flow Designer, Agent Workspace, UI Builder\n15. **ServiceNow CMDB, Event, HR, CSM & DevOps** - Configuration management, HR services, customer service\n16. **ServiceNow Advanced Features** - Batch operations, query optimization, process mining\n17. **ServiceNow Local Development** - Artifact sync with local files for debugging\n18. **Snow-Flow Orchestration** - Multi-agent coordination and task management\n19. **Snow-Flow Memory** - Persistent memory and context management\n20. **Snow-Flow Neural** - Neural network training with TensorFlow.js\n21. **Snow-Flow Graph** - Relationship tracking and impact analysis\n22. **Snow-Flow Performance** - Performance monitoring and optimization\n\n### \uD83D\uDD04 Multi-Agent Orchestration\n\nThe `swarm` command coordinates multiple specialized agents to handle complex tasks:\n\n```bash\n# Single command handles everything: planning, execution, testing, deployment\nsnow-flow swarm \"build a complete incident management workspace with dashboards\"\n```\n\n### \uD83C\uDFA8 SnowCode + Claude Code Support\n\nSnow-Flow works seamlessly with both AI platforms:\n\n- **SnowCode**: Native Task() integration, all 22 MCP servers auto-configured\n- **Claude Code**: Full MCP support via .claude/config.json\n- **Both**: Share the same CLAUDE.md instructions and .env configuration\n\n### \uD83D\uDD10 Secure Authentication\n\n- **LLM Providers**: Authenticate via SnowCode (supports Claude, OpenAI, Google, Ollama)\n- **ServiceNow**: OAuth 2.0 with automatic token refresh\n- **Credentials**: Stored securely in .env (never committed to git)\n\n### \uD83E\uDDEA Local Development with Artifact Sync\n\nPull ServiceNow artifacts to local files, edit with your favorite tools, and push back:\n\n```bash\n# Example via SnowCode/Claude Code with MCP tools:\n# 1. Pull widget to local files\nsnow_pull_artifact({ sys_id: 'widget_sys_id', table: 'sp_widget' })\n\n# 2. Edit locally with full IDE features (search, refactor, etc.)\n# Files created in /tmp/snow-flow-artifacts/widgets/my_widget/\n\n# 3. Validate coherence\nsnow_validate_artifact_coherence({ sys_id: 'widget_sys_id' })\n\n# 4. Push changes back\nsnow_push_artifact({ sys_id: 'widget_sys_id' })\n```\n\n## \uD83D\uDCDA Usage Examples\n\n### Create a Service Portal Widget\n\n```bash\nsnow-flow swarm \"create a widget showing top 10 open incidents with priority indicators\"\n```\n\n### Build an Agent Workspace\n\n```bash\nsnow-flow swarm \"create an agent workspace for ITIL fulfillment with task lists and approvals\"\n```\n\n### Design a Flow Designer Flow\n\n```bash\nsnow-flow swarm \"create an approval flow for purchase requests over $5000\"\n```\n\n### Train a Machine Learning Model\n\n```bash\nsnow-flow swarm \"create a Predictive Intelligence solution to predict incident categories\"\n```\n\n### Build a UI Builder Page\n\n```bash\nsnow-flow swarm \"create a UI Builder page with a list of incidents and a detail panel\"\n```\n\n### Update CMDB Configuration Items\n\n```bash\nsnow-flow swarm \"find all Linux servers in Boston datacenter and update their support group\"\n```\n\n### Generate Reports and Dashboards\n\n```bash\nsnow-flow swarm \"create a dashboard showing SLA compliance trends for the last 30 days\"\n```\n\n## \uD83D\uDD27 Commands Reference\n\n### Authentication\n```bash\nsnow-flow auth login # Authenticate with LLM provider and ServiceNow\nsnow-flow auth logout # Logout from ServiceNow\nsnow-flow auth status # Check authentication status\n```\n\n### Project Management\n```bash\nsnow-flow init # Initialize Snow-Flow in current directory\nsnow-flow version # Show Snow-Flow version\n```\n\n### Development\n```bash\nsnow-flow swarm \"<task>\" # Multi-agent orchestration for complex tasks\n```\n\n### Direct AI Usage\n```bash\nsnow-code # Start SnowCode with all 22 MCP servers\nclaude # Start Claude Code with MCP servers (if installed)\n```\n\n## \uD83D\uDEE0\uFE0F Configuration\n\n### .env File\n\nCreated by `snow-flow init`, configure these variables:\n\n```env\n# ServiceNow Instance\nSNOW_INSTANCE=your-instance.service-now.com\nSNOW_CLIENT_ID=your-oauth-client-id\nSNOW_CLIENT_SECRET=your-oauth-client-secret\n\n# LLM Provider (auto-set by auth login)\nDEFAULT_LLM_PROVIDER=anthropic # or openai, google, ollama\n\n# Optional: Direct API key (skips SnowCode auth)\nANTHROPIC_API_KEY=sk-ant-...\n```\n\n### ServiceNow OAuth Setup\n\n1. Log into ServiceNow as admin\n2. Navigate to: **System OAuth > Application Registry**\n3. Click **New** > **Create an OAuth API endpoint for external clients**\n4. Fill in:\n - **Name**: Snow-Flow\n - **Client ID**: (auto-generated, copy this)\n - **Client Secret**: (auto-generated, copy this)\n - **Redirect URL**: http://localhost:3000/oauth/callback\n5. Save and copy Client ID and Secret to your .env file\n6. Run `snow-flow auth login` to complete authentication\n\n## \uD83D\uDCC1 Project Structure\n\nAfter running `snow-flow init`:\n\n```\nyour-project/\n\u251C\u2500\u2500 .env # Environment configuration (DO NOT COMMIT)\n\u251C\u2500\u2500 .env.example # Example environment template\n\u251C\u2500\u2500 CLAUDE.md # AI instructions (primary)\n\u251C\u2500\u2500 AGENTS.md # AI instructions (SnowCode copy)\n\u251C\u2500\u2500 .snowcode/ # SnowCode configuration\n\u2502 \u2514\u2500\u2500 config.json # MCP servers for SnowCode\n\u251C\u2500\u2500 .claude/ # Claude Code configuration\n\u2502 \u2514\u2500\u2500 config.json # MCP servers for Claude Code\n\u251C\u2500\u2500 .mcp.json # Unified MCP server configuration\n\u251C\u2500\u2500 .snow-flow/ # Snow-Flow workspace\n\u2502 \u251C\u2500\u2500 memory/ # Persistent agent memory\n\u2502 \u2514\u2500\u2500 artifacts/ # Local artifact cache\n\u2514\u2500\u2500 README.md # This file\n```\n\n## \uD83C\uDF93 Learning Resources\n\n### Documentation Files\n\n- **CLAUDE.md** / **AGENTS.md** - Complete AI instructions and best practices\n- **SERVICENOW-OAUTH-SETUP.md** - Detailed OAuth configuration guide\n- **TRADEMARK.md** - Brand guidelines and usage\n\n### Online Resources\n\n- [ServiceNow Developer Portal](https://developer.servicenow.com)\n- [ServiceNow Flow Designer Documentation](https://docs.servicenow.com/flow-designer)\n- [ServiceNow REST API Reference](https://docs.servicenow.com/rest-api)\n\n## \uD83D\uDD12 Security Best Practices\n\n1. **Never commit .env** - Already in .gitignore\n2. **Use OAuth 2.0** - More secure than basic authentication\n3. **Rotate credentials** - Change OAuth secrets periodically\n4. **Test in dev first** - Always test in development instances\n5. **Use Update Sets** - Track all changes professionally\n6. **Review AI output** - Always review generated code before deployment\n\n## \uD83D\uDC1B Troubleshooting\n\n### \"SnowCode is not installed\"\n\n```bash\nnpm install -g @groeimetai/snow-code\n```\n\n### \"ServiceNow authentication failed\"\n\n1. Check your .env credentials are correct\n2. Verify OAuth application is configured in ServiceNow\n3. Ensure redirect URL is http://localhost:3000/oauth/callback\n4. Run `snow-flow auth status` to see detailed error\n\n### \"MCP servers not loading\"\n\n1. Make sure you ran `snow-flow init` in your project directory\n2. Check that .snowcode/config.json exists\n3. Restart SnowCode/Claude Code after running init\n\n### \"Widget coherence validation failed\"\n\nThis means your widget's HTML, client script, and server script don't communicate properly. Use Local Sync to debug:\n\n```javascript\n// In SnowCode/Claude Code:\nsnow_pull_artifact({ sys_id: 'your_widget_sys_id', table: 'sp_widget' })\n// Edit locally, then push back\nsnow_push_artifact({ sys_id: 'your_widget_sys_id' })\n```\n\n## \uD83E\uDD1D Contributing\n\nWe welcome contributions! Snow-Flow is open source.\n\n## \uD83D\uDCDD License\n\nElastic License 2.0 - see LICENSE file for details\n\n**What this means:**\n- \u2705 Free to use, modify, and redistribute\n- \u2705 Can be used commercially\n- \u2705 Full source code access\n- \u26A0\uFE0F Cannot provide Snow-Flow as a managed service to third parties\n- \u26A0\uFE0F Cannot remove or obscure licensing/copyright notices\n\nFor full license details: https://www.elastic.co/licensing/elastic-license\n\n## \uD83D\uDE4F Acknowledgments\n\nBuilt with \u2764\uFE0F using:\n- [ServiceNow Platform](https://www.servicenow.com)\n- [Anthropic Claude](https://www.anthropic.com/claude)\n- [SnowCode AI](https://snowcode.ai)\n- [Model Context Protocol (MCP)](https://modelcontextprotocol.io)\n\n---\n\n**Ready to revolutionize your ServiceNow development?**\n\n```bash\nnpm install -g snow-flow\nsnow-flow init\nsnow-flow auth login\nsnow-flow swarm \"create an awesome ServiceNow widget\"\n```\n\n\uD83D\uDE80 **Happy building!**\n";
|
|
2
2
|
//# sourceMappingURL=readme-template.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readme-template.d.ts","sourceRoot":"","sources":["../../src/templates/readme-template.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"readme-template.d.ts","sourceRoot":"","sources":["../../src/templates/readme-template.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,u6XAsV3B,CAAC"}
|
|
@@ -54,7 +54,7 @@ This will:
|
|
|
54
54
|
snow-flow swarm "create an incident dashboard widget"
|
|
55
55
|
|
|
56
56
|
# Or use SnowCode/Claude Code directly (MCP servers auto-configured)
|
|
57
|
-
|
|
57
|
+
snow-code # All 22 MCP servers available automatically
|
|
58
58
|
\`\`\`
|
|
59
59
|
|
|
60
60
|
## 🎯 Key Features
|
|
@@ -194,7 +194,7 @@ snow-flow swarm "<task>" # Multi-agent orchestration for complex tasks
|
|
|
194
194
|
|
|
195
195
|
### Direct AI Usage
|
|
196
196
|
\`\`\`bash
|
|
197
|
-
|
|
197
|
+
snow-code # Start SnowCode with all 22 MCP servers
|
|
198
198
|
claude # Start Claude Code with MCP servers (if installed)
|
|
199
199
|
\`\`\`
|
|
200
200
|
|
|
@@ -279,7 +279,7 @@ your-project/
|
|
|
279
279
|
### "SnowCode is not installed"
|
|
280
280
|
|
|
281
281
|
\`\`\`bash
|
|
282
|
-
npm install -g
|
|
282
|
+
npm install -g @groeimetai/snow-code
|
|
283
283
|
\`\`\`
|
|
284
284
|
|
|
285
285
|
### "ServiceNow authentication failed"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "snow-flow",
|
|
3
|
-
"version": "8.31.
|
|
3
|
+
"version": "8.31.36",
|
|
4
4
|
"description": "ServiceNow development with SnowCode - 75+ LLM providers (Claude, GPT, Gemini, Llama, Mistral, DeepSeek, Groq, Ollama) • 393 Optimized Tools • 2 MCP Servers • Multi-agent orchestration • Use ANY AI coding assistant (ML tools moved to Enterprise)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -498,6 +498,7 @@
|
|
|
498
498
|
"@anthropic-ai/claude-agent-sdk": "0.1.1",
|
|
499
499
|
"@anthropic-ai/sdk": "0.67.0",
|
|
500
500
|
"@clack/prompts": "^0.11.0",
|
|
501
|
+
"@groeimetai/snow-code": "^0.18.48",
|
|
501
502
|
"@modelcontextprotocol/sdk": "1.20.1",
|
|
502
503
|
"@tensorflow/tfjs": "^4.22.0",
|
|
503
504
|
"@types/node-fetch": "^2.6.13",
|
|
@@ -544,14 +545,6 @@
|
|
|
544
545
|
"ts-jest": "29.4.5",
|
|
545
546
|
"typescript": "5.9.3"
|
|
546
547
|
},
|
|
547
|
-
"peerDependencies": {
|
|
548
|
-
"@groeimetai/snow-code": "^0.18.48"
|
|
549
|
-
},
|
|
550
|
-
"peerDependenciesMeta": {
|
|
551
|
-
"@groeimetai/snow-code": {
|
|
552
|
-
"optional": false
|
|
553
|
-
}
|
|
554
|
-
},
|
|
555
548
|
"overrides": {
|
|
556
549
|
"zod": "4.1.12"
|
|
557
550
|
},
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Test Authentication Flow
|
|
5
|
+
*
|
|
6
|
+
* This script verifies that the MCP server can properly load credentials
|
|
7
|
+
* from either environment variables or snow-code auth.json.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const fs = require('fs');
|
|
11
|
+
const path = require('path');
|
|
12
|
+
const os = require('os');
|
|
13
|
+
|
|
14
|
+
console.log('🔐 Testing Snow-Flow Authentication Flow\n');
|
|
15
|
+
|
|
16
|
+
// Test 1: Check for auth.json
|
|
17
|
+
console.log('Test 1: Checking snow-code auth.json...');
|
|
18
|
+
const authPath = path.join(os.homedir(), '.local', 'share', 'snow-code', 'auth.json');
|
|
19
|
+
|
|
20
|
+
if (fs.existsSync(authPath)) {
|
|
21
|
+
console.log('✅ auth.json exists at:', authPath);
|
|
22
|
+
|
|
23
|
+
try {
|
|
24
|
+
const authData = JSON.parse(fs.readFileSync(authPath, 'utf-8'));
|
|
25
|
+
const servicenowCreds = authData['servicenow'];
|
|
26
|
+
|
|
27
|
+
if (servicenowCreds && servicenowCreds.type === 'servicenow-oauth') {
|
|
28
|
+
console.log('✅ ServiceNow OAuth credentials found');
|
|
29
|
+
console.log(' Instance:', servicenowCreds.instance);
|
|
30
|
+
console.log(' Client ID:', servicenowCreds.clientId ? '***' + servicenowCreds.clientId.slice(-4) : 'NOT SET');
|
|
31
|
+
console.log(' Client Secret:', servicenowCreds.clientSecret ? '***' + servicenowCreds.clientSecret.slice(-4) : 'NOT SET');
|
|
32
|
+
console.log(' Has Refresh Token:', !!servicenowCreds.refreshToken);
|
|
33
|
+
} else {
|
|
34
|
+
console.log('❌ No ServiceNow OAuth credentials in auth.json');
|
|
35
|
+
console.log(' Run: snow-flow auth login');
|
|
36
|
+
}
|
|
37
|
+
} catch (error) {
|
|
38
|
+
console.log('❌ Failed to parse auth.json:', error.message);
|
|
39
|
+
}
|
|
40
|
+
} else {
|
|
41
|
+
console.log('❌ auth.json not found');
|
|
42
|
+
console.log(' Expected location:', authPath);
|
|
43
|
+
console.log(' Run: snow-flow auth login');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
console.log('');
|
|
47
|
+
|
|
48
|
+
// Test 2: Check environment variables
|
|
49
|
+
console.log('Test 2: Checking environment variables...');
|
|
50
|
+
const envVars = [
|
|
51
|
+
'SERVICENOW_INSTANCE_URL',
|
|
52
|
+
'SERVICENOW_CLIENT_ID',
|
|
53
|
+
'SERVICENOW_CLIENT_SECRET',
|
|
54
|
+
'SERVICENOW_REFRESH_TOKEN',
|
|
55
|
+
'SNOW_INSTANCE',
|
|
56
|
+
'SNOW_CLIENT_ID',
|
|
57
|
+
'SNOW_CLIENT_SECRET',
|
|
58
|
+
'SNOW_REFRESH_TOKEN'
|
|
59
|
+
];
|
|
60
|
+
|
|
61
|
+
let hasEnvVars = false;
|
|
62
|
+
envVars.forEach(varName => {
|
|
63
|
+
const value = process.env[varName];
|
|
64
|
+
if (value && value.trim() !== '' && !value.includes('your-')) {
|
|
65
|
+
console.log(`✅ ${varName}: SET`);
|
|
66
|
+
hasEnvVars = true;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
if (!hasEnvVars) {
|
|
71
|
+
console.log('ℹ️ No environment variables set (this is OK if using auth.json)');
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
console.log('');
|
|
75
|
+
|
|
76
|
+
// Test 3: Check .mcp.json
|
|
77
|
+
console.log('Test 3: Checking project .mcp.json...');
|
|
78
|
+
const mcpPath = path.join(process.cwd(), '.mcp.json');
|
|
79
|
+
|
|
80
|
+
if (fs.existsSync(mcpPath)) {
|
|
81
|
+
console.log('✅ .mcp.json exists');
|
|
82
|
+
|
|
83
|
+
try {
|
|
84
|
+
const mcpData = JSON.parse(fs.readFileSync(mcpPath, 'utf-8'));
|
|
85
|
+
const serversKey = mcpData.mcpServers ? 'mcpServers' : 'servers';
|
|
86
|
+
const server = mcpData[serversKey]?.['servicenow-unified'];
|
|
87
|
+
|
|
88
|
+
if (server) {
|
|
89
|
+
const envKey = server.environment !== undefined ? 'environment' : 'env';
|
|
90
|
+
const env = server[envKey];
|
|
91
|
+
|
|
92
|
+
if (env && env.SERVICENOW_INSTANCE_URL) {
|
|
93
|
+
console.log('✅ servicenow-unified server configured with credentials');
|
|
94
|
+
console.log(' Instance:', env.SERVICENOW_INSTANCE_URL);
|
|
95
|
+
} else {
|
|
96
|
+
console.log('⚠️ servicenow-unified server found but no credentials in env');
|
|
97
|
+
}
|
|
98
|
+
} else {
|
|
99
|
+
console.log('⚠️ No servicenow-unified server in .mcp.json');
|
|
100
|
+
}
|
|
101
|
+
} catch (error) {
|
|
102
|
+
console.log('❌ Failed to parse .mcp.json:', error.message);
|
|
103
|
+
}
|
|
104
|
+
} else {
|
|
105
|
+
console.log('ℹ️ .mcp.json not found (this is OK)');
|
|
106
|
+
console.log(' Run: snow-flow init (to create project config)');
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
console.log('');
|
|
110
|
+
|
|
111
|
+
// Test 4: Check token cache
|
|
112
|
+
console.log('Test 4: Checking token cache...');
|
|
113
|
+
const tokenCachePath = path.join(os.homedir(), '.snow-flow', 'token-cache.json');
|
|
114
|
+
|
|
115
|
+
if (fs.existsSync(tokenCachePath)) {
|
|
116
|
+
console.log('✅ Token cache exists');
|
|
117
|
+
|
|
118
|
+
try {
|
|
119
|
+
const cacheData = JSON.parse(fs.readFileSync(tokenCachePath, 'utf-8'));
|
|
120
|
+
const instances = Object.keys(cacheData);
|
|
121
|
+
|
|
122
|
+
if (instances.length > 0) {
|
|
123
|
+
console.log(`✅ ${instances.length} instance(s) cached`);
|
|
124
|
+
instances.forEach(instance => {
|
|
125
|
+
const token = cacheData[instance];
|
|
126
|
+
const expiresIn = token.expiresAt - Date.now();
|
|
127
|
+
const isExpired = expiresIn <= 0;
|
|
128
|
+
|
|
129
|
+
console.log(` - ${instance}: ${isExpired ? '❌ EXPIRED' : '✅ Valid'} (expires in ${Math.round(expiresIn / 1000 / 60)} min)`);
|
|
130
|
+
});
|
|
131
|
+
} else {
|
|
132
|
+
console.log('ℹ️ Token cache empty (tokens will be fetched on first use)');
|
|
133
|
+
}
|
|
134
|
+
} catch (error) {
|
|
135
|
+
console.log('⚠️ Failed to parse token cache:', error.message);
|
|
136
|
+
}
|
|
137
|
+
} else {
|
|
138
|
+
console.log('ℹ️ No token cache yet (will be created on first API call)');
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
console.log('');
|
|
142
|
+
|
|
143
|
+
// Summary
|
|
144
|
+
console.log('📊 Summary:');
|
|
145
|
+
console.log('═══════════════════════════════════════════════════════════');
|
|
146
|
+
|
|
147
|
+
const authJsonExists = fs.existsSync(authPath);
|
|
148
|
+
const hasMcpJson = fs.existsSync(mcpPath);
|
|
149
|
+
|
|
150
|
+
if (authJsonExists) {
|
|
151
|
+
console.log('✅ Authentication configured via auth.json');
|
|
152
|
+
console.log(' The MCP server will automatically use these credentials');
|
|
153
|
+
} else if (hasEnvVars) {
|
|
154
|
+
console.log('✅ Authentication configured via environment variables');
|
|
155
|
+
console.log(' The MCP server will use these credentials');
|
|
156
|
+
} else {
|
|
157
|
+
console.log('❌ No authentication configured');
|
|
158
|
+
console.log('');
|
|
159
|
+
console.log('To fix:');
|
|
160
|
+
console.log(' 1. Run: snow-flow auth login');
|
|
161
|
+
console.log(' 2. Or set environment variables manually');
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
console.log('');
|
|
165
|
+
console.log('Authentication Priority:');
|
|
166
|
+
console.log(' 1. Environment variables (SERVICENOW_* or SNOW_*)');
|
|
167
|
+
console.log(' 2. snow-code auth.json (~/.local/share/snow-code/auth.json)');
|
|
168
|
+
console.log(' 3. Unauthenticated mode (tools will fail with auth errors)');
|
|
169
|
+
|
|
170
|
+
console.log('');
|
|
171
|
+
console.log('For detailed documentation, see: AUTH-FLOW.md');
|
|
172
|
+
console.log('═══════════════════════════════════════════════════════════');
|