@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,67 @@
1
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
2
+ import type { RunOptions } from './commands/run.js';
3
+ type ServerOptions = RunOptions;
4
+ /**
5
+ * Initializes and starts the OpenZiti MCP server to provide AI assistants
6
+ * with secure, controlled access to OpenZiti Controller Management API capabilities.
7
+ *
8
+ * This server acts as a secure bridge between AI models and OpenZiti Controller Management APIs,
9
+ * enforcing proper authentication, authorization, and validation at every step.
10
+ * The server validates credentials before any operations and continuously
11
+ * monitors token validity during operation to prevent security issues.
12
+ *
13
+ * Security architecture:
14
+ * - Initial user-friendly validation occurs in `run.ts` with detailed CLI feedback
15
+ * - Startup validation here provides a secondary checkpoint
16
+ * - Continuous validation during tool calls ensures credentials remain valid
17
+ * - Token expiration checking prevents use of expired credentials
18
+ *
19
+ * This multi-layered approach balances security requirements with developer
20
+ * experience by providing appropriate feedback at each stage.
21
+ *
22
+ * Key responsibilities include:
23
+ * - Securing access to OpenZiti Controller Management API
24
+ * - Validating user credentials and token expiration
25
+ * - Automatically refreshing invalid configurations when possible
26
+ * - Exposing selected tools based on user permissions and preferences
27
+ * - Handling MCP protocol requests through configured transports
28
+ *
29
+ * @param {ServerOptions} [options] - Optional configuration for tool filtering and read-only mode
30
+ * @returns {Promise<Server>} The initialized MCP server instance
31
+ * @throws {Error} If configuration validation fails or server setup encounters errors
32
+ */
33
+ export declare function startServer(options?: ServerOptions): Promise<Server<{
34
+ method: string;
35
+ params?: {
36
+ [x: string]: unknown;
37
+ _meta?: {
38
+ [x: string]: unknown;
39
+ progressToken?: string | number | undefined;
40
+ "io.modelcontextprotocol/related-task"?: {
41
+ taskId: string;
42
+ } | undefined;
43
+ } | undefined;
44
+ } | undefined;
45
+ }, {
46
+ method: string;
47
+ params?: {
48
+ [x: string]: unknown;
49
+ _meta?: {
50
+ [x: string]: unknown;
51
+ progressToken?: string | number | undefined;
52
+ "io.modelcontextprotocol/related-task"?: {
53
+ taskId: string;
54
+ } | undefined;
55
+ } | undefined;
56
+ } | undefined;
57
+ }, {
58
+ [x: string]: unknown;
59
+ _meta?: {
60
+ [x: string]: unknown;
61
+ progressToken?: string | number | undefined;
62
+ "io.modelcontextprotocol/related-task"?: {
63
+ taskId: string;
64
+ } | undefined;
65
+ } | undefined;
66
+ }>>;
67
+ export {};
package/dist/server.js ADDED
@@ -0,0 +1,171 @@
1
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
2
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
3
+ import { CallToolRequestSchema, ListToolsRequestSchema, SetLevelRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
4
+ import { loadConfig, validateConfig } from './utils/config.js';
5
+ import { HANDLERS, TOOLS } from './tools/index.js';
6
+ import { log, logInfo } from './utils/logger.js';
7
+ import { formatDomain } from './utils/http-utility.js';
8
+ import { maskTenantName } from './utils/terminal.js';
9
+ import { getAvailableTools } from './utils/tools.js';
10
+ import { packageVersion } from './utils/package.js';
11
+ /**
12
+ * Initializes and starts the OpenZiti MCP server to provide AI assistants
13
+ * with secure, controlled access to OpenZiti Controller Management API capabilities.
14
+ *
15
+ * This server acts as a secure bridge between AI models and OpenZiti Controller Management APIs,
16
+ * enforcing proper authentication, authorization, and validation at every step.
17
+ * The server validates credentials before any operations and continuously
18
+ * monitors token validity during operation to prevent security issues.
19
+ *
20
+ * Security architecture:
21
+ * - Initial user-friendly validation occurs in `run.ts` with detailed CLI feedback
22
+ * - Startup validation here provides a secondary checkpoint
23
+ * - Continuous validation during tool calls ensures credentials remain valid
24
+ * - Token expiration checking prevents use of expired credentials
25
+ *
26
+ * This multi-layered approach balances security requirements with developer
27
+ * experience by providing appropriate feedback at each stage.
28
+ *
29
+ * Key responsibilities include:
30
+ * - Securing access to OpenZiti Controller Management API
31
+ * - Validating user credentials and token expiration
32
+ * - Automatically refreshing invalid configurations when possible
33
+ * - Exposing selected tools based on user permissions and preferences
34
+ * - Handling MCP protocol requests through configured transports
35
+ *
36
+ * @param {ServerOptions} [options] - Optional configuration for tool filtering and read-only mode
37
+ * @returns {Promise<Server>} The initialized MCP server instance
38
+ * @throws {Error} If configuration validation fails or server setup encounters errors
39
+ */
40
+ export async function startServer(options) {
41
+ try {
42
+ log('Initializing OpenZiti MCP server...');
43
+ // Log node version
44
+ log(`Node.js version: ${process.version}`);
45
+ log(`Process ID: ${process.pid}`);
46
+ log(`Platform: ${process.platform} (${process.arch})`);
47
+ // Load configuration
48
+ let config = await loadConfig();
49
+ if (!config || !(await validateConfig(config))) {
50
+ log('Failed to load valid OpenZiti configuration');
51
+ throw new Error('Invalid OpenZiti configuration');
52
+ }
53
+ log(`Successfully loaded configuration for tenant: ${maskTenantName(config.tenantName)}`);
54
+ // Get available tools based on options if provided
55
+ const availableTools = getAvailableTools(TOOLS, options?.tools, options?.readOnly);
56
+ // Create server instance
57
+ const server = new Server({
58
+ name: 'ziti',
59
+ version: packageVersion,
60
+ }, {
61
+ capabilities: {
62
+ tools: {},
63
+ logging: {},
64
+ },
65
+ });
66
+ // keep track of the current log level
67
+ let currentLogLevel;
68
+ // register handler
69
+ server.setRequestHandler(SetLevelRequestSchema, async (request) => {
70
+ const { level } = request.params;
71
+ currentLogLevel = level;
72
+ log(`MCP log level set to ${currentLogLevel}`);
73
+ return {};
74
+ });
75
+ // Handle list tools request
76
+ server.setRequestHandler(ListToolsRequestSchema, async () => {
77
+ log('Received list tools request');
78
+ // Sanitize tools by removing _meta fields
79
+ // See: https://github.com/modelcontextprotocol/modelcontextprotocol/issues/264
80
+ const sanitizedTools = availableTools.map(({ _meta, ...rest }) => rest);
81
+ log(sanitizedTools);
82
+ return { tools: sanitizedTools };
83
+ });
84
+ // Handle tool calls
85
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
86
+ const toolName = request.params.name;
87
+ log(`Received tool call: ${toolName}`);
88
+ try {
89
+ if (!HANDLERS[toolName]) {
90
+ throw new Error(`Unknown tool: ${toolName}`);
91
+ }
92
+ // Check if config is still valid, reload if needed
93
+ if (!config || !(await validateConfig(config))) {
94
+ log('Config is invalid, attempting to reload');
95
+ config = await loadConfig();
96
+ if (!config || !(await validateConfig(config))) {
97
+ throw new Error('OpenZiti configuration is invalid or missing. Please check ziti-cli login status.');
98
+ }
99
+ log('Successfully reloaded configuration');
100
+ }
101
+ // Add auth token to request
102
+ const requestWithToken = {
103
+ token: config.token,
104
+ parameters: request.params.arguments || {},
105
+ };
106
+ if (!config.zitiControllerHost) {
107
+ throw new Error('Error: ZITI_CONTROLLER_HOST environment variable is not set');
108
+ }
109
+ if (!config.domain) {
110
+ throw new Error('Error: ZITI_DOMAIN environment variable is not set');
111
+ }
112
+ const zitiControllerHost = formatDomain(config.zitiControllerHost);
113
+ const domain = formatDomain(config.domain);
114
+ // Execute handler
115
+ log(`Executing handler for tool: ${toolName}`);
116
+ const result = await HANDLERS[toolName](requestWithToken, {
117
+ zitiControllerHost: zitiControllerHost,
118
+ domain: domain,
119
+ });
120
+ log(`Handler execution completed for: ${toolName}`);
121
+ return {
122
+ content: result.content,
123
+ isError: result.isError || false,
124
+ };
125
+ }
126
+ catch (error) {
127
+ log(`Error handling tool call: ${error instanceof Error ? error.message : String(error)}`);
128
+ return {
129
+ content: [
130
+ {
131
+ type: 'text',
132
+ text: `Error: ${error instanceof Error ? error.message : String(error)}`,
133
+ },
134
+ ],
135
+ isError: true,
136
+ };
137
+ }
138
+ });
139
+ // Connect to transport
140
+ log('Creating stdio transport...');
141
+ const transport = new StdioServerTransport();
142
+ // Connection with timeout
143
+ log('Connecting server to transport...');
144
+ try {
145
+ await Promise.race([
146
+ server.connect(transport),
147
+ new Promise((_, reject) => setTimeout(() => reject(new Error('Connection timeout')), 5000)),
148
+ ]);
149
+ // Log server start information
150
+ const enabledToolsCount = availableTools.length;
151
+ const totalToolsCount = TOOLS.length;
152
+ const logMsg = `OpenZiti MCP Server version ${packageVersion} running on stdio with ${enabledToolsCount}/${totalToolsCount} tools available`;
153
+ logInfo(logMsg);
154
+ log(logMsg);
155
+ server.sendLoggingMessage({ level: 'info', data: logMsg });
156
+ return server;
157
+ }
158
+ catch (connectError) {
159
+ log(`Transport connection error: ${connectError instanceof Error ? connectError.message : String(connectError)}`);
160
+ if (connectError instanceof Error && connectError.message === 'Connection timeout') {
161
+ log('Connection to transport timed out. This might indicate an issue with the stdio transport.');
162
+ }
163
+ throw connectError;
164
+ }
165
+ }
166
+ catch (error) {
167
+ log('Error starting server:', error);
168
+ throw error;
169
+ }
170
+ }
171
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAA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AO,YAAY,EAAE,CAAC;YACtB,GAAG,CACD,+BAA+B,YAAY,YAAY,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAC7G,CAAC;YACF,IAAI,YAAY,YAAY,KAAK,IAAI,YAAY,CAAC,OAAO,KAAK,oBAAoB,EAAE,CAAC;gBACnF,GAAG,CACD,2FAA2F,CAC5F,CAAC;YACJ,CAAC;YACD,MAAM,YAAY,CAAC;QACrB,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;QACrC,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { HandlerConfig, HandlerRequest, HandlerResponse, Tool } from '../utils/types.js';
2
+ export declare const API_SESSION_TOOLS: Tool[];
3
+ export declare const API_SESSION_HANDLERS: Record<string, (request: HandlerRequest, config: HandlerConfig) => Promise<HandlerResponse>>;
@@ -0,0 +1,86 @@
1
+ import { createErrorResponse } from '../utils/http-utility.js';
2
+ import { withAuthenticatedClient } from '../utils/authenticated-client.js';
3
+ import { listApiSessions, detailApiSessions, deleteApiSessions, } from '../utils/controller-client/sdk.gen.js';
4
+ // Define all available API Session tools
5
+ export const API_SESSION_TOOLS = [
6
+ {
7
+ name: 'listApiSessions',
8
+ description: 'List all API Sessions in the Ziti network',
9
+ inputSchema: {
10
+ type: 'object',
11
+ properties: {},
12
+ },
13
+ _meta: {
14
+ requiredScopes: ['read:api-sessions'],
15
+ readOnly: true,
16
+ },
17
+ annotations: {
18
+ title: 'List all API Sessions in the Ziti network.',
19
+ readOnlyHint: true,
20
+ destructiveHint: false,
21
+ idempotentHint: true,
22
+ openWorldHint: false,
23
+ },
24
+ },
25
+ {
26
+ name: 'listApiSession',
27
+ description: 'Get details about a specific Ziti API Session',
28
+ inputSchema: {
29
+ type: 'object',
30
+ properties: {
31
+ id: { type: 'string', description: 'ID of the API session to retrieve' },
32
+ },
33
+ required: ['id'],
34
+ },
35
+ _meta: {
36
+ requiredScopes: ['read:api-sessions'],
37
+ readOnly: true,
38
+ },
39
+ annotations: {
40
+ title: 'Get Ziti API Session Details',
41
+ readOnlyHint: true,
42
+ destructiveHint: false,
43
+ idempotentHint: true,
44
+ openWorldHint: false,
45
+ },
46
+ },
47
+ {
48
+ name: 'deleteApiSession',
49
+ description: 'Delete a Ziti API Session.',
50
+ inputSchema: {
51
+ type: 'object',
52
+ properties: {
53
+ id: { type: 'string', description: 'ID of the API session to delete' },
54
+ },
55
+ required: ['id'],
56
+ },
57
+ _meta: {
58
+ requiredScopes: ['write:api-sessions'],
59
+ readOnly: false,
60
+ },
61
+ annotations: {
62
+ title: 'Delete an API Session from the Ziti network.',
63
+ readOnlyHint: false,
64
+ destructiveHint: true,
65
+ idempotentHint: false,
66
+ openWorldHint: false,
67
+ },
68
+ },
69
+ ];
70
+ // Define handlers for each API Session tool
71
+ export const API_SESSION_HANDLERS = {
72
+ listApiSessions: (request, config) => withAuthenticatedClient(request, config, 'list API sessions', (client, ztSession) => listApiSessions({ client, headers: { 'zt-session': ztSession } })),
73
+ listApiSession: (request, config) => {
74
+ const { id } = request.parameters;
75
+ if (!id)
76
+ return Promise.resolve(createErrorResponse('Error: id is required'));
77
+ return withAuthenticatedClient(request, config, 'get API session', (client, ztSession) => detailApiSessions({ path: { id }, client, headers: { 'zt-session': ztSession } }));
78
+ },
79
+ deleteApiSession: (request, config) => {
80
+ const { id } = request.parameters;
81
+ if (!id)
82
+ return Promise.resolve(createErrorResponse('Error: id is required'));
83
+ return withAuthenticatedClient(request, config, 'delete API session', (client, ztSession) => deleteApiSessions({ path: { id }, client, headers: { 'zt-session': ztSession } }));
84
+ },
85
+ };
86
+ //# sourceMappingURL=api-sessions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-sessions.js","sourceRoot":"","sources":["../../src/tools/api-sessions.ts"],"names":[],"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AC,EAAE;YAAE,OAAO,OAAO,CAAC,OAAO,CAAC,mBAAmB,CAAC,uBAAuB,CAAC,CAAC,CAAC;QAC9E,OAAO,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,CAC1F,iBAAiB,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,CAAC,CAClF,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { HandlerConfig, HandlerRequest, HandlerResponse, Tool } from '../utils/types.js';
2
+ export declare const AUTH_POLICY_TOOLS: Tool[];
3
+ export declare const AUTH_POLICY_HANDLERS: Record<string, (request: HandlerRequest, config: HandlerConfig) => Promise<HandlerResponse>>;