@leonailtd/priority-mcp-client 0.5.4 → 0.6.1

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 CHANGED
@@ -1,21 +1,39 @@
1
- MIT License
1
+ PROPRIETARY SOFTWARE LICENSE
2
2
 
3
- Copyright (c) 2025 LeonAI
3
+ Copyright (c) 2025-2026 LeonAI Ltd. All rights reserved.
4
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:
5
+ This software and associated documentation files (the "Software") are the
6
+ proprietary and confidential property of LeonAI Ltd.
11
7
 
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
8
+ RESTRICTIONS:
9
+
10
+ 1. You may NOT copy, modify, merge, publish, distribute, sublicense, or sell
11
+ copies of the Software.
12
+
13
+ 2. You may NOT reverse engineer, decompile, disassemble, or otherwise attempt
14
+ to derive the source code of the Software.
15
+
16
+ 3. You may NOT create derivative works based on the Software.
17
+
18
+ 4. You may NOT redistribute the Software in any form.
19
+
20
+ 5. You may only use the Software as an end user through the officially
21
+ published npm package (@leonailtd/priority-mcp-client) for the purpose of
22
+ connecting to LeonAI's Priority MCP server.
23
+
24
+ TERMINATION:
25
+
26
+ This license is effective until terminated. It will terminate automatically
27
+ without notice if you fail to comply with any of its terms. Upon termination,
28
+ you must destroy all copies of the Software in your possession.
29
+
30
+ DISCLAIMER:
14
31
 
15
32
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
33
  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.
34
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
35
+ LEONAI LTD BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
36
+ AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
37
+ CONNECTION WITH THE SOFTWARE OR ITS USE.
38
+
39
+ For licensing inquiries: support@leonai.io
package/README.md CHANGED
@@ -7,18 +7,33 @@ MCP client for Priority ERP that connects Claude Desktop to a remote Priority MC
7
7
  No installation required! Use with `npx`:
8
8
 
9
9
  ```bash
10
- npx @leonailtd/priority-mcp-client --url https://priority-mcp.leonai.io --token sk-cust-xxx ...
10
+ npx @leonailtd/priority-mcp-client --token sk-cust-YOUR_KEY
11
11
  ```
12
12
 
13
13
  ## Usage
14
14
 
15
- ### With Claude Desktop
15
+ ### With Claude Desktop (credentials stored server-side)
16
16
 
17
- Add this configuration to your `claude_desktop_config.json`:
17
+ If you registered via the self-service form, your Priority credentials are already stored on the server. You only need your API key:
18
18
 
19
- **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
20
- **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
21
- **Linux:** `~/.config/Claude/claude_desktop_config.json`
19
+ ```json
20
+ {
21
+ "mcpServers": {
22
+ "priority-erp": {
23
+ "command": "npx",
24
+ "args": [
25
+ "@leonailtd/priority-mcp-client",
26
+ "--token",
27
+ "sk-cust-YOUR_API_KEY_HERE"
28
+ ]
29
+ }
30
+ }
31
+ }
32
+ ```
33
+
34
+ ### With Claude Desktop (credentials via CLI)
35
+
36
+ If your credentials are NOT stored server-side, pass them as arguments:
22
37
 
23
38
  ```json
24
39
  {
@@ -27,8 +42,6 @@ Add this configuration to your `claude_desktop_config.json`:
27
42
  "command": "npx",
28
43
  "args": [
29
44
  "@leonailtd/priority-mcp-client",
30
- "--url",
31
- "https://priority-mcp.leonai.io",
32
45
  "--token",
33
46
  "sk-cust-YOUR_API_KEY_HERE",
34
47
  "--priority-url",
@@ -45,21 +58,25 @@ Add this configuration to your `claude_desktop_config.json`:
45
58
  }
46
59
  ```
47
60
 
61
+ ### Config file location
62
+
63
+ **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
64
+ **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
65
+ **Linux:** `~/.config/Claude/claude_desktop_config.json`
66
+
48
67
  ### Command-Line Options
49
68
 
50
69
  | Option | Required | Description |
51
70
  |--------|----------|-------------|
52
- | `--url` | Yes | Priority MCP server URL (e.g., https://priority-mcp.leonai.io) |
53
71
  | `--token` | Yes | Authentication token from tenant provisioning (sk-cust-...) |
54
- | `--priority-url` | Yes | Your Priority ERP base URL |
55
- | `--priority-company` | Yes | Your company code in Priority |
56
- | `--priority-username` | Yes | Priority API username |
57
- | `--priority-password` | Yes | Priority API password |
72
+ | `--url` | No | Server URL (default: https://priority-mcp.leonai.io) |
73
+ | `--priority-url` | No | Your Priority ERP base URL (optional if stored server-side) |
74
+ | `--priority-company` | No | Your company code in Priority (optional if stored server-side) |
75
+ | `--priority-username` | No | Priority API username (optional if stored server-side) |
76
+ | `--priority-password` | No | Priority API password (optional if stored server-side) |
77
+ | `--priority-tabulaini` | No | Tabula.ini profile (default: tabula.ini) |
58
78
  | `--debug` | No | Enable debug logging to stderr |
59
-
60
- ### Getting Your API Token
61
-
62
- Contact your Priority MCP administrator to provision a tenant and receive your API key.
79
+ | `--verbose` | No | Enable verbose logging (includes request/response details) |
63
80
 
64
81
  ## How It Works
65
82
 
@@ -67,22 +84,23 @@ This client acts as a proxy between Claude Desktop (stdio transport) and the rem
67
84
 
68
85
  ```
69
86
  Claude Desktop (stdio)
70
-
87
+ |
71
88
  Priority MCP Client (this package)
72
-
89
+ |
73
90
  Remote Priority MCP Server (HTTP/SSE)
74
-
91
+ |
75
92
  Priority ERP API
76
93
  ```
77
94
 
78
95
  ## Features
79
96
 
80
- - No installation required (uses npx)
81
- - Works with Claude Desktop out of the box
82
- - Secure authentication with API keys
83
- - Supports all MCP protocol features (tools, resources, prompts)
84
- - Debug logging available
85
- - Cross-platform (Windows, macOS, Linux)
97
+ - No installation required (uses npx)
98
+ - Works with Claude Desktop out of the box
99
+ - Secure authentication with API keys
100
+ - Server-stored credentials (no passwords in config files)
101
+ - Supports all MCP protocol features (tools, resources, prompts)
102
+ - Debug logging available
103
+ - Cross-platform (Windows, macOS, Linux)
86
104
 
87
105
  ## Troubleshooting
88
106
 
@@ -90,25 +108,22 @@ Priority ERP API
90
108
 
91
109
  If you see connection errors:
92
110
 
93
- 1. Verify the `--url` is correct
111
+ 1. Verify the server is running: `curl https://priority-mcp.leonai.io/health`
94
112
  2. Check your `--token` is valid
95
- 3. Ensure Priority credentials are correct
96
- 4. Try with `--debug` flag to see detailed logs
97
-
98
- ### stdio Communication Errors
113
+ 3. Try with `--debug` flag to see detailed logs
99
114
 
100
- If Claude Desktop can't connect:
115
+ ### Claude Desktop Can't Connect
101
116
 
102
117
  1. Restart Claude Desktop completely
103
118
  2. Verify the config file syntax (valid JSON)
104
- 3. Check Node.js is installed (`node --version`)
119
+ 3. Check Node.js is installed (`node --version`, requires >= 18)
105
120
 
106
121
  ### Authentication Errors
107
122
 
108
123
  If you get 401/403 errors:
109
124
 
110
125
  1. Verify your API key is active (not expired/revoked)
111
- 2. Check Priority credentials work directly in Priority
126
+ 2. If using CLI credentials, check they work directly in Priority
112
127
  3. Confirm Priority URL is accessible
113
128
 
114
129
  ## Support
@@ -120,4 +135,4 @@ For issues or questions:
120
135
 
121
136
  ## License
122
137
 
123
- MIT License - see LICENSE file for details
138
+ Proprietary - see LICENSE file for details. All rights reserved by LeonAI Ltd.
package/dist/bin.js CHANGED
@@ -1,298 +1,2 @@
1
1
  #!/usr/bin/env node
2
-
3
- // src/bin.ts
4
- import { program } from "commander";
5
- import { Client } from "@modelcontextprotocol/sdk/client/index.js";
6
- import { Server } from "@modelcontextprotocol/sdk/server/index.js";
7
- import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
8
- import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
9
- import {
10
- ListToolsRequestSchema,
11
- CallToolRequestSchema,
12
- ListResourcesRequestSchema,
13
- ReadResourceRequestSchema,
14
- ListPromptsRequestSchema,
15
- GetPromptRequestSchema
16
- } from "@modelcontextprotocol/sdk/types.js";
17
- var MCP_SERVER_URL = "https://priority-mcp-server-tckpzoz3nq-zf.a.run.app/";
18
- var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
19
- function isRetryableError(error) {
20
- if (!error) return false;
21
- const errorStr = String(error).toLowerCase();
22
- const retryablePatterns = [
23
- "econnreset",
24
- "econnrefused",
25
- "etimedout",
26
- "timeout",
27
- "network",
28
- "socket hang up",
29
- "502",
30
- "503",
31
- "504"
32
- ];
33
- return retryablePatterns.some((pattern) => errorStr.includes(pattern));
34
- }
35
- async function retryWithBackoff(fn, maxRetries = 3, baseDelay = 1e3, debug = false) {
36
- let lastError;
37
- for (let attempt = 0; attempt <= maxRetries; attempt++) {
38
- try {
39
- return await fn();
40
- } catch (error) {
41
- lastError = error;
42
- if (attempt >= maxRetries) {
43
- throw error;
44
- }
45
- if (!isRetryableError(error)) {
46
- throw error;
47
- }
48
- const delay = Math.min(baseDelay * Math.pow(2, attempt), 3e4);
49
- const jitter = Math.random() * 0.25 * delay;
50
- const totalDelay = Math.floor(delay + jitter);
51
- if (debug) {
52
- console.error(`[DEBUG] Retry attempt ${attempt + 1}/${maxRetries} after ${totalDelay}ms`);
53
- }
54
- await sleep(totalDelay);
55
- }
56
- }
57
- throw lastError;
58
- }
59
- var ConnectionMonitor = class {
60
- lastSuccessfulCall = Date.now();
61
- failureCount = 0;
62
- totalCalls = 0;
63
- debug;
64
- constructor(debug = false) {
65
- this.debug = debug;
66
- }
67
- async monitorCall(operation, fn) {
68
- this.totalCalls++;
69
- const startTime = Date.now();
70
- try {
71
- const result = await fn();
72
- this.lastSuccessfulCall = Date.now();
73
- this.failureCount = 0;
74
- const duration = Date.now() - startTime;
75
- if (this.debug && duration > 5e3) {
76
- console.error(`[WARNING] Slow operation: ${operation} took ${duration}ms`);
77
- }
78
- return result;
79
- } catch (error) {
80
- this.failureCount++;
81
- const timeSinceSuccess = Date.now() - this.lastSuccessfulCall;
82
- if (timeSinceSuccess > 6e4 && this.failureCount >= 3) {
83
- console.error("[WARNING] Connection appears degraded");
84
- console.error(`[WARNING] ${this.failureCount} failures in the last ${Math.floor(timeSinceSuccess / 1e3)}s`);
85
- }
86
- throw error;
87
- }
88
- }
89
- };
90
- function getErrorHint(error, context) {
91
- const errorStr = String(error).toLowerCase();
92
- if (errorStr.includes("401") || errorStr.includes("unauthorized")) {
93
- return "Check your API token (--token sk-cust-...)";
94
- }
95
- if (errorStr.includes("403") || errorStr.includes("forbidden")) {
96
- return "Token is valid but lacks permission. Contact your administrator.";
97
- }
98
- if (errorStr.includes("404")) {
99
- return "Server endpoint not found. Contact info@leonai.io if issue persists.";
100
- }
101
- if (errorStr.includes("timeout") || errorStr.includes("etimedout")) {
102
- return "Request timed out. Server may be slow or overloaded.";
103
- }
104
- if (errorStr.includes("econnrefused")) {
105
- return "Connection refused. Verify server is running and URL is correct.";
106
- }
107
- if (errorStr.includes("econnreset") || errorStr.includes("socket hang up")) {
108
- return "Connection lost. Check network connectivity.";
109
- }
110
- if (errorStr.includes("dns") || errorStr.includes("getaddrinfo")) {
111
- return "DNS lookup failed. Check server URL spelling.";
112
- }
113
- return "See error details above";
114
- }
115
- program.name("priority-mcp-client").description("MCP client that proxies Claude Desktop to Priority MCP server").requiredOption("--token <token>", "Authentication token (sk-cust-...)").requiredOption("--priority-url <url>", "Priority ERP base URL").requiredOption("--priority-company <company>", "Priority company name").requiredOption("--priority-username <username>", "Priority API username").requiredOption("--priority-password <password>", "Priority API password").option("--priority-tabulaini <tabulaini>", "Priority tabula.ini file name (default: tabula.ini)", "tabula.ini").option("--debug", "Enable debug logging").option("--verbose", "Enable verbose logging (includes request/response details)").parse();
116
- var options = program.opts();
117
- async function main() {
118
- try {
119
- const debug = options.debug || options.verbose || false;
120
- const verbose = options.verbose || false;
121
- if (debug) {
122
- console.error("[DEBUG] Starting Priority MCP Client v1.0.0");
123
- console.error(`[DEBUG] Server URL: ${MCP_SERVER_URL}`);
124
- }
125
- if (debug) {
126
- console.error("[DEBUG] Performing health check...");
127
- }
128
- try {
129
- const healthUrl = `${MCP_SERVER_URL}/health`;
130
- const healthResponse = await retryWithBackoff(
131
- async () => {
132
- const response = await fetch(healthUrl);
133
- if (!response.ok) {
134
- throw new Error(`Health check failed: ${response.status} ${response.statusText}`);
135
- }
136
- return response.json();
137
- },
138
- 2,
139
- // 2 retries for health check
140
- 500,
141
- // 500ms base delay
142
- debug
143
- );
144
- if (debug) {
145
- console.error("[DEBUG] Health check passed:", JSON.stringify(healthResponse));
146
- }
147
- if (healthResponse.status !== "healthy") {
148
- console.error("[WARNING] Server health check returned non-healthy status");
149
- console.error("[WARNING] Service may be degraded");
150
- }
151
- } catch (error) {
152
- console.error("[ERROR] Server health check failed");
153
- console.error("[ERROR]", error);
154
- console.error("[HINT]", getErrorHint(error, "health check"));
155
- console.error("[HINT] Verify server is running: curl", `${MCP_SERVER_URL}/health`);
156
- process.exit(1);
157
- }
158
- const connectionMonitor = new ConnectionMonitor(debug);
159
- const client = new Client({
160
- name: "priority-mcp-client",
161
- version: "1.0.0"
162
- }, {
163
- capabilities: {}
164
- });
165
- const crypto = await import("crypto");
166
- const tenantIdSource = `${options.priorityCompany.toLowerCase()}@${options.priorityUrl.toLowerCase()}`;
167
- const tenantId = crypto.createHash("sha256").update(tenantIdSource).digest("hex").substring(0, 16);
168
- const headers = {
169
- "User-Agent": "leonai-priority-mcp-client",
170
- "Authorization": `Bearer ${options.token}`,
171
- "X-Tenant-ID": tenantId,
172
- // Unique identifier for rate limiting/tracking
173
- "X-Priority-URL": options.priorityUrl,
174
- "X-Priority-Company": options.priorityCompany,
175
- "X-Priority-Tabulaini": options.priorityTabulaini,
176
- "X-Priority-Username": options.priorityUsername,
177
- "X-Priority-Password": options.priorityPassword
178
- };
179
- if (debug) {
180
- console.error("[DEBUG] Headers prepared (credentials hidden)");
181
- }
182
- const mcpUrl = new URL("/mcp", MCP_SERVER_URL);
183
- const controller = new AbortController();
184
- const timeoutId = setTimeout(() => controller.abort(), 3e4);
185
- const customFetch = async (url, init) => {
186
- const mergedHeaders = { ...headers };
187
- if (init?.headers) {
188
- const sdkHeaders = init.headers instanceof Headers ? Object.fromEntries(init.headers.entries()) : init.headers;
189
- Object.assign(mergedHeaders, sdkHeaders);
190
- }
191
- const fetchInit = {
192
- ...init,
193
- headers: mergedHeaders
194
- };
195
- return fetch(url, fetchInit);
196
- };
197
- const transport = new StreamableHTTPClientTransport(mcpUrl, {
198
- requestInit: {
199
- signal: controller.signal
200
- },
201
- fetch: customFetch
202
- });
203
- try {
204
- await retryWithBackoff(
205
- () => client.connect(transport),
206
- 3,
207
- // 3 retries for connection
208
- 1e3,
209
- // 1s base delay
210
- debug
211
- );
212
- clearTimeout(timeoutId);
213
- if (debug) {
214
- console.error("[DEBUG] Connected to remote Priority MCP server");
215
- }
216
- } catch (error) {
217
- clearTimeout(timeoutId);
218
- console.error("[ERROR] Failed to connect to Priority MCP server");
219
- console.error("[ERROR]", error);
220
- console.error("[HINT]", getErrorHint(error, "connection"));
221
- throw error;
222
- }
223
- const server = new Server({
224
- name: "priority-mcp-proxy",
225
- version: "1.0.0"
226
- }, {
227
- capabilities: {
228
- tools: {},
229
- resources: {},
230
- prompts: {}
231
- }
232
- });
233
- server.setRequestHandler(ListToolsRequestSchema, async () => {
234
- if (debug) console.error("[DEBUG] Forwarding tools/list");
235
- return await connectionMonitor.monitorCall("tools/list", async () => {
236
- return await retryWithBackoff(() => client.listTools(), 2, 500, debug);
237
- });
238
- });
239
- server.setRequestHandler(CallToolRequestSchema, async (request) => {
240
- if (debug) console.error(`[DEBUG] Forwarding tools/call: ${request.params.name}`);
241
- if (verbose) console.error(`[VERBOSE] Tool params:`, JSON.stringify(request.params));
242
- try {
243
- const result = await connectionMonitor.monitorCall(`tools/call/${request.params.name}`, async () => {
244
- return await retryWithBackoff(() => client.callTool(request.params), 3, 1e3, debug);
245
- });
246
- if (verbose) console.error(`[VERBOSE] Tool result:`, JSON.stringify(result).slice(0, 500));
247
- return result;
248
- } catch (error) {
249
- console.error(`[ERROR] Tool call failed: ${request.params.name}`);
250
- console.error(`[HINT]`, getErrorHint(error, "tool call"));
251
- throw error;
252
- }
253
- });
254
- server.setRequestHandler(ListResourcesRequestSchema, async () => {
255
- if (debug) console.error("[DEBUG] Forwarding resources/list");
256
- return await connectionMonitor.monitorCall("resources/list", async () => {
257
- return await retryWithBackoff(() => client.listResources(), 2, 500, debug);
258
- });
259
- });
260
- server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
261
- if (debug) console.error(`[DEBUG] Forwarding resources/read: ${request.params.uri}`);
262
- return await connectionMonitor.monitorCall(`resources/read/${request.params.uri}`, async () => {
263
- return await retryWithBackoff(() => client.readResource(request.params), 3, 1e3, debug);
264
- });
265
- });
266
- server.setRequestHandler(ListPromptsRequestSchema, async () => {
267
- if (debug) console.error("[DEBUG] Forwarding prompts/list");
268
- return await connectionMonitor.monitorCall("prompts/list", async () => {
269
- return await retryWithBackoff(() => client.listPrompts(), 2, 500, debug);
270
- });
271
- });
272
- server.setRequestHandler(GetPromptRequestSchema, async (request) => {
273
- if (debug) console.error(`[DEBUG] Forwarding prompts/get: ${request.params.name}`);
274
- return await connectionMonitor.monitorCall(`prompts/get/${request.params.name}`, async () => {
275
- return await retryWithBackoff(() => client.getPrompt(request.params), 2, 500, debug);
276
- });
277
- });
278
- const stdioTransport = new StdioServerTransport();
279
- await server.connect(stdioTransport);
280
- if (debug) {
281
- console.error("[DEBUG] Stdio server ready, proxy active");
282
- }
283
- process.on("SIGINT", async () => {
284
- if (debug) console.error("[DEBUG] Shutting down...");
285
- await server.close();
286
- await client.close();
287
- process.exit(0);
288
- });
289
- } catch (error) {
290
- console.error("Failed to start Priority MCP client:", error);
291
- process.exit(1);
292
- }
293
- }
294
- main().catch((error) => {
295
- console.error("Fatal error:", error);
296
- process.exit(1);
297
- });
298
- //# sourceMappingURL=bin.js.map
2
+ const _0x2e58f4=_0x5d52;(function(_0x3e905b,_0xc8df8d){const _0x480ee4={_0x56fc66:0x15e,_0x29a10e:0x117,_0x16be82:0x11c,_0x116673:0x1d0,_0x113f0a:0xef,_0x31575a:0x177},_0x50f58a=_0x5d52,_0x5306f6=_0x3e905b();while(!![]){try{const _0xf8934f=parseInt(_0x50f58a(0x1cb))/0x1+-parseInt(_0x50f58a(_0x480ee4._0x56fc66))/0x2+parseInt(_0x50f58a(_0x480ee4._0x29a10e))/0x3*(-parseInt(_0x50f58a(_0x480ee4._0x16be82))/0x4)+-parseInt(_0x50f58a(0x13a))/0x5+-parseInt(_0x50f58a(0x1c8))/0x6+parseInt(_0x50f58a(_0x480ee4._0x116673))/0x7*(-parseInt(_0x50f58a(0x192))/0x8)+-parseInt(_0x50f58a(_0x480ee4._0x113f0a))/0x9*(-parseInt(_0x50f58a(_0x480ee4._0x31575a))/0xa);if(_0xf8934f===_0xc8df8d)break;else _0x5306f6['push'](_0x5306f6['shift']());}catch(_0x46d324){_0x5306f6['push'](_0x5306f6['shift']());}}}(_0x376f,0x3ac96));import{program as _0x48f160}from'commander';import{Client as _0x56afa4}from'@modelcontextprotocol/sdk/client/index.js';import{Server as _0x50f2ac}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as _0x2d68f1}from'@modelcontextprotocol/sdk/server/stdio.js';import{StreamableHTTPClientTransport as _0x26b546}from'@modelcontextprotocol/sdk/client/streamableHttp.js';import{ListToolsRequestSchema as _0x2d9ab6,CallToolRequestSchema as _0x47369b,ListResourcesRequestSchema as _0x267de1,ReadResourceRequestSchema as _0x442317,ListPromptsRequestSchema as _0x59412c,GetPromptRequestSchema as _0x1a255e}from'@modelcontextprotocol/sdk/types.js';var u=_0xc3a0d9=>new Promise(_0x28344a=>setTimeout(_0x28344a,_0xc3a0d9));function d(_0x1c64c4){const _0xb4e438={_0x1562fa:0x102,_0x1e3e78:0x12c,_0x277f41:0x180,_0x25e5d4:0x138,_0x1978a9:0x172,_0x35892a:0x101},_0x36b5c9=_0x5d52,_0x5563a4={'zlHJN':function(_0x2abb91,_0x1f1f3b){return _0x2abb91(_0x1f1f3b);},'gxtLA':'econnreset','VNlsc':_0x36b5c9(_0xb4e438._0x1562fa),'UHaLO':_0x36b5c9(0x18c),'JAyIh':_0x36b5c9(0x168),'PnAvH':_0x36b5c9(0x1a2),'ZiBXp':_0x36b5c9(_0xb4e438._0x1e3e78)};if(!_0x1c64c4)return!0x1;const _0x51eeaa=_0x5563a4[_0x36b5c9(_0xb4e438._0x277f41)](String,_0x1c64c4)[_0x36b5c9(_0xb4e438._0x25e5d4)]();return[_0x5563a4['gxtLA'],_0x5563a4[_0x36b5c9(0x146)],_0x36b5c9(_0xb4e438._0x1978a9),'timeout',_0x5563a4[_0x36b5c9(0x140)],_0x36b5c9(_0xb4e438._0x35892a),_0x5563a4[_0x36b5c9(0x14a)],_0x5563a4[_0x36b5c9(0x164)],_0x5563a4[_0x36b5c9(0x1b1)]][_0x36b5c9(0x1ac)](_0x5e6839=>_0x51eeaa[_0x36b5c9(0x137)](_0x5e6839));}async function m(_0x3b2a09,_0x39bc71=0x3,_0x3d6bc6=0x3e8,_0x84b9af=!0x1){const _0x2d28cb={_0x1f8f0c:0x108,_0x539d15:0x1c3,_0x419169:0x1b3,_0x4bcb96:0x166,_0x3fe0eb:0x198,_0x35f6f2:0xee},_0x21ac1a=_0x5d52,_0x43b83b={'piiim':function(_0x1b0145,_0x4ce5e9){return _0x1b0145<=_0x4ce5e9;},'FhRFY':function(_0x2eb5ef){return _0x2eb5ef();},'wmsoV':function(_0x383fc0,_0x1c8f3e){return _0x383fc0>=_0x1c8f3e;},'SycUq':function(_0x4dbf18,_0x306a1b){return _0x4dbf18*_0x306a1b;},'eTFOJ':function(_0xb39183,_0x447f6c){return _0xb39183+_0x447f6c;},'ENzDL':function(_0x376d18,_0x3b858a){return _0x376d18+_0x3b858a;}};let _0x27ab47;for(let _0x30836a=0x0;_0x43b83b[_0x21ac1a(0x1c9)](_0x30836a,_0x39bc71);_0x30836a++)try{return await _0x43b83b[_0x21ac1a(_0x2d28cb._0x1f8f0c)](_0x3b2a09);}catch(_0x3c0857){if(_0x27ab47=_0x3c0857,_0x43b83b[_0x21ac1a(_0x2d28cb._0x539d15)](_0x30836a,_0x39bc71))throw _0x3c0857;if(!d(_0x3c0857))throw _0x3c0857;const _0x3e0f32=Math[_0x21ac1a(_0x2d28cb._0x419169)](_0x3d6bc6*Math[_0x21ac1a(0x12f)](0x2,_0x30836a),0x7530),_0x3c6339=_0x43b83b[_0x21ac1a(_0x2d28cb._0x4bcb96)](_0x43b83b[_0x21ac1a(0x166)](0.25,Math[_0x21ac1a(_0x2d28cb._0x3fe0eb)]()),_0x3e0f32),_0x3671ed=Math[_0x21ac1a(0x1a5)](_0x43b83b['eTFOJ'](_0x3e0f32,_0x3c6339));_0x84b9af&&console[_0x21ac1a(_0x2d28cb._0x35f6f2)]('[DEBUG]\x20Retry\x20attempt\x20'+_0x43b83b[_0x21ac1a(0x194)](_0x30836a,0x1)+'/'+_0x39bc71+'\x20after\x20'+_0x3671ed+'ms'),await u(_0x3671ed);}throw _0x27ab47;}function _0x5d52(_0x37a6a8,_0x198ce5){_0x37a6a8=_0x37a6a8-0xdf;const _0x435cff=_0x376f();let _0x454a4c=_0x435cff[_0x37a6a8];if(_0x5d52['vcxLyn']===undefined){var _0x4cc9ef=function(_0x261a6c){const _0x578245='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x3eba2c='',_0x71e72a='',_0x181376=_0x3eba2c+_0x4cc9ef;for(let _0x10c357=0x0,_0x1dc6fc,_0x5ac8d0,_0x22950c=0x0;_0x5ac8d0=_0x261a6c['charAt'](_0x22950c++);~_0x5ac8d0&&(_0x1dc6fc=_0x10c357%0x4?_0x1dc6fc*0x40+_0x5ac8d0:_0x5ac8d0,_0x10c357++%0x4)?_0x3eba2c+=_0x181376['charCodeAt'](_0x22950c+0xa)-0xa!==0x0?String['fromCharCode'](0xff&_0x1dc6fc>>(-0x2*_0x10c357&0x6)):_0x10c357:0x0){_0x5ac8d0=_0x578245['indexOf'](_0x5ac8d0);}for(let _0x5b182f=0x0,_0x471c6d=_0x3eba2c['length'];_0x5b182f<_0x471c6d;_0x5b182f++){_0x71e72a+='%'+('00'+_0x3eba2c['charCodeAt'](_0x5b182f)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x71e72a);};_0x5d52['yaUhLR']=_0x4cc9ef,_0x5d52['bNwvNu']={},_0x5d52['vcxLyn']=!![];}const _0x376f41=_0x435cff[0x0],_0x5d52fb=_0x37a6a8+_0x376f41,_0x14f84b=_0x5d52['bNwvNu'][_0x5d52fb];if(!_0x14f84b){const _0x2b90f1=function(_0x1ffd03){this['dZxKBU']=_0x1ffd03,this['aMLAdQ']=[0x1,0x0,0x0],this['CFOosG']=function(){return'newState';},this['YBrXld']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['VRjcKW']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x2b90f1['prototype']['IGmwxO']=function(){const _0xd8734a=new RegExp(this['YBrXld']+this['VRjcKW']),_0x5ec35b=_0xd8734a['test'](this['CFOosG']['toString']())?--this['aMLAdQ'][0x1]:--this['aMLAdQ'][0x0];return this['IubDiU'](_0x5ec35b);},_0x2b90f1['prototype']['IubDiU']=function(_0x2ce3af){if(!Boolean(~_0x2ce3af))return _0x2ce3af;return this['NOBRyd'](this['dZxKBU']);},_0x2b90f1['prototype']['NOBRyd']=function(_0x5c9dc0){for(let _0x5e2ec2=0x0,_0x1f2351=this['aMLAdQ']['length'];_0x5e2ec2<_0x1f2351;_0x5e2ec2++){this['aMLAdQ']['push'](Math['round'](Math['random']())),_0x1f2351=this['aMLAdQ']['length'];}return _0x5c9dc0(this['aMLAdQ'][0x0]);},new _0x2b90f1(_0x5d52)['IGmwxO'](),_0x454a4c=_0x5d52['yaUhLR'](_0x454a4c),_0x5d52['bNwvNu'][_0x5d52fb]=_0x454a4c;}else _0x454a4c=_0x14f84b;return _0x454a4c;}var y=class{[_0x2e58f4(0x1c2)]=Date[_0x2e58f4(0x1c4)]();['failureCount']=0x0;[_0x2e58f4(0x116)]=0x0;[_0x2e58f4(0x1b5)];constructor(_0x5e3382=!0x1){const _0x55e668=_0x2e58f4;this[_0x55e668(0x1b5)]=_0x5e3382;}async[_0x2e58f4(0x19e)](_0x89e2f3,_0x33872a){const _0x9d879f={_0x106094:0xe5,_0x26755f:0xf5,_0x35ad97:0x1bc,_0x4cdc25:0x1a7,_0x2ec6c4:0x178,_0x59d67b:0x132,_0x41ebdb:0x1c4,_0x240bd3:0x1a3,_0x50d611:0x1b5,_0x336aa5:0x1cd,_0x34e261:0x19f,_0x28409b:0x129,_0x27ca44:0x14c,_0x17c595:0xee,_0x1951eb:0x131,_0xe9bd77:0x18b,_0x3ff4af:0xee,_0x3b3a9c:0x10c,_0x23501e:0xeb},_0x216db8=_0x2e58f4,_0xfc2b1a={'eNTTS':_0x216db8(_0x9d879f._0x106094),'VySIB':function(_0x376f7a,_0x2c907a){return _0x376f7a(_0x2c907a);},'hEjYx':_0x216db8(_0x9d879f._0x26755f),'ZzJQp':_0x216db8(_0x9d879f._0x35ad97),'xGiVK':_0x216db8(_0x9d879f._0x4cdc25),'yRLAN':function(_0xa6f887,_0x25bcc8){return _0xa6f887(_0x25bcc8);},'Gbsgv':function(_0xf1b05,_0x360360){return _0xf1b05!==_0x360360;},'zUuUj':_0x216db8(0x1d2),'pBgpL':_0x216db8(0x1c5),'TlHgL':function(_0x390ed0){return _0x390ed0();},'LvrNg':function(_0x183f71,_0x5a63de){return _0x183f71>_0x5a63de;},'wAzfi':function(_0x54a3a5,_0x3b6379){return _0x54a3a5===_0x3b6379;},'LWqip':_0x216db8(_0x9d879f._0x2ec6c4),'EhzXE':function(_0x36730b,_0x168b51){return _0x36730b/_0x168b51;}};this['totalCalls']++;const _0x300aa8=Date['now']();try{if(_0xfc2b1a[_0x216db8(_0x9d879f._0x59d67b)](_0xfc2b1a[_0x216db8(0x17a)],_0xfc2b1a[_0x216db8(0x16d)])){const _0x53fbd8=await _0xfc2b1a['TlHgL'](_0x33872a);this[_0x216db8(0x1c2)]=Date[_0x216db8(_0x9d879f._0x41ebdb)](),this[_0x216db8(_0x9d879f._0x240bd3)]=0x0;const _0x2bbf0b=Date[_0x216db8(0x1c4)]()-_0x300aa8;return this[_0x216db8(_0x9d879f._0x50d611)]&&_0xfc2b1a[_0x216db8(_0x9d879f._0x336aa5)](_0x2bbf0b,0x1388)&&console[_0x216db8(0xee)]('[WARNING]\x20Slow\x20operation:\x20'+_0x89e2f3+_0x216db8(0x1d7)+_0x2bbf0b+'ms'),_0x53fbd8;}else return _0x132ec1[_0x216db8(0x19f)]()['search'](UbaUqS['eNTTS'])[_0x216db8(_0x9d879f._0x34e261)]()['constructor'](_0x31c1d4)[_0x216db8(0x19d)](UbaUqS[_0x216db8(0xf3)]);}catch(_0x1dc721){if(_0xfc2b1a[_0x216db8(0x15c)](_0xfc2b1a[_0x216db8(_0x9d879f._0x28409b)],_0xfc2b1a['LWqip'])){this[_0x216db8(0x1a3)]++;const _0x52c519=Date[_0x216db8(_0x9d879f._0x41ebdb)]()-this['lastSuccessfulCall'];throw _0x52c519>0xea60&&this[_0x216db8(0x1a3)]>=0x3&&(console['error'](_0x216db8(_0x9d879f._0x27ca44)),console[_0x216db8(_0x9d879f._0x17c595)](_0x216db8(0x135)+this[_0x216db8(0x1a3)]+_0x216db8(0xf2)+Math['floor'](_0xfc2b1a[_0x216db8(_0x9d879f._0x1951eb)](_0x52c519,0x3e8))+'s')),_0x1dc721;}else throw _0xfc2b1a[_0x216db8(_0x9d879f._0xe9bd77)](_0x3ebb82,_0x292b0f),_0x34990a[_0x216db8(0xee)](_0xfc2b1a[_0x216db8(0x1ca)]),_0x52e890[_0x216db8(_0x9d879f._0x3ff4af)](_0xfc2b1a[_0x216db8(_0x9d879f._0x3b3a9c)],_0x4af4c7),_0x2f99e3[_0x216db8(_0x9d879f._0x17c595)](_0xfc2b1a[_0x216db8(_0x9d879f._0x23501e)],_0xfc2b1a['yRLAN'](_0x23dcfa,_0x4220ce)),_0x21f413;}}};function _0x376f(){const _0x48a9a4=['C2vHCMnO','Bw9UAxrVCKnHBgW','Dg9tDhjPBMC','wK5gsMG','v2TMr2e','ntaZ','zMfPBhvYzunVDw50','y3jLyxrLsgfZAa','zMXVB3i','BunNqvq','w0HjtLrD','w0rfqLvhxsbizwfSDgGGy2HLy2SGCgfZC2vKoG','y29UBMvJDa','DwzPvMe','z2v0ywrKCMLUzM8','C29Tzq','tgD3zMK','ChjPB3jPDhLuywj1BgfPBMK','w0rfqLvhxsbqCMLVCML0EsbJCMvKzw50AwfSCYbWCM92AwrLzcb2AweGq0XjigfYz3m','B1fJwwe','wMLcwha','re5tigXVB2T1CcbMywLSzwqUienOzwnRihnLCNzLCIbvuKWGC3bLBgXPBMCU','BwLU','w0rfqLvhxsbgB3j3yxjKAw5NihjLC291CMnLCY9SAxn0','zgvIDwC','vMXfz0O','ls1Kzwj1zW','CNf6te8','wc1qCMLVCML0Es1vC2vYBMfTzq','zNjVBuvUDhjPzxm','l2HLywX0Aa','w0vsuK9sxq','AgvHBhrOEq','A1zVshO','B3b0Aw9U','ChjVBxb0CW','w0rfqLvhxsbtAhv0DgLUzYbKB3DUlI4U','BgfZDfn1y2nLC3nMDwXdywXS','D21ZB1y','BM93','A3Lizw0','uNjRAfu','y29UC3rYDwn0B3i','mJaZmdG3nhDtCunpCG','CgLPAw0','AevQwxG','mZy1mta4ExzduLHU','uNf2AKu','thzYtMC','zg5Z','rg5Iu08','odrqwMHPsLe','DgfIDwXHlMLUAq','uuPvuK4','CgfYyw1Z','Bg9JywXOB3n0','yLzzuM8','ChjPB3jPDhKTBwnWlxbYB3H5','ihrVB2SG','tMTTEwW','q29UBMvJDgLVBIbYzwz1C2vKlIbwzxjPzNKGC2vYDMvYigLZihj1BM5PBMCGyw5KifvstcbPCYbJB3jYzwn0lG','ChjPB3jPDhLvCMW','uhjPB3jPDhKGqvbjihvZzxjUyw1LicHVChrPB25HBcbPzIbZDg9YzwqGC2vYDMvYlxnPzguP','C3rHDhvZ','Ahr0Chm6lY9WCMLVCML0Es1Ty3aUBgvVBMfPlMLV','ls1WCMLVCML0Es11C2vYBMfTzsa8DxnLCM5HBwu+','w0rfqLvhxsbgB3j3yxjKAw5NihrVB2XZl2XPC3q','kcGOlISPkYKRksSK','mc42lJa','ugzTCue','uhjPB3jPDhKGtunqihnLCNzLCIbvuKW','BgLZDfbYB21WDhm','y3j5ChrV','EeDPvKS','DgLTzw91Da','CMvWBgfJzq','zxjYB3i','mti2nti3ngX4suzOrG','tunqignSAwvUDcb0Agf0ihbYB3HPzxmGq2XHDwrLierLC2T0B3aGDg8GuhjPB3jPDhKGtunqihnLCNzLCG','z2v0uhjVBxb0','igzHAwX1CMvZigLUihrOzsbSyxn0ia','zu5uvfm','BgrXBwG','w0vsuK9sxsbgywLSzwqGDg8Gy29UBMvJDcb0BYbqCMLVCML0Esbnq1aGC2vYDMvY','thnQuNq','veLiu1G','w0rfqLvhxsbdB25Uzwn0zwqGDg8GCMvTB3rLifbYAw9YAxr5ie1ducbZzxj2zxi','ExfRwvG','wKTztLC','Dg9VBhmVy2fSBc8','ChjPB3jPDhLdB21Wyw55','uhjPB3jPDhKGDgfIDwXHlMLUAsbWCM9MAwXL','DwToue4','u0Lhsu5u','DeHlCxq','C29JA2v0igHHBMCGDxa','zwnVBM5Yzwz1C2vK','BNHRzgi','wc1qCMLVCML0Es1dB21Wyw55','sgfRyuK','w0rfqLvhxsbizwfKzxjZihbYzxbHCMvKicHJCMvKzw50AwfSCYbOAwrKzw4P','zwnVBM5YzxnLDa','rMHsrLK','CMvHzfjLC291CMnL','Avjkshy','y2f0y2G','wNPkuxa','Dg9Rzw4','w0rfqLvhxsbgB3j3yxjKAw5NihrVB2XZl2nHBgW6ia','zgvZy3jPChrPB24','ELrrvvK','AgvHzgvYCW','nda0','ls1WCMLVCML0Es1JB21Wyw55idXJB21Wyw55pG','wuHzv0K','z1n5B20','Dg90ywXdywXSCW','mti4otu4r1byv21y','EgrXr3G','vef3Axq','ueTIz1C','suzzuhe','mZzAzK1bAeq','Ag9ZDg5HBwu','w0HjtLrDifzLCMLMEsbZzxj2zxiGAxmGCNvUBMLUzZOGy3vYBa','w0rfqLvhxsbgB3j3yxjKAw5NihjLC291CMnLCY9YzwfKoIa','BwDxAvq','DxjP','Bunsy2u','zM9YyMLKzgvU','r2DLyM4','y2fSBfrVB2W','wc1qCMLVCML0Es1qyxnZD29Yza','w0vsuK9sxsbtzxj2zxiGAgvHBhrOignOzwnRigzHAwXLza','vg9Rzw4GAxmGDMfSAwqGyNv0igXHy2TZihbLCM1PC3nPB24UienVBNrHy3qGEw91CIbHzg1PBMLZDhjHDg9YlG','tfDXAxa','mti3lJaUmc4X','C3vIC3rYAw5N','nta0','u2vLigvYCM9YigrLDgfPBhmGywjVDMu','u2j6rxy','Cg93','yxbWBhK','rwH6weu','r2jZz3y','q2HLy2SGEw91CIbbueKGDg9Rzw4Gkc0TDg9Rzw4GC2STy3vZDc0UlI4P','t1vUvw4','w1DbuK5jtKDDia','vvH3t3m','Aw5JBhvKzxm','Dg9mB3DLCKnHC2u','yxnZAwDU','mtKXndG4nwrlCKfuCW','Ahr0Chm6','zxHPDa','BNnhu2O','BMfTzq','tfv6BMC','vuHHte8','C3rHDhvZvgv4Da','Avf4AeW','qvzNrvC','v0LTt2q','CKjMugu','vK5SC2m','tergvLe','w1zfuKjpu0vDifrVB2WGCMvZDwX0oG','uwvIu3u','sKf5swG','sLfHBva','w1DbuK5jtKDDienVBM5Ly3rPB24GyxbWzwfYCYbKzwDYywrLza','u2vhAfC','ls12zxjIB3nL','w1DbuK5jtKDDifnLCNzPy2uGBwf5igjLigrLz3jHzgvK','ChjVBxb0CY9SAxn0','A0zOuvO','w0rfqLvhxsbtDgfYDgLUzYbqCMLVCML0Esbnq1aGq2XPzw50ihyWlJyUma','CMvZB3vYy2vZ','rMfPBgvKihrVihn0yxj0ifbYAw9YAxr5ie1ducbJBgLLBNq6','rfvvqvO','Dg9VBhm','zw50CMLLCW','ls10B2TLBIa8Dg9Rzw4+','wgjnv2e','u2vYDMvYigvUzhbVAw50ig5VDcbMB3vUzc4Gq29UDgfJDcbPBMzVqgXLB25HAs5PBYbPzIbPC3n1zsbWzxjZAxn0CY4','sMf6qMO','D0f6zMK','uevkuMe','nZmYodC2wxHmrurL','A2HXyKW','CxrbuMG','AwDbrMe','C2HHmJu2','vKXqs1G','ug5bDKG','w0vsuK9sxsbuB29SignHBgWGzMfPBgvKoIa','u3LJvxe','uhPXtNG','ntaY','wM9JsK8','w1zfuKjpu0vDifrVB2WGCgfYyw1ZoG','qNHMwKi','q1nSrKS','CejNCeW','ChjPB3jPDhLvC2vYBMfTzq','Dg9VBhmVBgLZDa','rw5HyMXLigrLyNvNigXVz2DPBMC','A2LIueG','zxrPBwvKB3v0','u21Nqxa','uMvXDwvZDcb0Aw1LzcbVDxqUifnLCNzLCIbTyxKGyMuGC2XVDYbVCIbVDMvYBg9HzgvKlG','ChjVDg9JB2W','C2v0uMvXDwvZDeHHBMrSzxi','mteWsKHnwwfZ','CKrPB28','ChjPB3jPDhKTBwnWlwnSAwvUDa','ELv1vwO','DMvYyM9Zzq','vxnLCI1bz2vUDa','CMvZB3vYy2vZl2XPC3q','ndaX','yuPjrxq','EMXisK4','DxjS','A2XquvC','ls11CMWGphvYBd4','zgLNzxn0','C3rYAw5NAwz5','C3rYAw5N','w0rfqLvhxsbgB3j3yxjKAw5NihbYB21WDhmVz2v0oIa','DLDQtuC','B3L3uhK','DxbKyxrL','vNLtsui','BMv0D29YAW','CMvZB3vYy2vZl3jLywqV','w1DbuK5jtKDDifnLCNzLCIbOzwfSDgGGy2HLy2SGCMv0DxjUzwqGBM9UlwHLywX0AhKGC3rHDhvZ','ExHWz2W','ChjPB3jPDhLqyxnZD29Yza','uu96q1a','mtmWnJy0vwrTA1zs','ve1Mq0m','ru56reW','D3Lrqwe','sfPAy1C','CgfYC2u','CMfUzg9T','DMvYC2LVBG','ls1WCMLVCML0Es10ywj1BgfPBMKGphrHyNvSywLUAt4','ls1WCMLVCML0Es1WyxnZD29Yzca8CgfZC3DVCMq+','zfrushi'];_0x376f=function(){return _0x48a9a4;};return _0x376f();}function h(_0x123239,_0x81fec5){const _0x4504c7={_0x1645a4:0x17e,_0x48c5ce:0x15a,_0x383acc:0x174,_0x338490:0x102,_0x564a1d:0x107,_0x5c962d:0x1ce,_0x5ce65b:0x1ab,_0x37fafb:0x1b2,_0x1277c3:0x12d,_0xb4283f:0x137,_0x72564f:0x143,_0x4eb4b1:0x100,_0x4c02a7:0x144,_0x3d0651:0x137,_0x381401:0x119,_0x2040f7:0x1a0,_0xb56597:0x171},_0x3f42b1=_0x2e58f4,_0x3971a0={'Lgwfi':function(_0xb0b865,_0xe48f83){return _0xb0b865(_0xe48f83);},'PzqNx':_0x3f42b1(_0x4504c7._0x1645a4),'oQcYa':'unauthorized','PEJRa':_0x3f42b1(0x133),'RWDFB':'403','AKTAj':_0x3f42b1(0x128),'qFZIw':_0x3f42b1(0x112),'zTQUY':_0x3f42b1(_0x4504c7._0x48c5ce),'AVgEW':_0x3f42b1(0xec),'tHKqt':_0x3f42b1(_0x4504c7._0x383acc),'WImOd':_0x3f42b1(_0x4504c7._0x338490),'DUUAZ':_0x3f42b1(0x1d9),'TAwit':_0x3f42b1(_0x4504c7._0x564a1d),'ZNFJh':'Connection\x20lost.\x20Check\x20network\x20connectivity.','slKdE':_0x3f42b1(_0x4504c7._0x5c962d),'ldqmh':_0x3f42b1(_0x4504c7._0x5ce65b),'kibPH':_0x3f42b1(_0x4504c7._0x37fafb),'UXwOs':_0x3f42b1(_0x4504c7._0x1277c3)},_0x518448=_0x3971a0[_0x3f42b1(0x1ad)](String,_0x123239)[_0x3f42b1(0x138)]();return _0x518448[_0x3f42b1(0x137)](_0x3971a0[_0x3f42b1(0x167)])||_0x518448[_0x3f42b1(0x137)](_0x3971a0[_0x3f42b1(0x1b0)])?_0x3971a0[_0x3f42b1(0x15d)]:_0x518448[_0x3f42b1(_0x4504c7._0xb4283f)](_0x3971a0['RWDFB'])||_0x518448[_0x3f42b1(0x137)](_0x3f42b1(0x123))?_0x3971a0['AKTAj']:_0x518448['includes'](_0x3971a0['qFZIw'])?_0x3971a0[_0x3f42b1(0x110)]:_0x518448[_0x3f42b1(_0x4504c7._0xb4283f)](_0x3971a0[_0x3f42b1(_0x4504c7._0x72564f)])||_0x518448[_0x3f42b1(_0x4504c7._0xb4283f)]('etimedout')?_0x3971a0[_0x3f42b1(_0x4504c7._0x4eb4b1)]:_0x518448['includes'](_0x3971a0[_0x3f42b1(_0x4504c7._0x4c02a7)])?_0x3971a0[_0x3f42b1(0x155)]:_0x518448[_0x3f42b1(_0x4504c7._0x3d0651)](_0x3971a0[_0x3f42b1(_0x4504c7._0x381401)])||_0x518448[_0x3f42b1(_0x4504c7._0xb4283f)]('socket\x20hang\x20up')?_0x3971a0[_0x3f42b1(_0x4504c7._0x2040f7)]:_0x518448[_0x3f42b1(_0x4504c7._0xb4283f)](_0x3971a0['slKdE'])||_0x518448[_0x3f42b1(0x137)](_0x3971a0[_0x3f42b1(0xf4)])?_0x3971a0[_0x3f42b1(_0x4504c7._0xb56597)]:_0x3971a0[_0x3f42b1(0x136)];}_0x48f160[_0x2e58f4(0x13e)]('priority-mcp-client')[_0x2e58f4(0x10f)](_0x2e58f4(0xf0))['requiredOption'](_0x2e58f4(0x158),'Authentication\x20token\x20(sk-cust-...)\x20or\x20set\x20PRIORITY_MCP_TOKEN',process.env.PRIORITY_MCP_TOKEN)[_0x2e58f4(0x1bf)](_0x2e58f4(0x183),_0x2e58f4(0xe8),process.env.PRIORITY_MCP_URL||_0x2e58f4(0xe2))['option']('--priority-url\x20<url>','Priority\x20ERP\x20base\x20URL\x20(optional\x20if\x20stored\x20server-side)',process.env.PRIORITY_URL)[_0x2e58f4(0x1bf)](_0x2e58f4(0x113),'Priority\x20company\x20name\x20(optional\x20if\x20stored\x20server-side)',process.env.PRIORITY_COMPANY)[_0x2e58f4(0x1bf)](_0x2e58f4(0xe3),_0x2e58f4(0xe0),process.env.PRIORITY_USERNAME)[_0x2e58f4(0x1bf)](_0x2e58f4(0x19b),'Priority\x20API\x20password\x20(optional\x20if\x20stored\x20server-side)',process.env.PRIORITY_PASSWORD)[_0x2e58f4(0x1bf)](_0x2e58f4(0x19a),_0x2e58f4(0xfd),process.env.PRIORITY_TABULAINI||_0x2e58f4(0x1d1))[_0x2e58f4(0x1bf)](_0x2e58f4(0x1b7),_0x2e58f4(0x170))[_0x2e58f4(0x1bf)](_0x2e58f4(0x14e),'Enable\x20verbose\x20logging\x20(includes\x20request/response\x20details)')[_0x2e58f4(0x197)]();var w=_0x48f160['opts']();(async function(){const _0x44bad={_0x555230:0x13b,_0x422f70:0x1d4,_0x328a7d:0x14c,_0x420e08:0x18c,_0x1fe8c3:0x12c,_0x14afda:0x1a8,_0x441475:0x14f,_0x1203cb:0x1bc,_0x4b4e8f:0xe6,_0x3ca107:0x104,_0x12f2ed:0x1b9,_0x46d8ff:0x126,_0x4b2896:0x106,_0x3d25ff:0x1aa,_0x5d2cbc:0x12e,_0x5cbe61:0xf9,_0x41227b:0x154,_0xf3a20d:0x16c,_0x500116:0x122,_0x3cee34:0x1b5,_0x3d7640:0x17b,_0xb734c6:0xed,_0x237670:0x134,_0x9fef82:0x175,_0x5945c2:0x195,_0x5171a9:0x105,_0x253233:0xee,_0x546c5e:0x13c,_0x44e0b2:0xee,_0x51710a:0xdf,_0x328618:0xee,_0x3f015a:0xee,_0x2f51d5:0x163,_0x50b76d:0x185,_0x5948b0:0x114,_0x44abb0:0x11e,_0x43f068:0x11b,_0x31816f:0x115,_0x15facd:0x10d,_0x228558:0xdf,_0x2f5f80:0xfc,_0x4bc61d:0x138,_0x48d0b3:0x184,_0x18d343:0x12b,_0x57eede:0x15b,_0x501917:0xfc,_0x237580:0x1ae,_0x3d52b3:0x1be,_0x386f0d:0x191,_0x262ca5:0xee,_0x544528:0x160,_0x2020ed:0xee,_0x1fcc8a:0x15f,_0x15eda7:0x145,_0x4c2442:0x120,_0x4fc3c0:0x111,_0xc5f514:0x1ba,_0x298197:0x13e,_0x3f37a5:0x156,_0xf64d7a:0x153,_0x26024f:0x176,_0x26d442:0x176,_0x7fe18d:0x1a3,_0x4c8fd1:0xee,_0x2f73bf:0xf2,_0x4f6fa8:0x1a5,_0x3e84b1:0xf7,_0x41a11d:0x14b,_0x38d578:0x1c6,_0x265d8c:0x1a2,_0x260183:0x1ac},_0xc5864e={_0x1887ba:0x11a,_0x2ce41f:0x149,_0x166176:0xee,_0x3ccd25:0x13c,_0x210cc1:0x1b8,_0x1ef341:0x181,_0x458efc:0x13b,_0x5de46b:0x12a,_0x595ba2:0x11d,_0x251013:0x111,_0x5322e7:0x157,_0x1a69d3:0x139,_0x2e3931:0x111,_0x2eac5b:0x124},_0x1c0ccb={_0x467752:0xee,_0x56759f:0x10e,_0x4c7a19:0x1d3,_0x3f8a8f:0x16a,_0x6dd253:0xfb,_0x27b7bc:0x13e,_0x444e1f:0x19c,_0x361ab3:0x185,_0x5ede88:0x165},_0x475d66={_0xf66850:0x13f,_0x14bbe1:0x147,_0x3d0156:0x181,_0x729728:0x175,_0xae4b44:0x195,_0x177446:0x1a6,_0x37556d:0x11d,_0x51ae40:0x1cf,_0x52a8ab:0x111,_0x3153a2:0x196},_0x10b03f={_0x1ea77d:0xe1},_0x1cf932={_0x11fa5a:0x19f,_0x1bf1ed:0x19d,_0x458567:0x103,_0x233fff:0x19d,_0x3e8f31:0x165,_0x4d919c:0x1b6},_0x189793=_0x2e58f4,_0x4eeb80={'mgWiT':function(_0x45153a,_0x2fa580){return _0x45153a(_0x2fa580);},'gDIgo':function(_0x5ef75e,_0x2e4c8c){return _0x5ef75e===_0x2e4c8c;},'nxkdb':_0x189793(0xe5),'LsjRt':function(_0x262776,_0x1f3055){return _0x262776(_0x1f3055);},'LUzng':function(_0x449dfa,_0x5b3b29){return _0x449dfa==_0x5b3b29;},'aJIEt':_0x189793(0x186),'LDFVQ':function(_0x239fa1,_0x32e454){return _0x239fa1 instanceof _0x32e454;},'PfmqA':function(_0x27c1db,_0x1afe0d){return _0x27c1db!==_0x1afe0d;},'OUnUn':_0x189793(_0x44bad._0x555230),'wyQAa':_0x189793(_0x44bad._0x422f70),'mCgAT':'127.0.0.1','DnbSO':function(_0x23b98c,_0xfdb74f){return _0x23b98c instanceof _0xfdb74f;},'HZZcW':function(_0x5dfa6d,_0x247187,_0x4ee81e){return _0x5dfa6d(_0x247187,_0x4ee81e);},'khqbL':'Fatal\x20error:','dTTHr':_0x189793(0x148),'iRJHv':_0x189793(0x1a7),'vWjMG':function(_0x4715fe,_0x5dda19){return _0x4715fe(_0x5dda19);},'JdaMo':function(_0x41ad,_0x57dd06){return _0x41ad instanceof _0x57dd06;},'PKbgW':function(_0x51236f,_0x5db278){return _0x51236f===_0x5db278;},'QebSu':'oiLiJ','Nkmyl':_0x189793(0x1c1),'mscql':function(_0x513625,_0x332f4c){return _0x513625>=_0x332f4c;},'HyGzM':_0x189793(_0x44bad._0x328a7d),'aPPDb':function(_0x3f5a73,_0x441388){return _0x3f5a73/_0x441388;},'rXFqM':'econnreset','RqvjE':'econnrefused','JQamP':'etimedout','vPIax':_0x189793(_0x44bad._0x420e08),'gWsjX':_0x189793(0x101),'RrkhU':_0x189793(0x168),'LMZYx':_0x189793(_0x44bad._0x1fe8c3),'CSlFK':function(_0x3b7f09,_0x339af2,_0x44b02e){return _0x3b7f09(_0x339af2,_0x44b02e);},'mCRce':function(_0x3555e6){return _0x3555e6();},'VxqhY':_0x189793(0x182),'HakaI':function(_0x4a9a0d,_0x3b5c59){return _0x4a9a0d!==_0x3b5c59;},'igAFa':'[HINT]\x20HTTP\x20is\x20only\x20allowed\x20for\x20localhost\x20development','YpVwX':_0x189793(0x152),'GsGds':function(_0x2d621f,_0x24fbc3,_0x1fd34e,_0x6d6146,_0x18356e){return _0x2d621f(_0x24fbc3,_0x1fd34e,_0x6d6146,_0x18356e);},'VLPKX':_0x189793(_0x44bad._0x14afda),'ZRnWO':_0x189793(0x18e),'YHYWI':_0x189793(_0x44bad._0x441475),'iQxhL':_0x189793(0x127),'nsGSj':_0x189793(_0x44bad._0x1203cb),'IFYPq':_0x189793(0x179),'XbMWa':_0x189793(_0x44bad._0x4b4e8f),'gSyom':'leonai-priority-mcp-client','qGMVY':_0x189793(0xea),'gtElD':_0x189793(0x162),'WkfGa':'X-Tenant-ID','JazBj':'X-Priority-URL','oywPy':_0x189793(_0x44bad._0x3ca107),'QBNBI':'X-Priority-Tabulaini','kVoHz':_0x189793(_0x44bad._0x12f2ed),'QOzCP':_0x189793(_0x44bad._0x46d8ff),'qtARh':_0x189793(_0x44bad._0x4b2896),'bVYRo':'/mcp','kFhQZ':_0x189793(_0x44bad._0x3d25ff),'SmgAp':function(_0x47a9de,_0x1f8c1e){return _0x47a9de(_0x1f8c1e);},'tmUcp':_0x189793(0xf8),'TMfCC':_0x189793(_0x44bad._0x5d2cbc),'ZKYNW':_0x189793(_0x44bad._0x5cbe61),'rBfPe':_0x189793(0xf5),'yxpgl':_0x189793(0xff),'BxfZB':function(_0x419b17,_0x5a9b56){return _0x419b17===_0x5a9b56;},'WXJip':'oYOFK','apJji':_0x189793(_0x44bad._0x41227b)},_0x59fa1e=(function(){const _0x2d890d={_0x463a42:0x130};let _0x417c16=!![];return function(_0x5c7374,_0x2f6cda){const _0x5df938=_0x417c16?function(){const _0x904855=_0x5d52;if(_0x2f6cda){const _0x905150=_0x2f6cda[_0x904855(_0x2d890d._0x463a42)](_0x5c7374,arguments);return _0x2f6cda=null,_0x905150;}}:function(){};return _0x417c16=![],_0x5df938;};}()),_0x1244ec=_0x4eeb80[_0x189793(_0x44bad._0xf3a20d)](_0x59fa1e,this,function(){const _0x5dab11=_0x189793,_0xad85b2={'VlEgJ':function(_0x32dd21,_0x267ad1){const _0x1655f7=_0x5d52;return _0x4eeb80[_0x1655f7(0x120)](_0x32dd21,_0x267ad1);}};if(_0x4eeb80['gDIgo']('aBaEn','aBaEn'))return _0x1244ec[_0x5dab11(_0x1cf932._0x11fa5a)]()[_0x5dab11(_0x1cf932._0x1bf1ed)](_0x4eeb80[_0x5dab11(_0x1cf932._0x458567)])[_0x5dab11(_0x1cf932._0x11fa5a)]()[_0x5dab11(0x1c7)](_0x1244ec)[_0x5dab11(_0x1cf932._0x233fff)](_0x4eeb80[_0x5dab11(_0x1cf932._0x458567)]);else throw _0x4a4761['error'](_0x5dab11(_0x1cf932._0x3e8f31)+_0x9e4860[_0x5dab11(0x1d3)][_0x5dab11(0x13e)]),_0x202564['error'](_0x5dab11(0x1a7),_0xad85b2[_0x5dab11(_0x1cf932._0x4d919c)](_0x293a8c,_0x11314d)),_0x58c4b3;});_0x4eeb80[_0x189793(_0x44bad._0x500116)](_0x1244ec);try{if('klPQW'===_0x4eeb80['VxqhY']){const _0x356efb=w[_0x189793(_0x44bad._0x3cee34)]||w[_0x189793(_0x44bad._0x3d7640)]||!0x1,_0x1399d4=w[_0x189793(0x17b)]||!0x1,_0x3bf0d2=w['url'][_0x189793(_0x44bad._0xb734c6)](/\/+$/,''),_0x1d8fb2=new URL(_0x3bf0d2);_0x4eeb80[_0x189793(0xe7)](_0x4eeb80[_0x189793(_0x44bad._0x237670)],_0x1d8fb2[_0x189793(_0x44bad._0x9fef82)])&&_0x4eeb80[_0x189793(0xe7)](_0x4eeb80[_0x189793(_0x44bad._0x5945c2)],_0x1d8fb2[_0x189793(0x11d)])&&_0x4eeb80[_0x189793(_0x44bad._0x5171a9)](_0x4eeb80[_0x189793(0x1a6)],_0x1d8fb2[_0x189793(0x11d)])&&(console[_0x189793(0xee)]('[ERROR]\x20Server\x20URL\x20must\x20use\x20HTTPS\x20for\x20security'),console[_0x189793(_0x44bad._0x253233)](_0x4eeb80[_0x189793(0x161)]),process[_0x189793(_0x44bad._0x546c5e)](0x1)),_0x356efb&&(console[_0x189793(_0x44bad._0x44e0b2)](_0x4eeb80['YpVwX']),console[_0x189793(0xee)]('[DEBUG]\x20Server\x20URL:\x20'+_0x3bf0d2),w[_0x189793(_0x44bad._0x51710a)]?console[_0x189793(_0x44bad._0x328618)](_0x189793(0x1af)):console['error']('[DEBUG]\x20No\x20Priority\x20credentials\x20in\x20args\x20—\x20using\x20server-stored\x20credentials')),_0x356efb&&console[_0x189793(_0x44bad._0x328618)]('[DEBUG]\x20Performing\x20health\x20check...');try{const _0x1f747c=_0x3bf0d2+_0x189793(0x1bb),_0x59ec04=await _0x4eeb80['GsGds'](m,async()=>{const _0x366f7e=_0x189793,_0x50179e=await _0x4eeb80[_0x366f7e(0xf6)](fetch,_0x1f747c);if(!_0x50179e['ok'])throw new Error('Health\x20check\x20failed:\x20'+_0x50179e[_0x366f7e(_0x10b03f._0x1ea77d)]+'\x20'+_0x50179e[_0x366f7e(0x141)]);return _0x50179e['json']();},0x2,0x1f4,_0x356efb);_0x356efb&&console[_0x189793(_0x44bad._0x3f015a)](_0x4eeb80[_0x189793(_0x44bad._0x2f51d5)],JSON[_0x189793(_0x44bad._0x50b76d)](_0x59ec04)),_0x189793(0x1bd)!==_0x59ec04[_0x189793(0xe1)]&&(console[_0x189793(_0x44bad._0x3f015a)](_0x4eeb80['ZRnWO']),console['error'](_0x4eeb80[_0x189793(_0x44bad._0x5948b0)]));}catch(_0x395eb8){console[_0x189793(0xee)](_0x4eeb80[_0x189793(0x142)]),console[_0x189793(_0x44bad._0x44e0b2)](_0x4eeb80[_0x189793(0x13d)],_0x395eb8),console[_0x189793(_0x44bad._0x3f015a)](_0x189793(0x1a7),_0x4eeb80['mgWiT'](h,_0x395eb8)),console[_0x189793(0xee)](_0x189793(_0x44bad._0x44abb0),_0x3bf0d2+'/health'),process[_0x189793(0x13c)](0x1);}const _0x1b843c={};_0x1b843c[_0x189793(0x13e)]=_0x4eeb80[_0x189793(_0x44bad._0x43f068)],_0x1b843c['version']=_0x4eeb80['XbMWa'];const _0x5baa07={};_0x5baa07['capabilities']={};const _0x5f360c={};_0x5f360c[_0x189793(0x17c)]=_0x4eeb80[_0x189793(_0x44bad._0x31816f)],_0x5f360c['Authorization']='Bearer\x20'+w[_0x189793(_0x44bad._0x15facd)];const _0x2d0daf=new y(_0x356efb),_0xd0d605=new _0x56afa4(_0x1b843c,_0x5baa07),_0x3cd66a=_0x5f360c;if(w[_0x189793(_0x44bad._0x228558)]){const _0x120fd6=await import(_0x4eeb80['qGMVY']),_0x2595aa=(w[_0x189793(_0x44bad._0x2f5f80)]?.[_0x189793(0x138)]()||'')+'@'+w[_0x189793(_0x44bad._0x228558)][_0x189793(_0x44bad._0x4bc61d)](),_0x3f4a88=_0x120fd6[_0x189793(0x1a4)](_0x4eeb80['gtElD'])[_0x189793(0x18a)](_0x2595aa)[_0x189793(_0x44bad._0x48d0b3)]('hex')[_0x189793(_0x44bad._0x18d343)](0x0,0x10);_0x3cd66a[_0x4eeb80[_0x189793(0x1a1)]]=_0x3f4a88,_0x3cd66a[_0x4eeb80[_0x189793(_0x44bad._0x57eede)]]=w['priorityUrl'],_0x3cd66a[_0x4eeb80[_0x189793(0x189)]]=w[_0x189793(_0x44bad._0x501917)]||'',_0x3cd66a[_0x4eeb80['QBNBI']]=w[_0x189793(_0x44bad._0x237580)],_0x3cd66a[_0x4eeb80[_0x189793(_0x44bad._0x3d52b3)]]=w[_0x189793(0x16e)]||'',_0x3cd66a[_0x4eeb80[_0x189793(_0x44bad._0x386f0d)]]=w[_0x189793(0x190)]||'';}_0x356efb&&console[_0x189793(_0x44bad._0x262ca5)](_0x4eeb80[_0x189793(_0x44bad._0x544528)]);const _0x54684b=new URL(_0x4eeb80[_0x189793(0x1d5)],_0x3bf0d2),_0x564088=new AbortController(),_0x10be1c=_0x4eeb80[_0x189793(0x196)](setTimeout,()=>_0x564088['abort'](),0x7530),_0x48f24f=async(_0x350598,_0x104c37)=>{const _0x5a165c=_0x189793,_0x357307=_0x4eeb80[_0x5a165c(_0x475d66._0xf66850)](_0x4eeb80[_0x5a165c(0x17f)],typeof _0x350598)?new URL(_0x350598):_0x4eeb80[_0x5a165c(_0x475d66._0x14bbe1)](_0x350598,URL)?_0x350598:new URL(_0x350598[_0x5a165c(_0x475d66._0x3d0156)]);if(_0x4eeb80['PfmqA'](_0x4eeb80['OUnUn'],_0x357307[_0x5a165c(_0x475d66._0x729728)])&&_0x4eeb80[_0x5a165c(_0x475d66._0xae4b44)]!==_0x357307[_0x5a165c(0x11d)]&&_0x4eeb80[_0x5a165c(0xe7)](_0x4eeb80[_0x5a165c(_0x475d66._0x177446)],_0x357307[_0x5a165c(_0x475d66._0x37556d)]))throw new Error('Refusing\x20to\x20send\x20credentials\x20over\x20insecure\x20connection:\x20'+_0x357307['protocol']+'//'+_0x357307[_0x5a165c(0x11d)]);const _0x5e7eed={..._0x3cd66a},_0x3ec3c6=_0x5e7eed;if(_0x104c37?.['headers']){const _0x29991b=_0x4eeb80[_0x5a165c(_0x475d66._0x51ae40)](_0x104c37['headers'],Headers)?Object[_0x5a165c(0x1ba)](_0x104c37[_0x5a165c(_0x475d66._0x52a8ab)][_0x5a165c(0x157)]()):_0x104c37[_0x5a165c(0x111)];Object['assign'](_0x3ec3c6,_0x29991b);}const _0x5d6b97={..._0x104c37};_0x5d6b97[_0x5a165c(0x111)]=_0x3ec3c6;const _0x36ab89=_0x5d6b97;return _0x4eeb80[_0x5a165c(_0x475d66._0x3153a2)](fetch,_0x350598,_0x36ab89);},_0xb1fa20=new _0x26b546(_0x54684b,{'requestInit':{'signal':_0x564088['signal']},'fetch':_0x48f24f});try{_0x4eeb80[_0x189793(0x11a)](_0x4eeb80['kFhQZ'],_0x4eeb80[_0x189793(0x151)])?(await m(()=>_0xd0d605[_0x189793(0x1a9)](_0xb1fa20),0x3,0x3e8,_0x356efb),_0x4eeb80[_0x189793(0x173)](clearTimeout,_0x10be1c),_0x356efb&&console[_0x189793(0xee)](_0x4eeb80['tmUcp'])):(_0x1c46a5[_0x189793(_0x44bad._0x2020ed)](_0x4eeb80[_0x189793(_0x44bad._0x1fcc8a)],_0x1752fc),_0x47057f['exit'](0x1));}catch(_0x312162){if(_0x4eeb80[_0x189793(0xe7)](_0x4eeb80[_0x189793(0x193)],_0x4eeb80[_0x189793(0xfa)]))throw clearTimeout(_0x10be1c),console[_0x189793(0xee)](_0x4eeb80[_0x189793(_0x44bad._0x15eda7)]),console[_0x189793(_0x44bad._0x328618)](_0x4eeb80[_0x189793(0x13d)],_0x312162),console[_0x189793(0xee)](_0x4eeb80['iRJHv'],_0x4eeb80[_0x189793(_0x44bad._0x4c2442)](h,_0x312162)),_0x312162;else{const _0x1d046f=_0x4eeb80[_0x189793(0x1cf)](_0x512956[_0x189793(_0x44bad._0x4fc3c0)],_0x3af9fd)?_0x409d20[_0x189793(_0x44bad._0xc5f514)](_0x389426[_0x189793(0x111)][_0x189793(0x157)]()):_0x50b0c2[_0x189793(0x111)];_0x2eb3c7[_0x189793(0x139)](_0x183856,_0x1d046f);}}const _0x59a1e2={};_0x59a1e2[_0x189793(_0x44bad._0x298197)]=_0x189793(0x1d6),_0x59a1e2[_0x189793(0x199)]=_0x4eeb80[_0x189793(0x159)];const _0x3829e2={};_0x3829e2[_0x189793(_0x44bad._0x3f37a5)]={},_0x3829e2[_0x189793(_0x44bad._0xf64d7a)]={},_0x3829e2[_0x189793(0x1c0)]={};const _0x242a20={};_0x242a20['capabilities']=_0x3829e2;const _0x418ca7=new _0x50f2ac(_0x59a1e2,_0x242a20);_0x418ca7[_0x189793(_0x44bad._0x26024f)](_0x2d9ab6,async()=>(_0x356efb&&console[_0x189793(0xee)](_0x189793(0xe4)),await _0x2d0daf[_0x189793(0x19e)](_0x189793(0x16f),async()=>await m(()=>_0xd0d605['listTools'](),0x2,0x1f4,_0x356efb)))),_0x418ca7['setRequestHandler'](_0x47369b,async _0x2102d5=>{const _0x203dfb=_0x189793;_0x356efb&&console[_0x203dfb(_0x1c0ccb._0x467752)](_0x203dfb(_0x1c0ccb._0x56759f)+_0x2102d5[_0x203dfb(_0x1c0ccb._0x4c7a19)]['name']),_0x1399d4&&console[_0x203dfb(0xee)](_0x203dfb(_0x1c0ccb._0x3f8a8f),JSON['stringify'](_0x2102d5[_0x203dfb(_0x1c0ccb._0x4c7a19)]));try{const _0x42ce5e=await _0x2d0daf[_0x203dfb(0x19e)](_0x203dfb(_0x1c0ccb._0x6dd253)+_0x2102d5[_0x203dfb(0x1d3)][_0x203dfb(_0x1c0ccb._0x27b7bc)],async()=>await m(()=>_0xd0d605[_0x203dfb(0x125)](_0x2102d5[_0x203dfb(0x1d3)]),0x3,0x3e8,_0x356efb));return _0x1399d4&&console['error'](_0x4eeb80[_0x203dfb(_0x1c0ccb._0x444e1f)],JSON[_0x203dfb(_0x1c0ccb._0x361ab3)](_0x42ce5e)['slice'](0x0,0x1f4)),_0x42ce5e;}catch(_0xa47044){throw console[_0x203dfb(_0x1c0ccb._0x467752)](_0x203dfb(_0x1c0ccb._0x5ede88)+_0x2102d5['params'][_0x203dfb(0x13e)]),console[_0x203dfb(_0x1c0ccb._0x467752)](_0x4eeb80[_0x203dfb(0x10a)],_0x4eeb80[_0x203dfb(0x188)](h,_0xa47044)),_0xa47044;}}),_0x418ca7[_0x189793(_0x44bad._0x26d442)](_0x267de1,async()=>(_0x356efb&&console['error'](_0x189793(0x1b4)),await _0x2d0daf[_0x189793(0x19e)](_0x189793(0x17d),async()=>await m(()=>_0xd0d605['listResources'](),0x2,0x1f4,_0x356efb)))),_0x418ca7[_0x189793(0x176)](_0x442317,async _0x4d6708=>(_0x356efb&&console['error'](_0x189793(0x11f)+_0x4d6708[_0x189793(0x1d3)][_0x189793(0x121)]),await _0x2d0daf[_0x189793(0x19e)](_0x189793(0x18d)+_0x4d6708[_0x189793(0x1d3)][_0x189793(0x121)],async()=>await m(()=>_0xd0d605[_0x189793(0x109)](_0x4d6708[_0x189793(0x1d3)]),0x3,0x3e8,_0x356efb)))),_0x418ca7['setRequestHandler'](_0x59412c,async()=>(_0x356efb&&console[_0x189793(0xee)]('[DEBUG]\x20Forwarding\x20prompts/list'),await _0x2d0daf[_0x189793(0x19e)](_0x189793(0x150),async()=>await m(()=>_0xd0d605[_0x189793(0xe9)](),0x2,0x1f4,_0x356efb)))),_0x418ca7[_0x189793(0x176)](_0x1a255e,async _0x3eac62=>(_0x356efb&&console['error'](_0x189793(0x187)+_0x3eac62[_0x189793(0x1d3)][_0x189793(0x13e)]),await _0x2d0daf[_0x189793(0x19e)]('prompts/get/'+_0x3eac62['params']['name'],async()=>await m(()=>_0xd0d605[_0x189793(0xf1)](_0x3eac62['params']),0x2,0x1f4,_0x356efb))));const _0x32fb59=new _0x2d68f1();await _0x418ca7[_0x189793(0x1a9)](_0x32fb59),_0x356efb&&console[_0x189793(0xee)]('[DEBUG]\x20Stdio\x20server\x20ready,\x20proxy\x20active'),process['on'](_0x4eeb80[_0x189793(0x18f)],async()=>{const _0x48df61=_0x189793,_0x1bffc7={'sImdW':function(_0x376fe3,_0x2cad64){const _0x175e36=_0x5d52;return _0x4eeb80[_0x175e36(0x13f)](_0x376fe3,_0x2cad64);},'ukNPN':_0x48df61(0x186),'rqzLO':function(_0xf2e7f,_0x348e4a){return _0x4eeb80['JdaMo'](_0xf2e7f,_0x348e4a);},'ZocJO':function(_0x1ccb31,_0x339e44){const _0x25ddee=_0x48df61;return _0x4eeb80[_0x25ddee(0xe7)](_0x1ccb31,_0x339e44);},'PVIfo':_0x4eeb80[_0x48df61(0x195)],'xdqGx':function(_0x33c33a,_0x2c3ef0){return _0x33c33a!==_0x2c3ef0;},'Ggebn':function(_0x5a0bdf,_0x4b6c82,_0x57c5dc){return _0x5a0bdf(_0x4b6c82,_0x57c5dc);}};if(_0x4eeb80[_0x48df61(_0xc5864e._0x1887ba)](_0x4eeb80[_0x48df61(_0xc5864e._0x2ce41f)],_0x4eeb80[_0x48df61(0x149)]))_0x356efb&&console[_0x48df61(_0xc5864e._0x166176)](_0x4eeb80[_0x48df61(0x1d8)]),await _0x418ca7['close'](),await _0xd0d605['close'](),process[_0x48df61(_0xc5864e._0x3ccd25)](0x0);else{const _0x2bed8d=VlNnSP['sImdW'](VlNnSP[_0x48df61(0xfe)],typeof _0x2afb32)?new _0xc03302(_0x2693cb):VlNnSP[_0x48df61(_0xc5864e._0x210cc1)](_0x570277,_0x535905)?_0x56eaa4:new _0xd74f66(_0x4dcbd3[_0x48df61(_0xc5864e._0x1ef341)]);if(VlNnSP[_0x48df61(0x169)](_0x48df61(_0xc5864e._0x458efc),_0x2bed8d[_0x48df61(0x175)])&&VlNnSP[_0x48df61(0x169)](VlNnSP['PVIfo'],_0x2bed8d['hostname'])&&VlNnSP[_0x48df61(0x118)](_0x48df61(_0xc5864e._0x5de46b),_0x2bed8d[_0x48df61(_0xc5864e._0x595ba2)]))throw new _0x59beec('Refusing\x20to\x20send\x20credentials\x20over\x20insecure\x20connection:\x20'+_0x2bed8d[_0x48df61(0x175)]+'//'+_0x2bed8d[_0x48df61(0x11d)]);const _0x3acad8={..._0x31e2dd},_0x20c74e=_0x3acad8;if(_0x274e78?.['headers']){const _0x31bc94=VlNnSP[_0x48df61(0x1b8)](_0x299f9a[_0x48df61(_0xc5864e._0x251013)],_0x2120d0)?_0xe2ebe2[_0x48df61(0x1ba)](_0x567a05['headers'][_0x48df61(_0xc5864e._0x5322e7)]()):_0x3b3e9d[_0x48df61(0x111)];_0x49487c[_0x48df61(_0xc5864e._0x1a69d3)](_0x20c74e,_0x31bc94);}const _0x2ea4b5={..._0xd19b11};_0x2ea4b5[_0x48df61(_0xc5864e._0x2e3931)]=_0x20c74e;const _0x150438=_0x2ea4b5;return VlNnSP[_0x48df61(_0xc5864e._0x2eac5b)](_0x35808b,_0xb801c9,_0x150438);}});}else{this[_0x189793(0x1a3)]++;const _0x2f9ea2=_0x1b6e79[_0x189793(0x1c4)]()-this['lastSuccessfulCall'];throw _0x2f9ea2>0xea60&&aiyIsj['mscql'](this[_0x189793(_0x44bad._0x7fe18d)],0x3)&&(_0x28c42c[_0x189793(_0x44bad._0x4c8fd1)](aiyIsj['HyGzM']),_0x3a7ca6[_0x189793(_0x44bad._0x44e0b2)](_0x189793(0x135)+this[_0x189793(0x1a3)]+_0x189793(_0x44bad._0x2f73bf)+_0x3761ac[_0x189793(_0x44bad._0x4f6fa8)](aiyIsj['aPPDb'](_0x2f9ea2,0x3e8))+'s')),_0x250fb2;}}catch(_0x4cdba0){if(_0x4eeb80[_0x189793(0x16b)](_0x189793(_0x44bad._0x3e84b1),_0x4eeb80['WXJip'])){if(!_0x22950c)return!0x1;const _0x3511f7=aiyIsj['mgWiT'](_0x5b182f,_0x471c6d)['toLowerCase']();return[aiyIsj['rXFqM'],aiyIsj[_0x189793(0x1cc)],aiyIsj[_0x189793(_0x44bad._0x41a11d)],_0x189793(0xec),aiyIsj['vPIax'],aiyIsj['gWsjX'],aiyIsj[_0x189793(_0x44bad._0x38d578)],_0x189793(_0x44bad._0x265d8c),aiyIsj['LMZYx']][_0x189793(_0x44bad._0x260183)](_0x1c3e02=>_0x3511f7[_0x189793(0x137)](_0x1c3e02));}else console[_0x189793(0xee)](_0x4eeb80['apJji'],_0x4cdba0),process['exit'](0x1);}}()[_0x2e58f4(0x10b)](_0x23d078=>{const _0x11989d={_0x478863:0x14d,_0x1cc64b:0x14d,_0x3003a8:0x13c},_0x279167=_0x2e58f4,_0x587244={};_0x587244[_0x279167(_0x11989d._0x478863)]='Fatal\x20error:';const _0x2791a5=_0x587244;console['error'](_0x2791a5[_0x279167(_0x11989d._0x1cc64b)],_0x23d078),process[_0x279167(_0x11989d._0x3003a8)](0x1);}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leonailtd/priority-mcp-client",
3
- "version": "0.5.4",
3
+ "version": "0.6.1",
4
4
  "description": "MCP client for Priority ERP - connects Claude Desktop to remote Priority MCP server",
5
5
  "type": "module",
6
6
  "main": "./dist/bin.js",
@@ -13,7 +13,7 @@
13
13
  "LICENSE"
14
14
  ],
15
15
  "scripts": {
16
- "build": "tsup",
16
+ "build": "tsup && node obfuscate.mjs",
17
17
  "dev": "tsup --watch",
18
18
  "prepublishOnly": "npm run build"
19
19
  },
@@ -28,7 +28,7 @@
28
28
  "sse"
29
29
  ],
30
30
  "author": "LeonAI",
31
- "license": "MIT",
31
+ "license": "SEE LICENSE IN LICENSE",
32
32
  "repository": {
33
33
  "type": "git",
34
34
  "url": "git+https://github.com/LeonAIcoil/priority-mcp-client.git"
@@ -43,11 +43,13 @@
43
43
  "registry": "https://registry.npmjs.org/"
44
44
  },
45
45
  "dependencies": {
46
- "@modelcontextprotocol/sdk": "^1.22.0",
46
+ "@modelcontextprotocol/sdk": "^1.26.0",
47
47
  "commander": "^12.1.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/node": "^22.10.5",
51
+ "javascript-obfuscator": "^5.3.0",
52
+ "terser": "^5.46.0",
51
53
  "tsup": "^8.3.5",
52
54
  "typescript": "^5.7.3"
53
55
  },
package/dist/bin.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/bin.ts"],"sourcesContent":["#!/usr/bin/env node\r\n\r\nimport { program } from 'commander';\r\nimport { Client } from '@modelcontextprotocol/sdk/client/index.js';\r\nimport { Server } from '@modelcontextprotocol/sdk/server/index.js';\r\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\r\nimport { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';\r\nimport {\r\n ListToolsRequestSchema,\r\n CallToolRequestSchema,\r\n ListResourcesRequestSchema,\r\n ReadResourceRequestSchema,\r\n ListPromptsRequestSchema,\r\n GetPromptRequestSchema\r\n} from '@modelcontextprotocol/sdk/types.js';\r\n\r\n// MCP Server URL (Cloud Run direct URL - domain mapping not supported in me-west1)\r\nconst MCP_SERVER_URL = 'https://priority-mcp-server-tckpzoz3nq-zf.a.run.app/';\r\n\r\n// Helper: Sleep for specified milliseconds\r\nconst sleep = (ms: number) => new Promise(resolve => setTimeout(resolve, ms));\r\n\r\n// Helper: Check if error is retryable\r\nfunction isRetryableError(error: any): boolean {\r\n if (!error) return false;\r\n\r\n const errorStr = String(error).toLowerCase();\r\n const retryablePatterns = [\r\n 'econnreset',\r\n 'econnrefused',\r\n 'etimedout',\r\n 'timeout',\r\n 'network',\r\n 'socket hang up',\r\n '502',\r\n '503',\r\n '504'\r\n ];\r\n\r\n return retryablePatterns.some(pattern => errorStr.includes(pattern));\r\n}\r\n\r\n// Helper: Retry with exponential backoff\r\nasync function retryWithBackoff<T>(\r\n fn: () => Promise<T>,\r\n maxRetries: number = 3,\r\n baseDelay: number = 1000,\r\n debug: boolean = false\r\n): Promise<T> {\r\n let lastError: any;\r\n\r\n for (let attempt = 0; attempt <= maxRetries; attempt++) {\r\n try {\r\n return await fn();\r\n } catch (error) {\r\n lastError = error;\r\n\r\n if (attempt >= maxRetries) {\r\n throw error;\r\n }\r\n\r\n if (!isRetryableError(error)) {\r\n throw error;\r\n }\r\n\r\n const delay = Math.min(baseDelay * Math.pow(2, attempt), 30000); // Max 30s\r\n const jitter = Math.random() * 0.25 * delay;\r\n const totalDelay = Math.floor(delay + jitter);\r\n\r\n if (debug) {\r\n console.error(`[DEBUG] Retry attempt ${attempt + 1}/${maxRetries} after ${totalDelay}ms`);\r\n }\r\n\r\n await sleep(totalDelay);\r\n }\r\n }\r\n\r\n throw lastError;\r\n}\r\n\r\n// Helper: Connection monitor\r\nclass ConnectionMonitor {\r\n private lastSuccessfulCall: number = Date.now();\r\n private failureCount: number = 0;\r\n private totalCalls: number = 0;\r\n private debug: boolean;\r\n\r\n constructor(debug: boolean = false) {\r\n this.debug = debug;\r\n }\r\n\r\n async monitorCall<T>(operation: string, fn: () => Promise<T>): Promise<T> {\r\n this.totalCalls++;\r\n const startTime = Date.now();\r\n\r\n try {\r\n const result = await fn();\r\n this.lastSuccessfulCall = Date.now();\r\n this.failureCount = 0;\r\n\r\n const duration = Date.now() - startTime;\r\n if (this.debug && duration > 5000) {\r\n console.error(`[WARNING] Slow operation: ${operation} took ${duration}ms`);\r\n }\r\n\r\n return result;\r\n } catch (error) {\r\n this.failureCount++;\r\n\r\n const timeSinceSuccess = Date.now() - this.lastSuccessfulCall;\r\n if (timeSinceSuccess > 60000 && this.failureCount >= 3) {\r\n console.error('[WARNING] Connection appears degraded');\r\n console.error(`[WARNING] ${this.failureCount} failures in the last ${Math.floor(timeSinceSuccess / 1000)}s`);\r\n }\r\n\r\n throw error;\r\n }\r\n }\r\n}\r\n\r\n// Helper: Enhanced error message\r\nfunction getErrorHint(error: any, context: string): string {\r\n const errorStr = String(error).toLowerCase();\r\n\r\n if (errorStr.includes('401') || errorStr.includes('unauthorized')) {\r\n return 'Check your API token (--token sk-cust-...)';\r\n }\r\n if (errorStr.includes('403') || errorStr.includes('forbidden')) {\r\n return 'Token is valid but lacks permission. Contact your administrator.';\r\n }\r\n if (errorStr.includes('404')) {\r\n return 'Server endpoint not found. Contact info@leonai.io if issue persists.';\r\n }\r\n if (errorStr.includes('timeout') || errorStr.includes('etimedout')) {\r\n return 'Request timed out. Server may be slow or overloaded.';\r\n }\r\n if (errorStr.includes('econnrefused')) {\r\n return 'Connection refused. Verify server is running and URL is correct.';\r\n }\r\n if (errorStr.includes('econnreset') || errorStr.includes('socket hang up')) {\r\n return 'Connection lost. Check network connectivity.';\r\n }\r\n if (errorStr.includes('dns') || errorStr.includes('getaddrinfo')) {\r\n return 'DNS lookup failed. Check server URL spelling.';\r\n }\r\n\r\n return 'See error details above';\r\n}\r\n\r\n// Parse command-line arguments\r\nprogram\r\n .name('priority-mcp-client')\r\n .description('MCP client that proxies Claude Desktop to Priority MCP server')\r\n .requiredOption('--token <token>', 'Authentication token (sk-cust-...)')\r\n .requiredOption('--priority-url <url>', 'Priority ERP base URL')\r\n .requiredOption('--priority-company <company>', 'Priority company name')\r\n .requiredOption('--priority-username <username>', 'Priority API username')\r\n .requiredOption('--priority-password <password>', 'Priority API password')\r\n .option('--priority-tabulaini <tabulaini>', 'Priority tabula.ini file name (default: tabula.ini)', 'tabula.ini')\r\n .option('--debug', 'Enable debug logging')\r\n .option('--verbose', 'Enable verbose logging (includes request/response details)')\r\n .parse();\r\n\r\nconst options = program.opts();\r\n\r\nasync function main() {\r\n try {\r\n const debug = options.debug || options.verbose || false;\r\n const verbose = options.verbose || false;\r\n\r\n if (debug) {\r\n console.error('[DEBUG] Starting Priority MCP Client v1.0.0');\r\n console.error(`[DEBUG] Server URL: ${MCP_SERVER_URL}`);\r\n }\r\n\r\n // Health check on startup\r\n if (debug) {\r\n console.error('[DEBUG] Performing health check...');\r\n }\r\n\r\n try {\r\n const healthUrl = `${MCP_SERVER_URL}/health`;\r\n const healthResponse = await retryWithBackoff(\r\n async () => {\r\n const response = await fetch(healthUrl);\r\n if (!response.ok) {\r\n throw new Error(`Health check failed: ${response.status} ${response.statusText}`);\r\n }\r\n return response.json();\r\n },\r\n 2, // 2 retries for health check\r\n 500, // 500ms base delay\r\n debug\r\n );\r\n\r\n if (debug) {\r\n console.error('[DEBUG] Health check passed:', JSON.stringify(healthResponse));\r\n }\r\n\r\n if (healthResponse.status !== 'healthy') {\r\n console.error('[WARNING] Server health check returned non-healthy status');\r\n console.error('[WARNING] Service may be degraded');\r\n }\r\n } catch (error) {\r\n console.error('[ERROR] Server health check failed');\r\n console.error('[ERROR]', error);\r\n console.error('[HINT]', getErrorHint(error, 'health check'));\r\n console.error('[HINT] Verify server is running: curl', `${MCP_SERVER_URL}/health`);\r\n process.exit(1);\r\n }\r\n\r\n // Initialize connection monitor\r\n const connectionMonitor = new ConnectionMonitor(debug);\r\n\r\n // Create MCP client that will connect to remote Priority server\r\n const client = new Client({\r\n name: 'priority-mcp-client',\r\n version: '1.0.0'\r\n }, {\r\n capabilities: {}\r\n });\r\n\r\n // Generate tenant ID from company+url for uniqueness\r\n // This allows server to track/rate-limit per customer without storing credentials\r\n const crypto = await import('crypto');\r\n const tenantIdSource = `${options.priorityCompany.toLowerCase()}@${options.priorityUrl.toLowerCase()}`;\r\n const tenantId = crypto.createHash('sha256').update(tenantIdSource).digest('hex').substring(0, 16);\r\n\r\n // Prepare headers for authentication\r\n const headers = {\r\n 'User-Agent': 'leonai-priority-mcp-client',\r\n 'Authorization': `Bearer ${options.token}`,\r\n 'X-Tenant-ID': tenantId, // Unique identifier for rate limiting/tracking\r\n 'X-Priority-URL': options.priorityUrl,\r\n 'X-Priority-Company': options.priorityCompany,\r\n 'X-Priority-Tabulaini': options.priorityTabulaini,\r\n 'X-Priority-Username': options.priorityUsername,\r\n 'X-Priority-Password': options.priorityPassword\r\n };\r\n\r\n if (debug) {\r\n console.error('[DEBUG] Headers prepared (credentials hidden)');\r\n }\r\n\r\n // Connect to remote Priority MCP server via Streamable HTTP with timeout\r\n const mcpUrl = new URL('/mcp', MCP_SERVER_URL);\r\n const controller = new AbortController();\r\n const timeoutId = setTimeout(() => controller.abort(), 30000); // 30 second timeout\r\n\r\n // Create custom fetch that ensures User-Agent and auth headers are set\r\n // without interfering with MCP SDK's Content-Type headers\r\n const customFetch = async (url: string | URL | Request, init?: RequestInit) => {\r\n // Properly merge headers: SDK headers take precedence over our custom headers\r\n const mergedHeaders: Record<string, string> = { ...headers };\r\n\r\n // If SDK provides headers, ensure they override ours (especially Content-Type)\r\n if (init?.headers) {\r\n const sdkHeaders = init.headers instanceof Headers\r\n ? Object.fromEntries(init.headers.entries())\r\n : init.headers;\r\n Object.assign(mergedHeaders, sdkHeaders);\r\n }\r\n\r\n const fetchInit: RequestInit = {\r\n ...init,\r\n headers: mergedHeaders\r\n };\r\n return fetch(url, fetchInit);\r\n };\r\n\r\n const transport = new StreamableHTTPClientTransport(mcpUrl, {\r\n requestInit: {\r\n signal: controller.signal\r\n },\r\n fetch: customFetch as any\r\n });\r\n\r\n try {\r\n await retryWithBackoff(\r\n () => client.connect(transport),\r\n 3, // 3 retries for connection\r\n 1000, // 1s base delay\r\n debug\r\n );\r\n clearTimeout(timeoutId);\r\n\r\n if (debug) {\r\n console.error('[DEBUG] Connected to remote Priority MCP server');\r\n }\r\n } catch (error) {\r\n clearTimeout(timeoutId);\r\n console.error('[ERROR] Failed to connect to Priority MCP server');\r\n console.error('[ERROR]', error);\r\n console.error('[HINT]', getErrorHint(error, 'connection'));\r\n throw error;\r\n }\r\n\r\n // Create stdio server for Claude Desktop\r\n const server = new Server({\r\n name: 'priority-mcp-proxy',\r\n version: '1.0.0'\r\n }, {\r\n capabilities: {\r\n tools: {},\r\n resources: {},\r\n prompts: {}\r\n }\r\n });\r\n\r\n // Set up request handlers with retry logic and monitoring\r\n\r\n // List tools\r\n server.setRequestHandler(ListToolsRequestSchema, async () => {\r\n if (debug) console.error('[DEBUG] Forwarding tools/list');\r\n return await connectionMonitor.monitorCall('tools/list', async () => {\r\n return await retryWithBackoff(() => client.listTools(), 2, 500, debug);\r\n });\r\n });\r\n\r\n // Call tool (with retries for transient failures)\r\n server.setRequestHandler(CallToolRequestSchema, async (request) => {\r\n if (debug) console.error(`[DEBUG] Forwarding tools/call: ${request.params.name}`);\r\n if (verbose) console.error(`[VERBOSE] Tool params:`, JSON.stringify(request.params));\r\n\r\n try {\r\n const result = await connectionMonitor.monitorCall(`tools/call/${request.params.name}`, async () => {\r\n return await retryWithBackoff(() => client.callTool(request.params), 3, 1000, debug);\r\n });\r\n\r\n if (verbose) console.error(`[VERBOSE] Tool result:`, JSON.stringify(result).slice(0, 500));\r\n return result;\r\n } catch (error) {\r\n console.error(`[ERROR] Tool call failed: ${request.params.name}`);\r\n console.error(`[HINT]`, getErrorHint(error, 'tool call'));\r\n throw error;\r\n }\r\n });\r\n\r\n // List resources\r\n server.setRequestHandler(ListResourcesRequestSchema, async () => {\r\n if (debug) console.error('[DEBUG] Forwarding resources/list');\r\n return await connectionMonitor.monitorCall('resources/list', async () => {\r\n return await retryWithBackoff(() => client.listResources(), 2, 500, debug);\r\n });\r\n });\r\n\r\n // Read resource\r\n server.setRequestHandler(ReadResourceRequestSchema, async (request) => {\r\n if (debug) console.error(`[DEBUG] Forwarding resources/read: ${request.params.uri}`);\r\n return await connectionMonitor.monitorCall(`resources/read/${request.params.uri}`, async () => {\r\n return await retryWithBackoff(() => client.readResource(request.params), 3, 1000, debug);\r\n });\r\n });\r\n\r\n // List prompts\r\n server.setRequestHandler(ListPromptsRequestSchema, async () => {\r\n if (debug) console.error('[DEBUG] Forwarding prompts/list');\r\n return await connectionMonitor.monitorCall('prompts/list', async () => {\r\n return await retryWithBackoff(() => client.listPrompts(), 2, 500, debug);\r\n });\r\n });\r\n\r\n // Get prompt\r\n server.setRequestHandler(GetPromptRequestSchema, async (request) => {\r\n if (debug) console.error(`[DEBUG] Forwarding prompts/get: ${request.params.name}`);\r\n return await connectionMonitor.monitorCall(`prompts/get/${request.params.name}`, async () => {\r\n return await retryWithBackoff(() => client.getPrompt(request.params), 2, 500, debug);\r\n });\r\n });\r\n\r\n // Connect server to stdio for Claude Desktop\r\n const stdioTransport = new StdioServerTransport();\r\n await server.connect(stdioTransport);\r\n\r\n if (debug) {\r\n console.error('[DEBUG] Stdio server ready, proxy active');\r\n }\r\n\r\n // Keep process running\r\n process.on('SIGINT', async () => {\r\n if (debug) console.error('[DEBUG] Shutting down...');\r\n await server.close();\r\n await client.close();\r\n process.exit(0);\r\n });\r\n\r\n } catch (error) {\r\n console.error('Failed to start Priority MCP client:', error);\r\n process.exit(1);\r\n }\r\n}\r\n\r\nmain().catch((error) => {\r\n console.error('Fatal error:', error);\r\n process.exit(1);\r\n});\r\n"],"mappings":";;;A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