mcp-server-esa 1.0.7 → 1.0.9

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 (36) hide show
  1. package/dist/index.js +158 -1287
  2. package/dist/index.mjs +152 -1273
  3. package/dist/tools/{deploy.d.ts → er/deploy.d.ts} +0 -8
  4. package/dist/tools/{routine.d.ts → er/routine.d.ts} +8 -0
  5. package/dist/tools/list-esa-function.d.ts +81 -1
  6. package/dist/tools/site/certificate.d.ts +49 -0
  7. package/dist/tools/site/ipv6.d.ts +17 -0
  8. package/dist/tools/site/managedTransform.d.ts +17 -0
  9. package/dist/tools/site/record.d.ts +81 -0
  10. package/dist/tools/{site.d.ts → site/site.d.ts} +16 -8
  11. package/dist/utils/service.d.ts +17 -2
  12. package/package.json +1 -1
  13. package/readme.md +47 -23
  14. package/readme_zh.md +25 -2
  15. package/src/index.js +58 -0
  16. package/src/tools/{commit.ts → er/commit.ts} +2 -2
  17. package/src/tools/{deploy.ts → er/deploy.ts} +2 -49
  18. package/src/tools/{deployments.ts → er/deployments.ts} +1 -1
  19. package/src/tools/{record.ts → er/record.ts} +2 -2
  20. package/src/tools/{route.ts → er/route.ts} +2 -2
  21. package/src/tools/er/routine.ts +284 -0
  22. package/src/tools/list-esa-function.ts +131 -28
  23. package/src/tools/site/certificate.ts +257 -0
  24. package/src/tools/site/ipv6.ts +77 -0
  25. package/src/tools/site/managedTransform.ts +101 -0
  26. package/src/tools/site/record.ts +772 -0
  27. package/src/tools/site/site.ts +287 -0
  28. package/src/utils/service.ts +206 -6
  29. package/dist/index.d.ts +0 -2
  30. package/src/index.ts +0 -50
  31. package/src/tools/routine.ts +0 -131
  32. package/src/tools/site.ts +0 -209
  33. /package/dist/tools/{commit.d.ts → er/commit.d.ts} +0 -0
  34. /package/dist/tools/{deployments.d.ts → er/deployments.d.ts} +0 -0
  35. /package/dist/tools/{record.d.ts → er/record.d.ts} +0 -0
  36. /package/dist/tools/{route.d.ts → er/route.d.ts} +0 -0
package/dist/index.js CHANGED
@@ -1,6 +1,154 @@
1
- #!/usr/bin/env node
2
1
  "use strict";
3
- var __webpack_require__ = {};
2
+ var __webpack_modules__ = {
3
+ "./src/index.js": function(module, __webpack_exports__, __webpack_require__) {
4
+ __webpack_require__.a(module, async function(__webpack_handle_async_dependencies__, __webpack_async_result__) {
5
+ try {
6
+ __webpack_require__.r(__webpack_exports__);
7
+ var _modelcontextprotocol_sdk_server_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("@modelcontextprotocol/sdk/server/index.js");
8
+ var _modelcontextprotocol_sdk_server_stdio_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("@modelcontextprotocol/sdk/server/stdio.js");
9
+ var _modelcontextprotocol_sdk_types_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("@modelcontextprotocol/sdk/types.js");
10
+ const server = new _modelcontextprotocol_sdk_server_index_js__WEBPACK_IMPORTED_MODULE_0__.Server({
11
+ name: 'example-server',
12
+ version: '1.0.0'
13
+ }, {
14
+ capabilities: {
15
+ tools: {}
16
+ }
17
+ });
18
+ server.setRequestHandler(_modelcontextprotocol_sdk_types_js__WEBPACK_IMPORTED_MODULE_2__.ListToolsRequestSchema, async ()=>({
19
+ tools: [
20
+ {
21
+ name: 'calculate_sum',
22
+ description: 'Add two numbers together',
23
+ inputSchema: {
24
+ type: 'object',
25
+ properties: {
26
+ a: {
27
+ type: 'number'
28
+ },
29
+ b: {
30
+ type: 'number'
31
+ }
32
+ },
33
+ required: [
34
+ 'a',
35
+ 'b'
36
+ ]
37
+ }
38
+ }
39
+ ]
40
+ }));
41
+ server.setRequestHandler(_modelcontextprotocol_sdk_types_js__WEBPACK_IMPORTED_MODULE_2__.CallToolRequestSchema, async (request)=>{
42
+ if ('calculate_sum' === request.params.name) {
43
+ const { a, b } = request.params.arguments;
44
+ return {
45
+ content: [
46
+ {
47
+ type: 'text',
48
+ text: String(a + b)
49
+ }
50
+ ]
51
+ };
52
+ }
53
+ throw new Error('Tool not found');
54
+ });
55
+ const transport = new _modelcontextprotocol_sdk_server_stdio_js__WEBPACK_IMPORTED_MODULE_1__.StdioServerTransport();
56
+ await server.connect(transport);
57
+ __webpack_async_result__();
58
+ } catch (e) {
59
+ __webpack_async_result__(e);
60
+ }
61
+ }, 1);
62
+ },
63
+ "@modelcontextprotocol/sdk/server/index.js": function(module) {
64
+ module.exports = require("@modelcontextprotocol/sdk/server/index.js");
65
+ },
66
+ "@modelcontextprotocol/sdk/server/stdio.js": function(module) {
67
+ module.exports = require("@modelcontextprotocol/sdk/server/stdio.js");
68
+ },
69
+ "@modelcontextprotocol/sdk/types.js": function(module) {
70
+ module.exports = require("@modelcontextprotocol/sdk/types.js");
71
+ }
72
+ };
73
+ var __webpack_module_cache__ = {};
74
+ function __webpack_require__(moduleId) {
75
+ var cachedModule = __webpack_module_cache__[moduleId];
76
+ if (void 0 !== cachedModule) return cachedModule.exports;
77
+ var module = __webpack_module_cache__[moduleId] = {
78
+ exports: {}
79
+ };
80
+ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
81
+ return module.exports;
82
+ }
83
+ (()=>{
84
+ var webpackQueues = "function" == typeof Symbol ? Symbol("webpack queues") : "__webpack_queues__";
85
+ var webpackExports = "function" == typeof Symbol ? Symbol("webpack exports") : "__webpack_exports__";
86
+ var webpackError = "function" == typeof Symbol ? Symbol("webpack error") : "__webpack_error__";
87
+ var resolveQueue = (queue)=>{
88
+ if (queue && queue.d < 1) {
89
+ queue.d = 1;
90
+ queue.forEach((fn)=>fn.r--);
91
+ queue.forEach((fn)=>fn.r-- ? fn.r++ : fn());
92
+ }
93
+ };
94
+ var wrapDeps = (deps)=>deps.map((dep)=>{
95
+ if (null !== dep && "object" == typeof dep) {
96
+ if (dep[webpackQueues]) return dep;
97
+ if (dep.then) {
98
+ var queue = [];
99
+ queue.d = 0;
100
+ dep.then((r)=>{
101
+ obj[webpackExports] = r;
102
+ resolveQueue(queue);
103
+ }, (e)=>{
104
+ obj[webpackError] = e;
105
+ resolveQueue(queue);
106
+ });
107
+ var obj = {};
108
+ obj[webpackQueues] = (fn)=>fn(queue);
109
+ return obj;
110
+ }
111
+ }
112
+ var ret = {};
113
+ ret[webpackQueues] = function() {};
114
+ ret[webpackExports] = dep;
115
+ return ret;
116
+ });
117
+ __webpack_require__.a = (module, body, hasAwait)=>{
118
+ var queue;
119
+ hasAwait && ((queue = []).d = -1);
120
+ var depQueues = new Set();
121
+ var exports1 = module.exports;
122
+ var currentDeps;
123
+ var outerResolve;
124
+ var reject;
125
+ var promise = new Promise((resolve, rej)=>{
126
+ reject = rej;
127
+ outerResolve = resolve;
128
+ });
129
+ promise[webpackExports] = exports1;
130
+ promise[webpackQueues] = (fn)=>{
131
+ queue && fn(queue), depQueues.forEach(fn), promise["catch"](function() {});
132
+ };
133
+ module.exports = promise;
134
+ body((deps)=>{
135
+ currentDeps = wrapDeps(deps);
136
+ var fn;
137
+ var getResult = ()=>currentDeps.map((d)=>{
138
+ if (d[webpackError]) throw d[webpackError];
139
+ return d[webpackExports];
140
+ });
141
+ var promise = new Promise((resolve)=>{
142
+ fn = ()=>resolve(getResult);
143
+ fn.r = 0;
144
+ var fnQueue = (q)=>q !== queue && !depQueues.has(q) && (depQueues.add(q), q && !q.d && (fn.r++, q.push(fn)));
145
+ currentDeps.map((dep)=>dep[webpackQueues](fnQueue));
146
+ });
147
+ return fn.r ? promise : getResult();
148
+ }, (err)=>(err ? reject(promise[webpackError] = err) : outerResolve(exports1), resolveQueue(queue)));
149
+ queue && queue.d < 0 && (queue.d = 0);
150
+ };
151
+ })();
4
152
  (()=>{
5
153
  __webpack_require__.n = (module)=>{
6
154
  var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
@@ -21,1294 +169,17 @@ var __webpack_require__ = {};
21
169
  (()=>{
22
170
  __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
23
171
  })();
24
- var __webpack_exports__ = {};
25
- const index_js_namespaceObject = require("@modelcontextprotocol/sdk/server/index.js");
26
- const stdio_js_namespaceObject = require("@modelcontextprotocol/sdk/server/stdio.js");
27
- const types_js_namespaceObject = require("@modelcontextprotocol/sdk/types.js");
28
- const esa20240910_namespaceObject = require("@alicloud/esa20240910");
29
- var esa20240910_default = /*#__PURE__*/ __webpack_require__.n(esa20240910_namespaceObject);
30
- const openapi_client_namespaceObject = require("@alicloud/openapi-client");
31
- const tea_util_namespaceObject = require("@alicloud/tea-util");
32
- const external_form_data_namespaceObject = require("form-data");
33
- var external_form_data_default = /*#__PURE__*/ __webpack_require__.n(external_form_data_namespaceObject);
34
- const external_node_fetch_namespaceObject = require("node-fetch");
35
- var external_node_fetch_default = /*#__PURE__*/ __webpack_require__.n(external_node_fetch_namespaceObject);
36
- function log(...args) {
37
- const msg = `[DEBUG ${new Date().toISOString()}] ${args.join(' ')}\n`;
38
- process.stderr.write(msg);
39
- }
40
- const uploadCodeToOSS = async (res, code)=>{
41
- var _res_body;
42
- const ossConfig = null == res ? void 0 : null === (_res_body = res.body) || void 0 === _res_body ? void 0 : _res_body.ossPostConfig;
43
- if (200 !== res.statusCode || !ossConfig) return false;
44
- const { OSSAccessKeyId, Signature, callback, Url, key, policy } = ossConfig;
45
- const formData = new (external_form_data_default())();
46
- formData.append('OSSAccessKeyId', OSSAccessKeyId);
47
- formData.append('Signature', Signature);
48
- formData.append('callback', callback);
49
- formData.append("x:codeDescription", ossConfig["x:codeDescription"]);
50
- formData.append('policy', policy);
51
- formData.append('key', key);
52
- formData.append('file', code);
53
- const ossRes = await external_node_fetch_default()(Url, {
54
- method: 'POST',
55
- body: formData,
56
- headers: formData.getHeaders()
57
- });
58
- return ossRes && 200 === ossRes.status;
59
- };
60
- const RuleMatchTypeHost = 'http.host';
61
- const RuleMatchTypeUriPath = 'http.request.uri.path';
62
- const RuleMatchOperatorEq = "eq";
63
- const RuleMatchOperatorStartsWith = "starts_with";
64
- const RuleMatchOperatorEndsWith = "ends_with";
65
- const transferRouteToRuleString = (routePath)=>{
66
- if (!routePath) return '';
67
- const index = routePath.indexOf('/');
68
- let host = '';
69
- let uriPath = '';
70
- if (index < 0) {
71
- host = routePath;
72
- uriPath = '/';
73
- } else {
74
- host = routePath.substring(0, index);
75
- uriPath = routePath.substring(index);
76
- }
77
- let hostOperator = RuleMatchOperatorEq;
78
- if (host.startsWith('*')) {
79
- hostOperator = RuleMatchOperatorEndsWith;
80
- host = host.replace(/\*/g, '');
81
- }
82
- let uriPathOperator = RuleMatchOperatorEq;
83
- if (uriPath.endsWith('*')) {
84
- uriPathOperator = RuleMatchOperatorStartsWith;
85
- uriPath = uriPath.replace(/\*$/, '');
86
- }
87
- let ruleStr = '';
88
- if (hostOperator === RuleMatchOperatorEq) {
89
- if (uriPathOperator === RuleMatchOperatorEq) ruleStr = `(${RuleMatchTypeHost} ${hostOperator} "${host}" and ${RuleMatchTypeUriPath} ${uriPathOperator} "${uriPath}")`;
90
- else if (uriPathOperator === RuleMatchOperatorStartsWith) ruleStr = `(${RuleMatchTypeHost} ${hostOperator} "${host}" and ${RuleMatchOperatorStartsWith}(${RuleMatchTypeUriPath}, "${uriPath}"))`;
91
- } else if (hostOperator === RuleMatchOperatorEndsWith) {
92
- if (uriPathOperator === RuleMatchOperatorEq) ruleStr = `(${RuleMatchOperatorEndsWith}(${RuleMatchTypeHost}, "${host}") and ${RuleMatchTypeUriPath} ${uriPathOperator} "${uriPath}")`;
93
- else if (uriPathOperator === RuleMatchOperatorStartsWith) ruleStr = `(${RuleMatchOperatorEndsWith}(${RuleMatchTypeHost}, "${host}") and ${RuleMatchOperatorStartsWith}(${RuleMatchTypeUriPath}, "${uriPath}"))`;
94
- }
95
- return ruleStr;
96
- };
97
- function _define_property(obj, key, value) {
98
- if (key in obj) Object.defineProperty(obj, key, {
99
- value: value,
100
- enumerable: true,
101
- configurable: true,
102
- writable: true
103
- });
104
- else obj[key] = value;
105
- return obj;
106
- }
107
- class Client {
108
- static createClient(config) {
109
- var _config_auth, _config_auth1, _config_auth2;
110
- const apiConfig = new openapi_client_namespaceObject.Config({
111
- accessKeyId: (null === (_config_auth = config.auth) || void 0 === _config_auth ? void 0 : _config_auth.accessKeyId) || '',
112
- accessKeySecret: (null === (_config_auth1 = config.auth) || void 0 === _config_auth1 ? void 0 : _config_auth1.accessKeySecret) || '',
113
- securityToken: (null === (_config_auth2 = config.auth) || void 0 === _config_auth2 ? void 0 : _config_auth2.securityToken) || '',
114
- endpoint: config.endpoint
115
- });
116
- return new (esa20240910_default())(apiConfig);
117
- }
118
- createRoutine(params) {
119
- const request = new esa20240910_namespaceObject.CreateRoutineRequest(params);
120
- log('Creating routine with parameters:', JSON.stringify(params));
121
- return this.callApi(this.client.createRoutine.bind(this.client), request);
122
- }
123
- deleteRoutine(params) {
124
- const request = new esa20240910_namespaceObject.DeleteRoutineRequest(params);
125
- return this.callApi(this.client.deleteRoutineWithOptions.bind(this.client), request);
126
- }
127
- getRoutine(params) {
128
- const request = new esa20240910_namespaceObject.GetRoutineRequest(params);
129
- return this.callApi(this.client.getRoutineWithOptions.bind(this.client), request);
130
- }
131
- getRoutineUserInfo() {
132
- return this.callApi(this.client.getRoutineUserInfo.bind(this.client));
133
- }
134
- async getRoutineStagingCodeUploadInfo(params) {
135
- const request = new esa20240910_namespaceObject.GetRoutineStagingCodeUploadInfoRequest(params);
136
- return this.callApi(this.client.getRoutineStagingCodeUploadInfo.bind(this.client), request);
137
- }
138
- commitRoutineStagingCode(params) {
139
- const request = new esa20240910_namespaceObject.CommitRoutineStagingCodeRequest(params);
140
- return this.callApi(this.client.commitRoutineStagingCode.bind(this.client), request);
141
- }
142
- publishRoutineCodeVersion(params) {
143
- const request = new esa20240910_namespaceObject.PublishRoutineCodeVersionRequest(params);
144
- return this.callApi(this.client.publishRoutineCodeVersion.bind(this.client), request);
145
- }
146
- listRoutineCanaryAreas() {
147
- return this.callApi(this.client.listRoutineCanaryAreas.bind(this.client));
148
- }
149
- listSites(params) {
150
- const request = new esa20240910_namespaceObject.ListSitesRequest(params);
151
- return this.callApi(this.client.listSites.bind(this.client), request);
152
- }
153
- deleteRoutineCodeVersion(params) {
154
- const request = new esa20240910_namespaceObject.DeleteRoutineCodeVersionRequest(params);
155
- return this.callApi(this.client.deleteRoutineCodeVersion.bind(this.client), request);
156
- }
157
- createRoutineRelatedRecord(params) {
158
- const request = new esa20240910_namespaceObject.CreateRoutineRelatedRecordRequest(params);
159
- return this.callApi(this.client.createRoutineRelatedRecord.bind(this.client), request);
160
- }
161
- createRoutineRoute(params) {
162
- const request = new esa20240910_namespaceObject.CreateRoutineRouteRequest(params);
163
- return this.callApi(this.client.createRoutineRoute.bind(this.client), request);
164
- }
165
- deleteRoutineRoute(params) {
166
- const request = new esa20240910_namespaceObject.DeleteRoutineRouteRequest(params);
167
- return this.callApi(this.client.deleteRoutineRoute.bind(this.client), request);
168
- }
169
- getRoutineRoute(params) {
170
- const request = new esa20240910_namespaceObject.GetRoutineRouteRequest(params);
171
- return this.callApi(this.client.getRoutineRoute.bind(this.client), request);
172
- }
173
- listSiteRoutes(params) {
174
- const request = new esa20240910_namespaceObject.ListSiteRoutesRequest(params);
175
- return this.callApi(this.client.listSiteRoutes.bind(this.client), request);
176
- }
177
- listRoutineRoutes(params) {
178
- const request = new esa20240910_namespaceObject.ListRoutineRoutesRequest(params);
179
- return this.callApi(this.client.listRoutineRoutes.bind(this.client), request);
180
- }
181
- updateRoutineRoute(params) {
182
- const request = new esa20240910_namespaceObject.UpdateRoutineRouteRequest(params);
183
- return this.callApi(this.client.updateRoutineRoute.bind(this.client), request);
184
- }
185
- deleteRoutineRelatedRecord(params) {
186
- const request = new esa20240910_namespaceObject.DeleteRoutineRelatedRecordRequest(params);
187
- return this.callApi(this.client.deleteRoutineRelatedRecord.bind(this.client), request);
188
- }
189
- getMatchSite(requestParams) {
190
- const params = {
191
- action: 'GetMatchSite',
192
- version: '2024-09-10',
193
- protocol: 'https',
194
- method: 'GET',
195
- authType: 'AK',
196
- bodyType: 'json',
197
- reqBodyType: 'json',
198
- style: 'RPC',
199
- pathname: '/',
200
- toMap: function() {
201
- return this;
202
- }
203
- };
204
- const request = new openapi_client_namespaceObject.OpenApiRequest({
205
- query: {
206
- RecordName: requestParams.recordName
207
- }
208
- });
209
- const runtime = {
210
- toMap: function() {
211
- return this;
212
- }
213
- };
214
- return this.client.callApi(params, request, runtime);
215
- }
216
- listRoutineRelatedRecords(requestParams) {
217
- const params = {
218
- action: 'ListRoutineRelatedRecords',
219
- version: '2024-09-10',
220
- protocol: 'https',
221
- method: 'GET',
222
- authType: 'AK',
223
- bodyType: 'json',
224
- reqBodyType: 'json',
225
- style: 'RPC',
226
- pathname: '/',
227
- toMap: function() {
228
- return this;
229
- }
230
- };
231
- const request = new openapi_client_namespaceObject.OpenApiRequest({
232
- query: {
233
- Name: requestParams.Name,
234
- PageNumber: requestParams.PageNumber,
235
- PageSize: requestParams.PageSize,
236
- SearchKeyWord: requestParams.SearchKeyWord
237
- }
238
- });
239
- const runtime = {
240
- toMap: function() {
241
- return this;
242
- }
243
- };
244
- return this.client.callApi(params, request, runtime);
245
- }
246
- createRecord(params) {
247
- const request = new esa20240910_namespaceObject.CreateRecordRequest(params);
248
- return this.callApi(this.client.createRecord.bind(this.client), request);
249
- }
250
- listRecords(params) {
251
- const request = new esa20240910_namespaceObject.ListRecordsRequest(params);
252
- return this.callApi(this.client.listRecords.bind(this.client), request);
253
- }
254
- constructor(){
255
- _define_property(this, "client", void 0);
256
- _define_property(this, "callApi", async (action, request)=>{
257
- const runtime = new tea_util_namespaceObject.RuntimeOptions({
258
- connectTimeout: 10000,
259
- readTimeout: 10000,
260
- autoretry: true,
261
- maxAttempts: 3
262
- });
263
- const response = request ? await action(request, runtime) : await action(runtime);
264
- return response;
265
- });
266
- const config = {
267
- auth: {
268
- accessKeyId: process.env.ALIBABA_CLOUD_ACCESS_KEY_ID || '',
269
- accessKeySecret: process.env.ALIBABA_CLOUD_ACCESS_KEY_SECRET || '',
270
- securityToken: process.env.ALIBABA_CLOUD_SECURITY_TOKEN
271
- },
272
- endpoint: 'esa.cn-hangzhou.aliyuncs.com'
273
- };
274
- this.client = Client.createClient(config);
275
- }
276
- }
277
- const service = new Client();
278
- const ROUTINE_CODE_COMMIT_TOOL = {
279
- name: 'routine_code_commit',
280
- description: 'Save a code version for future modifications or release within an Edge Routine (ER).',
281
- inputSchema: {
282
- type: 'object',
283
- properties: {
284
- name: {
285
- type: 'string',
286
- description: 'The name of the routine, support lowercase English, numbers, and hyphens, must start with lowercase English, length cannot be less than 2 characters'
287
- },
288
- description: {
289
- type: 'string',
290
- description: "Description of the routine, no spaces"
291
- },
292
- code: {
293
- type: 'string',
294
- description: 'Source Code of the routine, export default { async fetch(request) { return handleRequest(request); } }'
295
- }
296
- },
297
- required: [
298
- 'name',
299
- 'code'
300
- ]
301
- }
302
- };
303
- const routine_code_commit = async (request)=>{
304
- const res = await service.getRoutineStagingCodeUploadInfo(request.params.arguments);
305
- if (!res) return {
306
- content: [
307
- {
308
- type: 'text',
309
- text: `Failed to get routine staging code upload info. ${JSON.stringify(res)}`
310
- }
311
- ],
312
- success: false
313
- };
314
- {
315
- var _request_params_arguments, _request_params;
316
- const uploadRes = await uploadCodeToOSS(res, null == request ? void 0 : null === (_request_params = request.params) || void 0 === _request_params ? void 0 : null === (_request_params_arguments = _request_params.arguments) || void 0 === _request_params_arguments ? void 0 : _request_params_arguments.code);
317
- if (true !== uploadRes) return {
318
- content: [
319
- {
320
- type: 'text',
321
- text: `Failed to upload code to OSS. ${uploadRes}`
322
- }
323
- ],
324
- success: false
325
- };
326
- {
327
- const commitRes = await service.commitRoutineStagingCode(request.params.arguments);
328
- if (200 !== commitRes.statusCode) return {
329
- content: [
330
- {
331
- type: 'text',
332
- text: `Failed to commit routine staging code. ${JSON.stringify(commitRes)}`
333
- }
334
- ],
335
- success: false
336
- };
337
- return {
338
- content: [
339
- {
340
- type: 'text',
341
- text: JSON.stringify(commitRes)
342
- }
343
- ],
344
- success: true
345
- };
346
- }
347
- }
348
- };
349
- const ROUTINE_CODE_DEPLOY_TOOL = {
350
- name: 'routine_code_deploy',
351
- description: 'Deploy a selected code version to the staging or production environment. If version is not exist, should call routine_code_commit first',
352
- inputSchema: {
353
- type: 'object',
354
- properties: {
355
- name: {
356
- type: 'string',
357
- description: 'The name of the routine, support lowercase English, numbers, and hyphens, must start with lowercase English, length cannot be less than 2 characters'
358
- },
359
- codeVersion: {
360
- type: 'string',
361
- description: 'Version of the routine, must be a valid semantic version'
362
- },
363
- env: {
364
- type: 'string',
365
- description: 'Environment of the routine, must be "production" or "staging". If the user has no special requirements, it will be deployed to the production environment by default'
366
- },
367
- canaryAreaList: {
368
- type: 'array',
369
- description: 'The regions for canary release, must be a valid region name. Need to call ListRoutineCanaryAreas method to get'
370
- },
371
- canaryCodeVersion: {
372
- type: 'string',
373
- description: 'Version of the routine, must be a valid semantic version'
374
- }
375
- },
376
- required: [
377
- 'name',
378
- 'codeVersion',
379
- 'env'
380
- ]
381
- }
382
- };
383
- const CANARY_AREA_LIST = {
384
- name: 'canary_area_list',
385
- description: 'List all available canary areas for routine deployment',
386
- inputSchema: {
387
- type: 'object',
388
- properties: {}
389
- }
390
- };
391
- const routine_code_deploy = async (request)=>{
392
- const res = await service.publishRoutineCodeVersion(request.params.arguments);
393
- if (!res) return {
394
- content: [
395
- {
396
- type: 'text',
397
- text: `Failed to publish routine code version. ${JSON.stringify(res)}`
398
- }
399
- ],
400
- success: false
401
- };
402
- return {
403
- content: [
404
- {
405
- type: 'text',
406
- text: JSON.stringify(res)
407
- }
408
- ],
409
- success: true
410
- };
411
- };
412
- const canary_area_list = async ()=>{
413
- const res = await service.listRoutineCanaryAreas();
414
- if (200 !== res.statusCode) return {
415
- content: [
416
- {
417
- type: 'text',
418
- text: `Failed to list canary areas. ${JSON.stringify(res)}`
419
- }
420
- ],
421
- success: false
422
- };
423
- var _res_body;
424
- return {
425
- content: [
426
- {
427
- type: 'text',
428
- text: JSON.stringify((null === (_res_body = res.body) || void 0 === _res_body ? void 0 : _res_body.canaryAreas) || [])
429
- }
430
- ],
431
- success: true
432
- };
433
- };
434
- const DEPLOYMENT_DELETE_TOOL = {
435
- name: 'deployment_delete',
436
- description: 'Delete a specified code version associated with an Edge Routine (ER).',
437
- inputSchema: {
438
- type: 'object',
439
- properties: {
440
- name: {
441
- type: 'string',
442
- description: 'The name of the deployment to delete'
443
- },
444
- codeVersion: {
445
- type: 'string',
446
- description: 'The version of the code to delete'
447
- }
448
- },
449
- required: [
450
- 'name',
451
- 'codeVersion'
452
- ]
453
- }
454
- };
455
- const deployment_delete = async (request)=>{
456
- const res = await service.deleteRoutineCodeVersion(request.params.arguments);
457
- return {
458
- content: [
459
- {
460
- type: 'text',
461
- text: JSON.stringify(res)
462
- }
463
- ],
464
- success: true
465
- };
466
- };
467
- const ER_RECORD_CREATE_TOOL = {
468
- name: 'er_record_create',
469
- description: 'Create a new record associated with an Edge Routine (ER)',
470
- inputSchema: {
471
- type: 'object',
472
- properties: {
473
- name: {
474
- type: 'string',
475
- description: 'The name of the routine'
476
- },
477
- siteId: {
478
- type: 'number',
479
- description: 'The ID of the site'
480
- },
481
- recordName: {
482
- type: 'string',
483
- description: 'The name of the record'
484
- }
485
- },
486
- required: [
487
- 'name',
488
- 'siteId',
489
- 'recordName'
490
- ]
491
- }
492
- };
493
- const ER_RECORD_DELETE_TOOL = {
494
- name: 'er_record_delete',
495
- description: 'Delete a specified record associated with an Edge Routine (ER).',
496
- inputSchema: {
497
- type: 'object',
498
- properties: {
499
- name: {
500
- type: 'string',
501
- description: 'The name of the routine'
502
- },
503
- recordId: {
504
- type: 'number',
505
- description: 'The ID of the record'
506
- },
507
- siteId: {
508
- type: 'number',
509
- description: 'The ID of the site'
510
- },
511
- recordName: {
512
- type: 'string',
513
- description: 'The name of the record'
514
- }
515
- },
516
- required: [
517
- 'name',
518
- 'siteId',
519
- 'recordName'
520
- ]
521
- }
522
- };
523
- const ER_RECORD_LIST_TOOL = {
524
- name: 'er_record_list',
525
- description: 'List all records associated with a specific Edge Routine (ER).',
526
- inputSchema: {
527
- type: 'object',
528
- properties: {
529
- Name: {
530
- type: 'string',
531
- description: 'The name of the routine'
532
- },
533
- PageNumber: {
534
- type: 'number',
535
- description: 'The page number of the records'
536
- },
537
- PageSize: {
538
- type: 'number',
539
- description: 'The page size of the records'
540
- },
541
- SearchKeyWord: {
542
- type: 'string',
543
- description: 'The search key word of the records'
544
- }
545
- },
546
- required: [
547
- 'Name'
548
- ]
549
- }
550
- };
551
- const er_record_create = async (request)=>{
552
- const res = await service.createRoutineRelatedRecord(request.params.arguments);
553
- return {
554
- content: [
555
- {
556
- type: 'text',
557
- text: JSON.stringify(res)
558
- }
559
- ],
560
- success: true
561
- };
562
- };
563
- const er_record_delete = async (request)=>{
564
- const res = await service.deleteRoutineRelatedRecord(request.params.arguments);
565
- return {
566
- content: [
567
- {
568
- type: 'text',
569
- text: JSON.stringify(res)
570
- }
571
- ],
572
- success: true
573
- };
574
- };
575
- const er_record_list = async (request)=>{
576
- const res = await service.listRoutineRelatedRecords(request.params.arguments);
577
- return {
578
- content: [
579
- {
580
- type: 'text',
581
- text: JSON.stringify(res)
582
- }
583
- ],
584
- success: true
585
- };
586
- };
587
- const ROUTE_CREATE_TOOL = {
588
- name: 'route_create',
589
- description: 'Create a new route associated with an Edge Routine (ER).',
590
- inputSchema: {
591
- type: 'object',
592
- properties: {
593
- siteId: {
594
- type: 'number',
595
- description: 'The ID of the site'
596
- },
597
- mode: {
598
- type: 'enum',
599
- enum: [
600
- 'simple',
601
- 'custom'
602
- ],
603
- description: 'The mode of the route, default is simple'
604
- },
605
- route: {
606
- type: 'string',
607
- description: 'The route of the route, if mode is simple, this field is required. For example: test.example.com/*'
608
- },
609
- rule: {
610
- type: 'string',
611
- description: 'The rule of the route, if mode is custom, this field is required'
612
- },
613
- routineName: {
614
- type: 'string',
615
- description: 'The name of the routine'
616
- },
617
- routeName: {
618
- type: 'string',
619
- description: 'The name of the route, use to identify the route. For example: test-route'
620
- },
621
- bypass: {
622
- type: 'enum',
623
- enum: [
624
- 'on',
625
- 'off'
626
- ],
627
- description: 'The bypass of the route, default is off'
628
- },
629
- routeEnable: {
630
- type: 'enum',
631
- enum: [
632
- 'on',
633
- 'off'
634
- ],
635
- description: 'The enable of the route, default is on'
636
- },
637
- sequence: {
638
- type: 'number',
639
- description: 'The sequence of the route, if not passed, default is the current number of routes'
640
- }
641
- },
642
- required: [
643
- 'siteId',
644
- 'mode',
645
- 'rule',
646
- 'routineName',
647
- 'routeName',
648
- 'bypass',
649
- 'routeEnable'
650
- ]
651
- }
652
- };
653
- const ROUTE_UPDATE_TOOL = {
654
- name: 'route_update',
655
- description: 'Modify the configuration of an existing Edge Routine route.',
656
- inputSchema: {
657
- type: 'object',
658
- properties: {
659
- siteId: {
660
- type: 'number',
661
- description: 'The ID of the site'
662
- },
663
- configId: {
664
- type: 'number',
665
- description: 'The ID of the config'
666
- },
667
- routeName: {
668
- type: 'string',
669
- description: 'The name of the route, use to identify the route.'
670
- },
671
- routeEnable: {
672
- type: 'enum',
673
- enum: [
674
- 'on',
675
- 'off'
676
- ],
677
- description: 'The enable of the route'
678
- },
679
- rule: {
680
- type: 'string',
681
- description: 'The rule of the route'
682
- },
683
- routineName: {
684
- type: 'string',
685
- description: 'The name of the routine'
686
- },
687
- bypass: {
688
- type: 'enum',
689
- enum: [
690
- 'on',
691
- 'off'
692
- ],
693
- description: 'The bypass of the route '
694
- },
695
- sequence: {
696
- type: 'number',
697
- description: 'The sequence of the route, if not passed, default is the current number of routes'
698
- }
699
- },
700
- required: [
701
- 'siteId',
702
- 'configId',
703
- 'routeName',
704
- 'routeEnable',
705
- 'rule',
706
- 'routineName',
707
- 'bypass'
708
- ]
709
- }
710
- };
711
- const ROUTE_DELETE_TOOL = {
712
- name: 'route_delete',
713
- description: 'Delete a specified route associated with an Edge Routine (ER).',
714
- inputSchema: {
715
- type: 'object',
716
- properties: {
717
- siteId: {
718
- type: 'number',
719
- description: 'The ID of the site'
720
- },
721
- configId: {
722
- type: 'number',
723
- description: 'The ID of the config'
724
- }
725
- },
726
- required: [
727
- 'siteId',
728
- 'configId'
729
- ]
730
- }
731
- };
732
- const ROUTE_GET_TOOL = {
733
- name: 'route_get',
734
- description: 'Get details of a specific route associated with an Edge Routine (ER).',
735
- inputSchema: {
736
- type: 'object',
737
- properties: {
738
- siteId: {
739
- type: 'number',
740
- description: 'The ID of the site'
741
- },
742
- configId: {
743
- type: 'number',
744
- description: 'The ID of the config'
745
- }
746
- },
747
- required: [
748
- 'siteId',
749
- 'configId'
750
- ]
751
- }
752
- };
753
- const ROUTINE_ROUTE_LIST_TOOL = {
754
- name: 'routine_route_list',
755
- description: 'List all routes associated with a specific Edge Routine (ER).',
756
- inputSchema: {
757
- type: 'object',
758
- properties: {
759
- routineName: {
760
- type: 'string',
761
- description: 'The name of the routine'
762
- },
763
- routeName: {
764
- type: 'string',
765
- description: 'The name of the route, use to filter list results'
766
- },
767
- pageNumber: {
768
- type: 'number',
769
- description: 'The page number of the routes'
770
- },
771
- pageSize: {
772
- type: 'number',
773
- description: 'The page size of the routes'
774
- }
775
- },
776
- required: [
777
- 'routineName'
778
- ]
779
- }
780
- };
781
- const SITE_ROUTE_LIST_TOOL = {
782
- name: 'site_route_list',
783
- description: 'List all routes associated with a specific site.',
784
- inputSchema: {
785
- type: 'object',
786
- properties: {
787
- siteId: {
788
- type: 'number',
789
- description: 'The ID of the site'
790
- },
791
- routeName: {
792
- type: 'string',
793
- description: 'The name of the route, use to filter list results'
794
- },
795
- pageNumber: {
796
- type: 'number',
797
- description: 'The page number of the routes'
798
- },
799
- pageSize: {
800
- type: 'number',
801
- description: 'The page size of the routes'
802
- }
803
- },
804
- required: [
805
- 'siteId'
806
- ]
807
- }
808
- };
809
- const route_create = async (request)=>{
810
- const { mode, route } = request.params.arguments;
811
- if ('simple' === mode) {
812
- const res = await service.createRoutineRoute({
813
- ...request.params.arguments,
814
- rule: transferRouteToRuleString(route)
172
+ (()=>{
173
+ __webpack_require__.r = (exports1)=>{
174
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
175
+ value: 'Module'
815
176
  });
816
- return {
817
- content: [
818
- {
819
- type: 'text',
820
- text: JSON.stringify(res)
821
- }
822
- ],
823
- success: true
824
- };
825
- }
826
- {
827
- const res = await service.createRoutineRoute(request.params.arguments);
828
- return {
829
- content: [
830
- {
831
- type: 'text',
832
- text: JSON.stringify(res)
833
- }
834
- ],
835
- success: true
836
- };
837
- }
838
- };
839
- const route_delete = async (request)=>{
840
- const res = await service.deleteRoutineRoute(request.params.arguments);
841
- return {
842
- content: [
843
- {
844
- type: 'text',
845
- text: JSON.stringify(res)
846
- }
847
- ],
848
- success: true
849
- };
850
- };
851
- const route_update = async (request)=>{
852
- const { mode, route } = request.params.arguments;
853
- if ('simple' === mode) {
854
- const res = await service.updateRoutineRoute({
855
- ...request.params.arguments,
856
- rule: transferRouteToRuleString(route)
177
+ Object.defineProperty(exports1, '__esModule', {
178
+ value: true
857
179
  });
858
- return {
859
- content: [
860
- {
861
- type: 'text',
862
- text: JSON.stringify(res)
863
- }
864
- ],
865
- success: true
866
- };
867
- }
868
- {
869
- const res = await service.updateRoutineRoute(request.params.arguments);
870
- return {
871
- content: [
872
- {
873
- type: 'text',
874
- text: JSON.stringify(res)
875
- }
876
- ],
877
- success: true
878
- };
879
- }
880
- };
881
- const route_get = async (request)=>{
882
- const res = await service.getRoutineRoute(request.params.arguments);
883
- return {
884
- content: [
885
- {
886
- type: 'text',
887
- text: JSON.stringify(res)
888
- }
889
- ],
890
- success: true
891
- };
892
- };
893
- const routine_route_list = async (request)=>{
894
- const res = await service.listRoutineRoutes(request.params.arguments);
895
- return {
896
- content: [
897
- {
898
- type: 'text',
899
- text: JSON.stringify(res)
900
- }
901
- ],
902
- success: true
903
- };
904
- };
905
- const site_route_list = async (request)=>{
906
- const res = await service.listSiteRoutes(request.params.arguments);
907
- return {
908
- content: [
909
- {
910
- type: 'text',
911
- text: JSON.stringify(res)
912
- }
913
- ],
914
- success: true
915
- };
916
- };
917
- const ROUTINE_CREATE_TOOL = {
918
- name: 'routine_create',
919
- description: 'Create a new Edge Routine (ER) in your Alibaba Cloud account.',
920
- inputSchema: {
921
- type: 'object',
922
- properties: {
923
- name: {
924
- type: 'string',
925
- description: 'The name of the routine, support lowercase English, numbers, and hyphens, must start with lowercase English, length cannot be less than 2 characters'
926
- },
927
- description: {
928
- type: 'string',
929
- description: "Description of the routine, no spaces"
930
- },
931
- code: {
932
- type: 'string',
933
- description: 'Source Code of the routine, export default { async fetch(request) { return handleRequest(request); } }'
934
- }
935
- },
936
- required: [
937
- 'name',
938
- 'code'
939
- ]
940
- }
941
- };
942
- const ROUTINE_DELETE_TOOL = {
943
- name: 'routine_delete',
944
- description: 'Delete an existing Edge Routine (ER) from your Alibaba Cloud account.',
945
- inputSchema: {
946
- type: 'object',
947
- properties: {
948
- name: {
949
- type: 'string',
950
- description: 'The name of the routine to delete'
951
- }
952
- },
953
- required: [
954
- 'name'
955
- ]
956
- }
957
- };
958
- const ROUTINE_LIST_TOOL = {
959
- name: 'routine_list',
960
- description: 'List all Edge Routines (ERs) in your Alibaba Cloud account.',
961
- inputSchema: {
962
- type: 'object',
963
- properties: {}
964
- }
965
- };
966
- const ROUTINE_GET_TOOL = {
967
- name: 'routine_get',
968
- description: 'Get a the details of a Edge Routine (ER).',
969
- inputSchema: {
970
- type: 'object',
971
- properties: {
972
- name: {
973
- type: 'string',
974
- description: 'The name of the routine to get details for'
975
- }
976
- },
977
- required: [
978
- 'name'
979
- ]
980
- }
981
- };
982
- const routine_create = async (request)=>{
983
- const res = await service.createRoutine(request.params.arguments);
984
- return {
985
- content: [
986
- {
987
- type: 'text',
988
- text: JSON.stringify(res)
989
- }
990
- ],
991
- success: true
992
- };
993
- };
994
- const routine_delete = async (request)=>{
995
- const res = await service.deleteRoutine(request.params.arguments);
996
- return {
997
- content: [
998
- {
999
- type: 'text',
1000
- text: JSON.stringify(res)
1001
- }
1002
- ],
1003
- success: true
1004
- };
1005
- };
1006
- const routine_list = async ()=>{
1007
- const res = await service.getRoutineUserInfo();
1008
- return {
1009
- content: [
1010
- {
1011
- type: 'text',
1012
- text: JSON.stringify(res)
1013
- }
1014
- ],
1015
- success: true
1016
- };
1017
- };
1018
- const routine_get = async (request)=>{
1019
- const res = await service.getRoutine(request.params.arguments);
1020
- return {
1021
- content: [
1022
- {
1023
- type: 'text',
1024
- text: JSON.stringify(res)
1025
- }
1026
- ],
1027
- success: true
1028
- };
1029
- };
1030
- const SITE_ACTIVE_LIST_TOOL = {
1031
- name: 'site_active_list',
1032
- description: 'List all active sites',
1033
- inputSchema: {
1034
- type: 'object',
1035
- properties: {}
1036
- }
1037
- };
1038
- const SITE_MATCH_TOOL = {
1039
- name: 'site_match',
1040
- description: 'Identify which site in the account matches the provided input criteria.',
1041
- inputSchema: {
1042
- type: 'object',
1043
- properties: {
1044
- recordName: {
1045
- type: 'string',
1046
- description: 'The name of the site to match'
1047
- }
1048
- },
1049
- required: [
1050
- 'recordName'
1051
- ]
1052
- }
1053
- };
1054
- const SITE_DNS_A_RECORD_CREATE_TOOL = {
1055
- name: 'site_dns_a_record_create',
1056
- description: 'Create an A DNS record for a specified site.',
1057
- inputSchema: {
1058
- type: 'object',
1059
- properties: {
1060
- recordName: {
1061
- type: 'string',
1062
- description: 'The name of the DNS record (e.g., subdomain or full domain). Required.',
1063
- examples: [
1064
- 'www.example.com',
1065
- 'sub.example.com'
1066
- ]
1067
- },
1068
- siteId: {
1069
- type: 'number',
1070
- description: 'The ID of the site, obtained from the ListSites operation. Required.',
1071
- examples: [
1072
- 1234567890123
1073
- ]
1074
- },
1075
- data: {
1076
- type: 'object',
1077
- description: 'The data for the DNS record, varying by record type. Required.',
1078
- properties: {
1079
- value: {
1080
- type: 'string',
1081
- description: 'The IP address of the A record. Required.',
1082
- examples: [
1083
- '2.2.2.2'
1084
- ]
1085
- }
1086
- }
1087
- }
1088
- },
1089
- required: [
1090
- 'recordName',
1091
- 'siteId',
1092
- 'data'
1093
- ]
1094
- }
1095
- };
1096
- const SITE_DNS_CNAME_RECORD_CREATE_TOOL = {
1097
- name: 'site_dns_cname_record_create',
1098
- description: 'Create a CNAME DNS record for a specified site.',
1099
- inputSchema: {
1100
- type: 'object',
1101
- properties: {
1102
- recordName: {
1103
- type: 'string',
1104
- description: 'The name of the DNS record (e.g., subdomain or full domain). Required.',
1105
- examples: [
1106
- 'www.example.com',
1107
- 'sub.example.com'
1108
- ]
1109
- },
1110
- siteId: {
1111
- type: 'number',
1112
- description: 'The ID of the site, obtained from the ListSites operation. Required.',
1113
- examples: [
1114
- 1234567890123
1115
- ]
1116
- },
1117
- data: {
1118
- type: 'object',
1119
- description: 'The data for the DNS record, varying by record type. Required.',
1120
- properties: {
1121
- value: {
1122
- type: 'string',
1123
- description: 'The IP address of the A record. Required.',
1124
- examples: [
1125
- '2.2.2.2'
1126
- ]
1127
- }
1128
- }
1129
- }
1130
- },
1131
- required: [
1132
- 'recordName',
1133
- 'siteId',
1134
- 'data'
1135
- ]
1136
- }
1137
- };
1138
- const SITE_RECORD_LIST_TOOL = {
1139
- name: 'site_record_list',
1140
- description: 'List DNS records associated with a specific site.',
1141
- inputSchema: {
1142
- type: 'object',
1143
- properties: {
1144
- SiteId: {
1145
- type: 'number',
1146
- description: 'The ID of the site, obtained from the ListSites operation. Required.'
1147
- }
1148
- }
1149
- }
1150
- };
1151
- const site_dns_a_record_create = async (request)=>{
1152
- const res = await service.createRecord({
1153
- ttl: 1,
1154
- proxied: true,
1155
- bizName: 'web',
1156
- type: 'A/AAAA',
1157
- ...request.params.arguments
1158
- });
1159
- return {
1160
- content: [
1161
- {
1162
- type: 'text',
1163
- text: JSON.stringify(res)
1164
- }
1165
- ],
1166
- success: true
1167
- };
1168
- };
1169
- const site_dns_cname_record_create = async (request)=>{
1170
- const res = await service.createRecord({
1171
- ttl: 1,
1172
- proxied: true,
1173
- bizName: 'web',
1174
- type: 'CNAME',
1175
- sourceType: 'Domain',
1176
- hostPolicy: 'follow_hostname',
1177
- ...request.params.arguments
1178
- });
1179
- return {
1180
- content: [
1181
- {
1182
- type: 'text',
1183
- text: JSON.stringify(res)
1184
- }
1185
- ],
1186
- success: true
1187
- };
1188
- };
1189
- const site_record_list = async (request)=>{
1190
- var _request_params_arguments;
1191
- const res = await service.listRecords({
1192
- siteId: (null === (_request_params_arguments = request.params.arguments) || void 0 === _request_params_arguments ? void 0 : _request_params_arguments.SiteId) ?? 0
1193
- });
1194
- return {
1195
- content: [
1196
- {
1197
- type: 'text',
1198
- text: JSON.stringify(res)
1199
- }
1200
- ],
1201
- success: true
1202
180
  };
1203
- };
1204
- const site_active_list = async ()=>{
1205
- const res = await service.listSites({
1206
- siteSearchType: 'fuzzy',
1207
- status: 'active',
1208
- pageNumber: 1,
1209
- pageSize: 500
1210
- });
1211
- return {
1212
- content: [
1213
- {
1214
- type: 'text',
1215
- text: JSON.stringify(res)
1216
- }
1217
- ],
1218
- success: true
1219
- };
1220
- };
1221
- const site_match = async (request)=>{
1222
- var _request_params_arguments;
1223
- const res = await service.getMatchSite({
1224
- recordName: (null === (_request_params_arguments = request.params.arguments) || void 0 === _request_params_arguments ? void 0 : _request_params_arguments.recordName) ?? ''
1225
- });
1226
- return {
1227
- content: [
1228
- {
1229
- type: 'text',
1230
- text: JSON.stringify(res)
1231
- }
1232
- ],
1233
- success: true
1234
- };
1235
- };
1236
- const ESA_OPENAPI_ER_LIST = [
1237
- ROUTINE_CREATE_TOOL,
1238
- ROUTINE_DELETE_TOOL,
1239
- ROUTINE_LIST_TOOL,
1240
- ROUTINE_GET_TOOL,
1241
- ROUTINE_CODE_COMMIT_TOOL,
1242
- ROUTINE_CODE_DEPLOY_TOOL,
1243
- ROUTINE_ROUTE_LIST_TOOL,
1244
- CANARY_AREA_LIST,
1245
- DEPLOYMENT_DELETE_TOOL,
1246
- SITE_ACTIVE_LIST_TOOL,
1247
- SITE_ROUTE_LIST_TOOL,
1248
- ROUTE_CREATE_TOOL,
1249
- ROUTE_DELETE_TOOL,
1250
- ROUTE_UPDATE_TOOL,
1251
- ROUTE_GET_TOOL,
1252
- SITE_MATCH_TOOL,
1253
- ER_RECORD_CREATE_TOOL,
1254
- ER_RECORD_DELETE_TOOL,
1255
- ER_RECORD_LIST_TOOL,
1256
- SITE_DNS_A_RECORD_CREATE_TOOL,
1257
- SITE_DNS_CNAME_RECORD_CREATE_TOOL,
1258
- SITE_RECORD_LIST_TOOL
1259
- ];
1260
- const ESA_OPENAPI_LIST = [
1261
- ...ESA_OPENAPI_ER_LIST
1262
- ];
1263
- const routineHandlers = {
1264
- site_dns_a_record_create: site_dns_a_record_create,
1265
- site_dns_cname_record_create: site_dns_cname_record_create,
1266
- site_active_list: site_active_list,
1267
- site_match: site_match,
1268
- site_route_list: site_route_list,
1269
- site_record_list: site_record_list,
1270
- routine_create: routine_create,
1271
- routine_delete: routine_delete,
1272
- routine_list: routine_list,
1273
- routine_get: routine_get,
1274
- routine_code_commit: routine_code_commit,
1275
- routine_code_deploy: routine_code_deploy,
1276
- routine_route_list: routine_route_list,
1277
- canary_area_list: canary_area_list,
1278
- deployment_delete: deployment_delete,
1279
- route_create: route_create,
1280
- route_delete: route_delete,
1281
- route_update: route_update,
1282
- route_get: route_get,
1283
- er_record_create: er_record_create,
1284
- er_record_delete: er_record_delete,
1285
- er_record_list: er_record_list
1286
- };
1287
- const server = new index_js_namespaceObject.Server({
1288
- name: 'esa-server',
1289
- version: '1.0.0'
1290
- }, {
1291
- capabilities: {
1292
- tools: {}
1293
- }
1294
- });
1295
- server.setRequestHandler(types_js_namespaceObject.ListToolsRequestSchema, async ()=>({
1296
- tools: ESA_OPENAPI_LIST
1297
- }));
1298
- server.setRequestHandler(types_js_namespaceObject.CallToolRequestSchema, async (request)=>{
1299
- const toolName = request.params.name;
1300
- log('Received tool call:', toolName, 'Params:', JSON.stringify(request.params));
1301
- return await routineHandlers[toolName](request);
1302
- });
1303
- async function main() {
1304
- const transport = new stdio_js_namespaceObject.StdioServerTransport();
1305
- await server.connect(transport);
1306
- console.error('ESA MCP Server running on stdio');
1307
- }
1308
- main().catch((error)=>{
1309
- console.error('Fatal error in main():', error);
1310
- process.exit(1);
1311
- });
181
+ })();
182
+ var __webpack_exports__ = __webpack_require__("./src/index.js");
1312
183
  var __webpack_export_target__ = exports;
1313
184
  for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
1314
185
  if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {