@openziti/ziti-mcp-server 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +868 -0
  3. package/dist/auth/client-credentials-flow.d.ts +21 -0
  4. package/dist/auth/client-credentials-flow.js +63 -0
  5. package/dist/auth/client-credentials-flow.js.map +1 -0
  6. package/dist/auth/device-auth-flow.d.ts +47 -0
  7. package/dist/auth/device-auth-flow.js +291 -0
  8. package/dist/auth/device-auth-flow.js.map +1 -0
  9. package/dist/clients/base.d.ts +74 -0
  10. package/dist/clients/base.js +109 -0
  11. package/dist/clients/base.js.map +1 -0
  12. package/dist/clients/claude.d.ts +22 -0
  13. package/dist/clients/claude.js +40 -0
  14. package/dist/clients/claude.js.map +1 -0
  15. package/dist/clients/cursor.d.ts +22 -0
  16. package/dist/clients/cursor.js +39 -0
  17. package/dist/clients/cursor.js.map +1 -0
  18. package/dist/clients/index.d.ts +33 -0
  19. package/dist/clients/index.js +39 -0
  20. package/dist/clients/index.js.map +1 -0
  21. package/dist/clients/types.d.ts +70 -0
  22. package/dist/clients/types.js +2 -0
  23. package/dist/clients/types.js.map +1 -0
  24. package/dist/clients/utils.d.ts +22 -0
  25. package/dist/clients/utils.js +46 -0
  26. package/dist/clients/utils.js.map +1 -0
  27. package/dist/clients/vscode.d.ts +76 -0
  28. package/dist/clients/vscode.js +159 -0
  29. package/dist/clients/vscode.js.map +1 -0
  30. package/dist/clients/windsurf.d.ts +22 -0
  31. package/dist/clients/windsurf.js +39 -0
  32. package/dist/clients/windsurf.js.map +1 -0
  33. package/dist/commands/init.d.ts +45 -0
  34. package/dist/commands/init.js +133 -0
  35. package/dist/commands/init.js.map +1 -0
  36. package/dist/commands/logout.d.ts +12 -0
  37. package/dist/commands/logout.js +90 -0
  38. package/dist/commands/logout.js.map +1 -0
  39. package/dist/commands/run.d.ts +15 -0
  40. package/dist/commands/run.js +94 -0
  41. package/dist/commands/run.js.map +1 -0
  42. package/dist/commands/session.d.ts +12 -0
  43. package/dist/commands/session.js +99 -0
  44. package/dist/commands/session.js.map +1 -0
  45. package/dist/index.d.ts +2 -0
  46. package/dist/index.js +105 -0
  47. package/dist/index.js.map +1 -0
  48. package/dist/server.d.ts +67 -0
  49. package/dist/server.js +171 -0
  50. package/dist/server.js.map +1 -0
  51. package/dist/tools/api-sessions.d.ts +3 -0
  52. package/dist/tools/api-sessions.js +86 -0
  53. package/dist/tools/api-sessions.js.map +1 -0
  54. package/dist/tools/auth-policies.d.ts +3 -0
  55. package/dist/tools/auth-policies.js +347 -0
  56. package/dist/tools/auth-policies.js.map +1 -0
  57. package/dist/tools/authenticators.d.ts +3 -0
  58. package/dist/tools/authenticators.js +183 -0
  59. package/dist/tools/authenticators.js.map +1 -0
  60. package/dist/tools/certificate-authorities.d.ts +3 -0
  61. package/dist/tools/certificate-authorities.js +288 -0
  62. package/dist/tools/certificate-authorities.js.map +1 -0
  63. package/dist/tools/config-types.d.ts +3 -0
  64. package/dist/tools/config-types.js +194 -0
  65. package/dist/tools/config-types.js.map +1 -0
  66. package/dist/tools/configs.d.ts +3 -0
  67. package/dist/tools/configs.js +203 -0
  68. package/dist/tools/configs.js.map +1 -0
  69. package/dist/tools/controller-settings.d.ts +3 -0
  70. package/dist/tools/controller-settings.js +219 -0
  71. package/dist/tools/controller-settings.js.map +1 -0
  72. package/dist/tools/controllers.d.ts +3 -0
  73. package/dist/tools/controllers.js +89 -0
  74. package/dist/tools/controllers.js.map +1 -0
  75. package/dist/tools/edge-router-policies.d.ts +3 -0
  76. package/dist/tools/edge-router-policies.js +262 -0
  77. package/dist/tools/edge-router-policies.js.map +1 -0
  78. package/dist/tools/edge-routers.d.ts +3 -0
  79. package/dist/tools/edge-routers.js +381 -0
  80. package/dist/tools/edge-routers.js.map +1 -0
  81. package/dist/tools/enrollments.d.ts +3 -0
  82. package/dist/tools/enrollments.js +187 -0
  83. package/dist/tools/enrollments.js.map +1 -0
  84. package/dist/tools/external-jwt-signers.d.ts +3 -0
  85. package/dist/tools/external-jwt-signers.js +242 -0
  86. package/dist/tools/external-jwt-signers.js.map +1 -0
  87. package/dist/tools/identities.d.ts +3 -0
  88. package/dist/tools/identities.js +741 -0
  89. package/dist/tools/identities.js.map +1 -0
  90. package/dist/tools/identity-types.d.ts +3 -0
  91. package/dist/tools/identity-types.js +58 -0
  92. package/dist/tools/identity-types.js.map +1 -0
  93. package/dist/tools/index.d.ts +3 -0
  94. package/dist/tools/index.js +101 -0
  95. package/dist/tools/index.js.map +1 -0
  96. package/dist/tools/posture-checks.d.ts +3 -0
  97. package/dist/tools/posture-checks.js +254 -0
  98. package/dist/tools/posture-checks.js.map +1 -0
  99. package/dist/tools/routers.d.ts +3 -0
  100. package/dist/tools/routers.js +169 -0
  101. package/dist/tools/routers.js.map +1 -0
  102. package/dist/tools/service-edge-router-policies.d.ts +3 -0
  103. package/dist/tools/service-edge-router-policies.js +282 -0
  104. package/dist/tools/service-edge-router-policies.js.map +1 -0
  105. package/dist/tools/service-policies.d.ts +3 -0
  106. package/dist/tools/service-policies.js +311 -0
  107. package/dist/tools/service-policies.js.map +1 -0
  108. package/dist/tools/services.d.ts +3 -0
  109. package/dist/tools/services.js +403 -0
  110. package/dist/tools/services.js.map +1 -0
  111. package/dist/tools/sessions.d.ts +3 -0
  112. package/dist/tools/sessions.js +86 -0
  113. package/dist/tools/sessions.js.map +1 -0
  114. package/dist/tools/terminators.d.ts +3 -0
  115. package/dist/tools/terminators.js +187 -0
  116. package/dist/tools/terminators.js.map +1 -0
  117. package/dist/tools/transit-routers.d.ts +3 -0
  118. package/dist/tools/transit-routers.js +169 -0
  119. package/dist/tools/transit-routers.js.map +1 -0
  120. package/dist/utils/analytics.d.ts +75 -0
  121. package/dist/utils/analytics.js +191 -0
  122. package/dist/utils/analytics.js.map +1 -0
  123. package/dist/utils/auth0-client.d.ts +27 -0
  124. package/dist/utils/auth0-client.js +67 -0
  125. package/dist/utils/auth0-client.js.map +1 -0
  126. package/dist/utils/authenticated-client.d.ts +6 -0
  127. package/dist/utils/authenticated-client.js +55 -0
  128. package/dist/utils/authenticated-client.js.map +1 -0
  129. package/dist/utils/config.d.ts +65 -0
  130. package/dist/utils/config.js +80 -0
  131. package/dist/utils/config.js.map +1 -0
  132. package/dist/utils/constants.d.ts +15 -0
  133. package/dist/utils/constants.js +17 -0
  134. package/dist/utils/constants.js.map +1 -0
  135. package/dist/utils/controller-client/client/client.gen.d.ts +2 -0
  136. package/dist/utils/controller-client/client/client.gen.js +229 -0
  137. package/dist/utils/controller-client/client/client.gen.js.map +1 -0
  138. package/dist/utils/controller-client/client/index.d.ts +8 -0
  139. package/dist/utils/controller-client/client/index.js +7 -0
  140. package/dist/utils/controller-client/client/index.js.map +1 -0
  141. package/dist/utils/controller-client/client/types.gen.d.ts +117 -0
  142. package/dist/utils/controller-client/client/types.gen.js +3 -0
  143. package/dist/utils/controller-client/client/types.gen.js.map +1 -0
  144. package/dist/utils/controller-client/client/utils.gen.d.ts +33 -0
  145. package/dist/utils/controller-client/client/utils.gen.js +232 -0
  146. package/dist/utils/controller-client/client/utils.gen.js.map +1 -0
  147. package/dist/utils/controller-client/client.gen.d.ts +12 -0
  148. package/dist/utils/controller-client/client.gen.js +6 -0
  149. package/dist/utils/controller-client/client.gen.js.map +1 -0
  150. package/dist/utils/controller-client/core/auth.gen.d.ts +18 -0
  151. package/dist/utils/controller-client/core/auth.gen.js +15 -0
  152. package/dist/utils/controller-client/core/auth.gen.js.map +1 -0
  153. package/dist/utils/controller-client/core/bodySerializer.gen.d.ts +25 -0
  154. package/dist/utils/controller-client/core/bodySerializer.gen.js +58 -0
  155. package/dist/utils/controller-client/core/bodySerializer.gen.js.map +1 -0
  156. package/dist/utils/controller-client/core/params.gen.d.ts +43 -0
  157. package/dist/utils/controller-client/core/params.gen.js +101 -0
  158. package/dist/utils/controller-client/core/params.gen.js.map +1 -0
  159. package/dist/utils/controller-client/core/pathSerializer.gen.d.ts +33 -0
  160. package/dist/utils/controller-client/core/pathSerializer.gen.js +115 -0
  161. package/dist/utils/controller-client/core/pathSerializer.gen.js.map +1 -0
  162. package/dist/utils/controller-client/core/queryKeySerializer.gen.d.ts +18 -0
  163. package/dist/utils/controller-client/core/queryKeySerializer.gen.js +100 -0
  164. package/dist/utils/controller-client/core/queryKeySerializer.gen.js.map +1 -0
  165. package/dist/utils/controller-client/core/serverSentEvents.gen.d.ts +71 -0
  166. package/dist/utils/controller-client/core/serverSentEvents.gen.js +136 -0
  167. package/dist/utils/controller-client/core/serverSentEvents.gen.js.map +1 -0
  168. package/dist/utils/controller-client/core/types.gen.d.ts +78 -0
  169. package/dist/utils/controller-client/core/types.gen.js +3 -0
  170. package/dist/utils/controller-client/core/types.gen.js.map +1 -0
  171. package/dist/utils/controller-client/core/utils.gen.d.ts +19 -0
  172. package/dist/utils/controller-client/core/utils.gen.js +88 -0
  173. package/dist/utils/controller-client/core/utils.gen.js.map +1 -0
  174. package/dist/utils/controller-client/index.d.ts +2 -0
  175. package/dist/utils/controller-client/index.js +3 -0
  176. package/dist/utils/controller-client/index.js.map +1 -0
  177. package/dist/utils/controller-client/sdk.gen.d.ts +1302 -0
  178. package/dist/utils/controller-client/sdk.gen.js +4436 -0
  179. package/dist/utils/controller-client/sdk.gen.js.map +1 -0
  180. package/dist/utils/controller-client/types.gen.d.ts +9170 -0
  181. package/dist/utils/controller-client/types.gen.js +3 -0
  182. package/dist/utils/controller-client/types.gen.js.map +1 -0
  183. package/dist/utils/glob.d.ts +75 -0
  184. package/dist/utils/glob.js +110 -0
  185. package/dist/utils/glob.js.map +1 -0
  186. package/dist/utils/http-utility.d.ts +5 -0
  187. package/dist/utils/http-utility.js +68 -0
  188. package/dist/utils/http-utility.js.map +1 -0
  189. package/dist/utils/keychain.d.ts +129 -0
  190. package/dist/utils/keychain.js +193 -0
  191. package/dist/utils/keychain.js.map +1 -0
  192. package/dist/utils/logger.d.ts +4 -0
  193. package/dist/utils/logger.js +28 -0
  194. package/dist/utils/logger.js.map +1 -0
  195. package/dist/utils/package.d.ts +3 -0
  196. package/dist/utils/package.js +9 -0
  197. package/dist/utils/package.js.map +1 -0
  198. package/dist/utils/scopes.d.ts +12 -0
  199. package/dist/utils/scopes.js +19 -0
  200. package/dist/utils/scopes.js.map +1 -0
  201. package/dist/utils/terminal.d.ts +35 -0
  202. package/dist/utils/terminal.js +409 -0
  203. package/dist/utils/terminal.js.map +1 -0
  204. package/dist/utils/tools.d.ts +63 -0
  205. package/dist/utils/tools.js +149 -0
  206. package/dist/utils/tools.js.map +1 -0
  207. package/dist/utils/types.d.ts +55 -0
  208. package/dist/utils/types.js +3 -0
  209. package/dist/utils/types.js.map +1 -0
  210. package/package.json +89 -0
@@ -0,0 +1,3 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+ export {};
3
+ //# sourceMappingURL=types.gen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.gen.js","sourceRoot":"","sources":["../../../src/utils/controller-client/types.gen.ts"],"names":[],"mappings":"AAAA,qDAAqD"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * A simple glob pattern matcher that supports * and ? wildcards.
3
+ * This class allows checking if strings match patterns containing wildcards:
4
+ * - * matches any sequence of characters (including empty string)
5
+ * - ? matches exactly one character
6
+ */
7
+ export declare class Glob {
8
+ private readonly pattern;
9
+ /**
10
+ * Creates a new glob pattern for matching strings.
11
+ *
12
+ * @param pattern - The glob pattern to use (supports * and ? wildcards)
13
+ * @example
14
+ * // Match all strings starting with 'test'
15
+ * const glob = new Glob('test*');
16
+ *
17
+ * @example
18
+ * // Match 'file.js' or 'file.ts' but not 'file.jsx'
19
+ * const glob = new Glob('file.??');
20
+ */
21
+ constructor(pattern: string);
22
+ /**
23
+ * Tests if a string matches this glob pattern.
24
+ *
25
+ * @param str - The string to test against the pattern
26
+ * @returns True if the string matches the pattern, false otherwise
27
+ *
28
+ * @example
29
+ * const glob = new Glob('test*');
30
+ * glob.matches('testing'); // Returns true
31
+ * glob.matches('contest'); // Returns false
32
+ *
33
+ * @example
34
+ * const glob = new Glob('file.?s');
35
+ * glob.matches('file.js'); // Returns true
36
+ * glob.matches('file.ts'); // Returns true
37
+ * glob.matches('file.jsx'); // Returns false
38
+ */
39
+ matches(str: string): boolean;
40
+ /**
41
+ * Checks if this pattern contains wildcards (* or ?).
42
+ *
43
+ * @returns True if the pattern contains any wildcards
44
+ * @example
45
+ * const glob = new Glob('test*');
46
+ * console.log(glob.hasWildcards()); // Outputs: true
47
+ */
48
+ hasWildcards(): boolean;
49
+ /**
50
+ * Returns the original pattern string.
51
+ *
52
+ * @returns The glob pattern as a string
53
+ * @example
54
+ * const glob = new Glob('test*');
55
+ * console.log(glob.toString()); // Outputs: 'test*'
56
+ */
57
+ toString(): string;
58
+ /**
59
+ * Static helper to create a glob and match it in one operation.
60
+ * Useful for one-off pattern matching without keeping the Glob instance.
61
+ *
62
+ * @param str - The string to test against the pattern
63
+ * @param pattern - The glob pattern to use (supports * and ? wildcards)
64
+ * @returns True if the string matches the pattern, false otherwise
65
+ *
66
+ * @example
67
+ * // Check if a string matches a pattern
68
+ * Glob.matches('testing', 'test*'); // Returns true
69
+ *
70
+ * @example
71
+ * // Check if a filename matches a specific pattern
72
+ * Glob.matches('file.js', 'file.?s'); // Returns true
73
+ */
74
+ static matches(str: string, pattern: string): boolean;
75
+ }
@@ -0,0 +1,110 @@
1
+ /**
2
+ * A simple glob pattern matcher that supports * and ? wildcards.
3
+ * This class allows checking if strings match patterns containing wildcards:
4
+ * - * matches any sequence of characters (including empty string)
5
+ * - ? matches exactly one character
6
+ */
7
+ export class Glob {
8
+ pattern;
9
+ /**
10
+ * Creates a new glob pattern for matching strings.
11
+ *
12
+ * @param pattern - The glob pattern to use (supports * and ? wildcards)
13
+ * @example
14
+ * // Match all strings starting with 'test'
15
+ * const glob = new Glob('test*');
16
+ *
17
+ * @example
18
+ * // Match 'file.js' or 'file.ts' but not 'file.jsx'
19
+ * const glob = new Glob('file.??');
20
+ */
21
+ constructor(pattern) {
22
+ this.pattern = pattern.trim();
23
+ }
24
+ /**
25
+ * Tests if a string matches this glob pattern.
26
+ *
27
+ * @param str - The string to test against the pattern
28
+ * @returns True if the string matches the pattern, false otherwise
29
+ *
30
+ * @example
31
+ * const glob = new Glob('test*');
32
+ * glob.matches('testing'); // Returns true
33
+ * glob.matches('contest'); // Returns false
34
+ *
35
+ * @example
36
+ * const glob = new Glob('file.?s');
37
+ * glob.matches('file.js'); // Returns true
38
+ * glob.matches('file.ts'); // Returns true
39
+ * glob.matches('file.jsx'); // Returns false
40
+ */
41
+ matches(str) {
42
+ // Handle null/undefined
43
+ if (str === null || str === undefined)
44
+ return false;
45
+ const pattern = this.pattern;
46
+ // Empty pattern only matches empty string
47
+ if (pattern === '')
48
+ return str === '';
49
+ // Global wildcard matches anything
50
+ if (pattern === '*')
51
+ return true;
52
+ // No wildcards - just do exact match
53
+ if (!pattern.includes('*') && !pattern.includes('?')) {
54
+ return pattern === str;
55
+ }
56
+ // Convert glob pattern to a simple regex
57
+ const regexString = pattern
58
+ // Escape all special regex chars except * and ?
59
+ .replace(/[.+^${}()|[\]\\]/g, '\\$&')
60
+ // Convert * to .*
61
+ .replace(/\*/g, '.*')
62
+ // Convert ? to . (single character)
63
+ .replace(/\?/g, '.');
64
+ // Create regex that matches the entire string
65
+ const regex = new RegExp(`^${regexString}$`);
66
+ return regex.test(str);
67
+ }
68
+ /**
69
+ * Checks if this pattern contains wildcards (* or ?).
70
+ *
71
+ * @returns True if the pattern contains any wildcards
72
+ * @example
73
+ * const glob = new Glob('test*');
74
+ * console.log(glob.hasWildcards()); // Outputs: true
75
+ */
76
+ hasWildcards() {
77
+ return this.pattern.includes('*') || this.pattern.includes('?');
78
+ }
79
+ /**
80
+ * Returns the original pattern string.
81
+ *
82
+ * @returns The glob pattern as a string
83
+ * @example
84
+ * const glob = new Glob('test*');
85
+ * console.log(glob.toString()); // Outputs: 'test*'
86
+ */
87
+ toString() {
88
+ return this.pattern;
89
+ }
90
+ /**
91
+ * Static helper to create a glob and match it in one operation.
92
+ * Useful for one-off pattern matching without keeping the Glob instance.
93
+ *
94
+ * @param str - The string to test against the pattern
95
+ * @param pattern - The glob pattern to use (supports * and ? wildcards)
96
+ * @returns True if the string matches the pattern, false otherwise
97
+ *
98
+ * @example
99
+ * // Check if a string matches a pattern
100
+ * Glob.matches('testing', 'test*'); // Returns true
101
+ *
102
+ * @example
103
+ * // Check if a filename matches a specific pattern
104
+ * Glob.matches('file.js', 'file.?s'); // Returns true
105
+ */
106
+ static matches(str, pattern) {
107
+ return new Glob(pattern).matches(str);
108
+ }
109
+ }
110
+ //# sourceMappingURL=glob.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glob.js","sourceRoot":"","sources":["../../src/utils/glob.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,OAAO,IAAI;IACE,OAAO,CAAS;IAEjC;;;;;;;;;;;OAWG;IACH,YAAY,OAAe;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAChC,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,OAAO,CAAC,GAAW;QACjB,wBAAwB;QACxB,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS;YAAE,OAAO,KAAK,CAAC;QAEpD,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAE7B,0CAA0C;QAC1C,IAAI,OAAO,KAAK,EAAE;YAAE,OAAO,GAAG,KAAK,EAAE,CAAC;QAEtC,mCAAmC;QACnC,IAAI,OAAO,KAAK,GAAG;YAAE,OAAO,IAAI,CAAC;QAEjC,qCAAqC;QACrC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACrD,OAAO,OAAO,KAAK,GAAG,CAAC;QACzB,CAAC;QAED,yCAAyC;QACzC,MAAM,WAAW,GAAG,OAAO;YACzB,gDAAgD;aAC/C,OAAO,CAAC,mBAAmB,EAAE,MAAM,CAAC;YACrC,kBAAkB;aACjB,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC;YACrB,oCAAoC;aACnC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAEvB,8CAA8C;QAC9C,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,IAAI,WAAW,GAAG,CAAC,CAAC;QAC7C,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IAED;;;;;;;OAOG;IACH,YAAY;QACV,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IAClE,CAAC;IAED;;;;;;;OAOG;IACH,QAAQ;QACN,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,OAAO,CAAC,GAAW,EAAE,OAAe;QACzC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACxC,CAAC;CACF"}
@@ -0,0 +1,5 @@
1
+ import { HandlerResponse } from './types';
2
+ export declare function handleNetworkError(error: any): string;
3
+ export declare function formatDomain(domain: string): string;
4
+ export declare function createSuccessResponse(result: object | Array<any>): HandlerResponse;
5
+ export declare function createErrorResponse(errorString: string): HandlerResponse;
@@ -0,0 +1,68 @@
1
+ // Add network error handling utility
2
+ export function handleNetworkError(error) {
3
+ if (error.name === 'AbortError') {
4
+ return 'request timed out. The Auth0 API did not respond in time.';
5
+ }
6
+ else if (error instanceof TypeError) {
7
+ return `network error: ${error.message || 'Failed to connect'}`;
8
+ }
9
+ else if (error.code === 'ENOTFOUND' || error.code === 'ECONNREFUSED') {
10
+ return `Connection failed: Unable to reach the Auth0 API (${error.code}). Check your network connection.`;
11
+ }
12
+ else if (error.code === 'ECONNRESET') {
13
+ return 'Connection was reset by the server. Try again later.';
14
+ }
15
+ else {
16
+ return `Error: ${error.message || error}`;
17
+ }
18
+ }
19
+ // Helper function to ensure domain is properly formatted
20
+ export function formatDomain(domain) {
21
+ if (!domain)
22
+ return '';
23
+ // Remove protocol (http:// or https://)
24
+ let formattedDomain = domain.replace(/^https?:\/\//, '');
25
+ // Remove trailing slash
26
+ formattedDomain = formattedDomain.replace(/\/$/, '');
27
+ return formattedDomain.includes('.') ? formattedDomain : `${formattedDomain}.us.auth0.com`;
28
+ }
29
+ // Helper function to create success response
30
+ export function createSuccessResponse(result) {
31
+ // Check if result is an array and has more than one item
32
+ if (Array.isArray(result) && result.length > 1) {
33
+ const mutiContent = result.map((item) => {
34
+ return {
35
+ type: 'text',
36
+ text: JSON.stringify(item, null, 2),
37
+ };
38
+ });
39
+ return {
40
+ content: mutiContent,
41
+ isError: false,
42
+ };
43
+ }
44
+ else {
45
+ return {
46
+ content: [
47
+ {
48
+ type: 'text',
49
+ text: JSON.stringify(result, null, 2),
50
+ },
51
+ ],
52
+ isError: false,
53
+ };
54
+ }
55
+ }
56
+ // Helper function to create error response
57
+ export function createErrorResponse(errorString) {
58
+ return {
59
+ content: [
60
+ {
61
+ type: 'text',
62
+ text: errorString,
63
+ },
64
+ ],
65
+ isError: true,
66
+ };
67
+ }
68
+ //# sourceMappingURL=http-utility.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-utility.js","sourceRoot":"","sources":["../../src/utils/http-utility.ts"],"names":[],"mappings":"AAEA,qCAAqC;AACrC,MAAM,UAAU,kBAAkB,CAAC,KAAU;IAC3C,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;QAChC,OAAO,2DAA2D,CAAC;IACrE,CAAC;SAAM,IAAI,KAAK,YAAY,SAAS,EAAE,CAAC;QACtC,OAAO,kBAAkB,KAAK,CAAC,OAAO,IAAI,mBAAmB,EAAE,CAAC;IAClE,CAA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CAAC;QACN,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;iBACtC;aACF;YACD,OAAO,EAAE,KAAK;SACf,CAAC;IACJ,CAAC;AACH,CAAC;AAED,2CAA2C;AAC3C,MAAM,UAAU,mBAAmB,CAAC,WAAmB;IACrD,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,WAAW;aAClB;SACF;QACD,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC"}
@@ -0,0 +1,129 @@
1
+ /**
2
+ * Service name used for keychain operations
3
+ */
4
+ export declare const KEYCHAIN_SERVICE_NAME = "ziti-mcp";
5
+ /**
6
+ * Keychain item keys for OpenZiti related tokens and configuration
7
+ * @readonly
8
+ * @enum {string}
9
+ */
10
+ export declare const KeychainItem: {
11
+ /** Access token for OpenZiti Controller Management API */
12
+ readonly TOKEN: "OPENZITI_TOKEN";
13
+ /** OpenZiti Controller host */
14
+ readonly ZITI_CONTROLLER_HOST: "ZITI_CONTROLLER_HOST";
15
+ /** OpenZiti Controller host */
16
+ readonly DOMAIN: "OPENZITI_AUTH0_DOMAIN";
17
+ /** OAuth refresh token for obtaining new access tokens */
18
+ readonly REFRESH_TOKEN: "OPENZITI_REFRESH_TOKEN";
19
+ /** Timestamp when the current token expires */
20
+ readonly TOKEN_EXPIRES_AT: "OPENZITI_TOKEN_EXPIRES_AT";
21
+ };
22
+ /**
23
+ * Array of all keychain item keys for operations that need to process all items
24
+ * @type {string[]}
25
+ */
26
+ export declare const ALL_KEYCHAIN_ITEMS: ("OPENZITI_TOKEN" | "ZITI_CONTROLLER_HOST" | "OPENZITI_AUTH0_DOMAIN" | "OPENZITI_REFRESH_TOKEN" | "OPENZITI_TOKEN_EXPIRES_AT")[];
27
+ /**
28
+ * Type representing the result of a keychain operation
29
+ */
30
+ export type KeychainOperationResult = {
31
+ item: string;
32
+ success: boolean;
33
+ error?: Error;
34
+ };
35
+ /**
36
+ * Keychain service for securely storing OpenZiti Controller credentials
37
+ * Provides type-safe methods for working with OpenZiti Controller tokens and settings
38
+ */
39
+ declare class KeychainService {
40
+ private serviceName;
41
+ /**
42
+ * Creates a new KeychainService instance
43
+ * @param serviceName - The keychain service name to use
44
+ */
45
+ constructor(serviceName?: string);
46
+ /**
47
+ * Store the OpenZiti Controller access token in the keychain
48
+ * @param token - The access token to store
49
+ * @returns A promise that resolves to true if successful, false otherwise
50
+ */
51
+ setToken(token: string): Promise<boolean>;
52
+ /**
53
+ * Retrieve the OpenZiti Controller access token from the keychain
54
+ * @returns A promise that resolves to the access token or null if not found
55
+ */
56
+ getToken(): Promise<string | null>;
57
+ /**
58
+ * Store the OpenZiti Controller host in the keychain
59
+ * @param host - The host to store
60
+ * @returns A promise that resolves to true if successful, false otherwise
61
+ */
62
+ setZitiControllerHost(host: string): Promise<boolean>;
63
+ /**
64
+ * Retrieve the OpenZiti Controller host from the keychain
65
+ * @returns A promise that resolves to the host or null if not found
66
+ */
67
+ getZitiControllerHost(): Promise<string | null>;
68
+ /**
69
+ * Store the OpenZiti Controller host in the keychain
70
+ * @param host - The host to store
71
+ * @returns A promise that resolves to true if successful, false otherwise
72
+ */
73
+ setDomain(domain: string): Promise<boolean>;
74
+ /**
75
+ * Retrieve the OpenZiti Controller host from the keychain
76
+ * @returns A promise that resolves to the host or null if not found
77
+ */
78
+ getDomain(): Promise<string | null>;
79
+ /**
80
+ * Store the OpenZiti Controller refresh token in the keychain
81
+ * @param refreshToken - The refresh token to store
82
+ * @returns A promise that resolves to true if successful, false otherwise
83
+ */
84
+ setRefreshToken(refreshToken: string): Promise<boolean>;
85
+ /**
86
+ * Retrieve the OpenZiti Controller refresh token from the keychain
87
+ * @returns A promise that resolves to the refresh token or null if not found
88
+ */
89
+ getRefreshToken(): Promise<string | null>;
90
+ /**
91
+ * Store the token expiration timestamp in the keychain
92
+ * @param timestamp - The expiration timestamp in milliseconds since epoch
93
+ * @returns A promise that resolves to true if successful, false otherwise
94
+ */
95
+ setTokenExpiresAt(timestamp: number): Promise<boolean>;
96
+ /**
97
+ * Retrieve the token expiration timestamp from the keychain
98
+ * @returns A promise that resolves to the timestamp as a number or null if not found
99
+ */
100
+ getTokenExpiresAt(): Promise<number | null>;
101
+ /**
102
+ * Delete all OpenZiti Controller related items from the keychain
103
+ * @returns A promise that resolves to an array of results for each deletion operation
104
+ */
105
+ clearAll(): Promise<KeychainOperationResult[]>;
106
+ /**
107
+ * Delete a specific item from the keychain
108
+ * @param key - The key to delete
109
+ * @returns A promise that resolves to true if successful, false otherwise
110
+ */
111
+ delete(key: string): Promise<boolean>;
112
+ /**
113
+ * Internal method to store a value in the system keychain
114
+ * @param key - The key to store the value under
115
+ * @param value - The value to store
116
+ * @returns A promise that resolves to true if successful, false otherwise
117
+ * @private
118
+ */
119
+ private set;
120
+ /**
121
+ * Internal method to retrieve a value from the system keychain
122
+ * @param key - The key to retrieve
123
+ * @returns A promise that resolves to the stored value or null if not found
124
+ * @private
125
+ */
126
+ private get;
127
+ }
128
+ export declare const keychain: KeychainService;
129
+ export {};
@@ -0,0 +1,193 @@
1
+ import keytar from 'keytar';
2
+ import { log } from './logger.js';
3
+ /**
4
+ * Service name used for keychain operations
5
+ */
6
+ export const KEYCHAIN_SERVICE_NAME = 'ziti-mcp';
7
+ /**
8
+ * Keychain item keys for OpenZiti related tokens and configuration
9
+ * @readonly
10
+ * @enum {string}
11
+ */
12
+ export const KeychainItem = {
13
+ /** Access token for OpenZiti Controller Management API */
14
+ TOKEN: 'OPENZITI_TOKEN',
15
+ /** OpenZiti Controller host */
16
+ ZITI_CONTROLLER_HOST: 'ZITI_CONTROLLER_HOST',
17
+ /** OpenZiti Controller host */
18
+ DOMAIN: 'OPENZITI_AUTH0_DOMAIN',
19
+ /** OAuth refresh token for obtaining new access tokens */
20
+ REFRESH_TOKEN: 'OPENZITI_REFRESH_TOKEN',
21
+ /** Timestamp when the current token expires */
22
+ TOKEN_EXPIRES_AT: 'OPENZITI_TOKEN_EXPIRES_AT',
23
+ };
24
+ /**
25
+ * Array of all keychain item keys for operations that need to process all items
26
+ * @type {string[]}
27
+ */
28
+ export const ALL_KEYCHAIN_ITEMS = Object.values(KeychainItem);
29
+ /**
30
+ * Keychain service for securely storing OpenZiti Controller credentials
31
+ * Provides type-safe methods for working with OpenZiti Controller tokens and settings
32
+ */
33
+ class KeychainService {
34
+ serviceName;
35
+ /**
36
+ * Creates a new KeychainService instance
37
+ * @param serviceName - The keychain service name to use
38
+ */
39
+ constructor(serviceName = KEYCHAIN_SERVICE_NAME) {
40
+ this.serviceName = serviceName;
41
+ }
42
+ /**
43
+ * Store the OpenZiti Controller access token in the keychain
44
+ * @param token - The access token to store
45
+ * @returns A promise that resolves to true if successful, false otherwise
46
+ */
47
+ async setToken(token) {
48
+ return this.set(KeychainItem.TOKEN, token);
49
+ }
50
+ /**
51
+ * Retrieve the OpenZiti Controller access token from the keychain
52
+ * @returns A promise that resolves to the access token or null if not found
53
+ */
54
+ async getToken() {
55
+ return this.get(KeychainItem.TOKEN);
56
+ }
57
+ /**
58
+ * Store the OpenZiti Controller host in the keychain
59
+ * @param host - The host to store
60
+ * @returns A promise that resolves to true if successful, false otherwise
61
+ */
62
+ async setZitiControllerHost(host) {
63
+ return this.set(KeychainItem.ZITI_CONTROLLER_HOST, host);
64
+ }
65
+ /**
66
+ * Retrieve the OpenZiti Controller host from the keychain
67
+ * @returns A promise that resolves to the host or null if not found
68
+ */
69
+ async getZitiControllerHost() {
70
+ return this.get(KeychainItem.ZITI_CONTROLLER_HOST);
71
+ }
72
+ /**
73
+ * Store the OpenZiti Controller host in the keychain
74
+ * @param host - The host to store
75
+ * @returns A promise that resolves to true if successful, false otherwise
76
+ */
77
+ async setDomain(domain) {
78
+ return this.set(KeychainItem.DOMAIN, domain);
79
+ }
80
+ /**
81
+ * Retrieve the OpenZiti Controller host from the keychain
82
+ * @returns A promise that resolves to the host or null if not found
83
+ */
84
+ async getDomain() {
85
+ return this.get(KeychainItem.DOMAIN);
86
+ }
87
+ /**
88
+ * Store the OpenZiti Controller refresh token in the keychain
89
+ * @param refreshToken - The refresh token to store
90
+ * @returns A promise that resolves to true if successful, false otherwise
91
+ */
92
+ async setRefreshToken(refreshToken) {
93
+ return this.set(KeychainItem.REFRESH_TOKEN, refreshToken);
94
+ }
95
+ /**
96
+ * Retrieve the OpenZiti Controller refresh token from the keychain
97
+ * @returns A promise that resolves to the refresh token or null if not found
98
+ */
99
+ async getRefreshToken() {
100
+ return this.get(KeychainItem.REFRESH_TOKEN);
101
+ }
102
+ /**
103
+ * Store the token expiration timestamp in the keychain
104
+ * @param timestamp - The expiration timestamp in milliseconds since epoch
105
+ * @returns A promise that resolves to true if successful, false otherwise
106
+ */
107
+ async setTokenExpiresAt(timestamp) {
108
+ return this.set(KeychainItem.TOKEN_EXPIRES_AT, timestamp.toString());
109
+ }
110
+ /**
111
+ * Retrieve the token expiration timestamp from the keychain
112
+ * @returns A promise that resolves to the timestamp as a number or null if not found
113
+ */
114
+ async getTokenExpiresAt() {
115
+ const value = await this.get(KeychainItem.TOKEN_EXPIRES_AT);
116
+ return value ? parseInt(value, 10) : null;
117
+ }
118
+ /**
119
+ * Delete all OpenZiti Controller related items from the keychain
120
+ * @returns A promise that resolves to an array of results for each deletion operation
121
+ */
122
+ async clearAll() {
123
+ const results = await Promise.all(ALL_KEYCHAIN_ITEMS.map(async (item) => {
124
+ try {
125
+ const result = await keytar.deletePassword(this.serviceName, item);
126
+ log(`Deleted ${item} from keychain: ${result ? 'Success' : 'Not found'}`);
127
+ return { item, success: result };
128
+ }
129
+ catch (error) {
130
+ log(`Error deleting ${item} from keychain:`, error);
131
+ if (error instanceof Error) {
132
+ return { item, success: false, error };
133
+ }
134
+ return { item, success: false, error: new Error(String(error)) };
135
+ }
136
+ }));
137
+ // Log a summary of the results
138
+ const successCount = results.filter((r) => r.success).length;
139
+ log(`Cleared ${successCount}/${ALL_KEYCHAIN_ITEMS.length} items from keychain`);
140
+ return results;
141
+ }
142
+ /**
143
+ * Delete a specific item from the keychain
144
+ * @param key - The key to delete
145
+ * @returns A promise that resolves to true if successful, false otherwise
146
+ */
147
+ async delete(key) {
148
+ try {
149
+ const result = await keytar.deletePassword(this.serviceName, key);
150
+ log(`Deleted ${key} from keychain: ${result ? 'Success' : 'Not found'}`);
151
+ return result;
152
+ }
153
+ catch (error) {
154
+ log(`Error deleting ${key} from keychain:`, error);
155
+ return false;
156
+ }
157
+ }
158
+ /**
159
+ * Internal method to store a value in the system keychain
160
+ * @param key - The key to store the value under
161
+ * @param value - The value to store
162
+ * @returns A promise that resolves to true if successful, false otherwise
163
+ * @private
164
+ */
165
+ async set(key, value) {
166
+ try {
167
+ await keytar.setPassword(this.serviceName, key, value);
168
+ log(`Successfully stored ${key} in keychain`);
169
+ return true;
170
+ }
171
+ catch (error) {
172
+ log(`Error storing ${key} in keychain:`, error);
173
+ return false;
174
+ }
175
+ }
176
+ /**
177
+ * Internal method to retrieve a value from the system keychain
178
+ * @param key - The key to retrieve
179
+ * @returns A promise that resolves to the stored value or null if not found
180
+ * @private
181
+ */
182
+ async get(key) {
183
+ try {
184
+ return await keytar.getPassword(this.serviceName, key);
185
+ }
186
+ catch (error) {
187
+ log(`Error retrieving ${key} from keychain:`, error);
188
+ return null;
189
+ }
190
+ }
191
+ }
192
+ export const keychain = new KeychainService(KEYCHAIN_SERVICE_NAME);
193
+ //# sourceMappingURL=keychain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keychain.js","sourceRoot":"","sources":["../../src/utils/keychain.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,UAAU,CAAC;AAEhD;;;;GAIG;AACH,MAAM,CAAC,MAAM,YA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OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,GAAG,CAAC,iBAAiB,GAAG,eAAe,EAAE,KAAK,CAAC,CAAC;YAChD,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACK,KAAK,CAAC,GAAG,CAAC,GAAW;QAC3B,IAAI,CAAC;YACH,OAAO,MAAM,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;QACzD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,GAAG,CAAC,oBAAoB,GAAG,iBAAiB,EAAE,KAAK,CAAC,CAAC;YACrD,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;CACF;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,eAAe,CAAC,qBAAqB,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import debug from 'debug';
2
+ export declare const log: debug.Debugger;
3
+ export declare const logInfo: (...args: any[]) => true | undefined;
4
+ export declare const logError: (msg: string, error?: any) => boolean;
@@ -0,0 +1,28 @@
1
+ import debug from 'debug';
2
+ // Set up debug logger
3
+ export const log = debug('ziti-mcp');
4
+ // Make sure debug output goes to stderr
5
+ debug.log = (...args) => {
6
+ const msg = `[DEBUG:ziti-mcp] ${args.join(' ')}\n`;
7
+ process.stderr.write(msg);
8
+ return true;
9
+ };
10
+ export const logInfo = (...args) => {
11
+ if (process.env.DEBUG == 'ziti-mcp') {
12
+ return;
13
+ }
14
+ const msg = `[INFO:ziti-mcp] ${args.join(' ')}\n`;
15
+ process.stderr.write(msg);
16
+ return true;
17
+ };
18
+ export const logError = (msg, error = undefined) => {
19
+ const formattedMsg = `[ERROR:ziti-mcp] ${msg}`;
20
+ if (error) {
21
+ console.error(formattedMsg, error);
22
+ }
23
+ else {
24
+ console.error(formattedMsg);
25
+ }
26
+ return true;
27
+ };
28
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,sBAAsB;AACtB,MAAM,CAAC,MAAM,GAAG,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC;AAErC,wCAAwC;AACxC,KAAK,CAAC,GAAG,GAAG,CAAC,GAAG,IAAI,EAAE,EAAE;IACtB,MAAM,GAAG,GAAG,oBAAoB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;IACnD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC1B,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,GAAG,IAAW,EAAE,EAAE;IACxC,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,UAAU,EAAE,CAAC;QACpC,OAAO;IACT,CAAC;IACD,MAAM,GAAG,GAAG,mBAAmB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;IAClD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC1B,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAE,QAAa,SAAS,EAAE,EAAE;IAC9D,MAAM,YAAY,GAAG,oBAAoB,GAAG,EAAE,CAAC;IAC/C,IAAI,KAAK,EAAE,CAAC;QACV,OAAO,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;IACrC,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAC9B,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const packageName: any;
2
+ export declare const packageVersion: any;
3
+ export declare const packageInfo: any;
@@ -0,0 +1,9 @@
1
+ import { createRequire } from 'module';
2
+ // For importing JSON files in ES modules
3
+ const require = createRequire(import.meta.url);
4
+ const packageJson = require('../../package.json');
5
+ // Export package coordinates
6
+ export const packageName = packageJson.name;
7
+ export const packageVersion = packageJson.version;
8
+ export const packageInfo = packageJson;
9
+ //# sourceMappingURL=package.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package.js","sourceRoot":"","sources":["../../src/utils/package.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,yCAAyC;AACzC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,WAAW,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAElD,6BAA6B;AAC7B,MAAM,CAAC,MAAM,WAAW,GAAG,WAAW,CAAC,IAAI,CAAC;AAC5C,MAAM,CAAC,MAAM,cAAc,GAAG,WAAW,CAAC,OAAO,CAAC;AAClD,MAAM,CAAC,MAAM,WAAW,GAAG,WAAW,CAAC"}