@robinmordasiewicz/f5xc-api-mcp 3.0.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.
- package/CHANGELOG.md +74 -0
- package/README.md +234 -0
- package/dist/auth/credential-manager.d.ts +116 -0
- package/dist/auth/credential-manager.d.ts.map +1 -0
- package/dist/auth/credential-manager.js +208 -0
- package/dist/auth/credential-manager.js.map +1 -0
- package/dist/auth/http-client.d.ts +81 -0
- package/dist/auth/http-client.d.ts.map +1 -0
- package/dist/auth/http-client.js +197 -0
- package/dist/auth/http-client.js.map +1 -0
- package/dist/auth/index.d.ts +8 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +6 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/generator/index.d.ts +7 -0
- package/dist/generator/index.d.ts.map +1 -0
- package/dist/generator/index.js +7 -0
- package/dist/generator/index.js.map +1 -0
- package/dist/generator/naming/acronyms.d.ts +81 -0
- package/dist/generator/naming/acronyms.d.ts.map +1 -0
- package/dist/generator/naming/acronyms.js +253 -0
- package/dist/generator/naming/acronyms.js.map +1 -0
- package/dist/generator/naming/index.d.ts +6 -0
- package/dist/generator/naming/index.d.ts.map +1 -0
- package/dist/generator/naming/index.js +6 -0
- package/dist/generator/naming/index.js.map +1 -0
- package/dist/generator/naming/volterra-mapping.d.ts +102 -0
- package/dist/generator/naming/volterra-mapping.d.ts.map +1 -0
- package/dist/generator/naming/volterra-mapping.js +259 -0
- package/dist/generator/naming/volterra-mapping.js.map +1 -0
- package/dist/generator/openapi-parser.d.ts +339 -0
- package/dist/generator/openapi-parser.d.ts.map +1 -0
- package/dist/generator/openapi-parser.js +463 -0
- package/dist/generator/openapi-parser.js.map +1 -0
- package/dist/generator/tool-generator.d.ts +74 -0
- package/dist/generator/tool-generator.d.ts.map +1 -0
- package/dist/generator/tool-generator.js +387 -0
- package/dist/generator/tool-generator.js.map +1 -0
- package/dist/generator/transformers/index.d.ts +7 -0
- package/dist/generator/transformers/index.d.ts.map +1 -0
- package/dist/generator/transformers/index.js +7 -0
- package/dist/generator/transformers/index.js.map +1 -0
- package/dist/generator/transformers/normalize-examples.d.ts +48 -0
- package/dist/generator/transformers/normalize-examples.d.ts.map +1 -0
- package/dist/generator/transformers/normalize-examples.js +66 -0
- package/dist/generator/transformers/normalize-examples.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +70 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/index.d.ts +6 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +5 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/prompts/workflows.d.ts +59 -0
- package/dist/prompts/workflows.d.ts.map +1 -0
- package/dist/prompts/workflows.js +585 -0
- package/dist/prompts/workflows.js.map +1 -0
- package/dist/resources/handlers.d.ts +72 -0
- package/dist/resources/handlers.d.ts.map +1 -0
- package/dist/resources/handlers.js +279 -0
- package/dist/resources/handlers.js.map +1 -0
- package/dist/resources/index.d.ts +8 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +6 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/resources/templates.d.ts +86 -0
- package/dist/resources/templates.d.ts.map +1 -0
- package/dist/resources/templates.js +248 -0
- package/dist/resources/templates.js.map +1 -0
- package/dist/server.d.ts +78 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +426 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/discovery/consolidate.d.ts +97 -0
- package/dist/tools/discovery/consolidate.d.ts.map +1 -0
- package/dist/tools/discovery/consolidate.js +200 -0
- package/dist/tools/discovery/consolidate.js.map +1 -0
- package/dist/tools/discovery/describe.d.ts +132 -0
- package/dist/tools/discovery/describe.d.ts.map +1 -0
- package/dist/tools/discovery/describe.js +206 -0
- package/dist/tools/discovery/describe.js.map +1 -0
- package/dist/tools/discovery/execute.d.ts +98 -0
- package/dist/tools/discovery/execute.d.ts.map +1 -0
- package/dist/tools/discovery/execute.js +251 -0
- package/dist/tools/discovery/execute.js.map +1 -0
- package/dist/tools/discovery/index-loader.d.ts +28 -0
- package/dist/tools/discovery/index-loader.d.ts.map +1 -0
- package/dist/tools/discovery/index-loader.js +69 -0
- package/dist/tools/discovery/index-loader.js.map +1 -0
- package/dist/tools/discovery/index.d.ts +185 -0
- package/dist/tools/discovery/index.d.ts.map +1 -0
- package/dist/tools/discovery/index.js +177 -0
- package/dist/tools/discovery/index.js.map +1 -0
- package/dist/tools/discovery/search.d.ts +41 -0
- package/dist/tools/discovery/search.d.ts.map +1 -0
- package/dist/tools/discovery/search.js +155 -0
- package/dist/tools/discovery/search.js.map +1 -0
- package/dist/tools/discovery/types.d.ts +70 -0
- package/dist/tools/discovery/types.d.ts.map +1 -0
- package/dist/tools/discovery/types.js +9 -0
- package/dist/tools/discovery/types.js.map +1 -0
- package/dist/tools/generated/ai_intelligence/index.d.ts +8 -0
- package/dist/tools/generated/ai_intelligence/index.d.ts.map +1 -0
- package/dist/tools/generated/ai_intelligence/index.js +282 -0
- package/dist/tools/generated/ai_intelligence/index.js.map +1 -0
- package/dist/tools/generated/api_security/index.d.ts +8 -0
- package/dist/tools/generated/api_security/index.d.ts.map +1 -0
- package/dist/tools/generated/api_security/index.js +1852 -0
- package/dist/tools/generated/api_security/index.js.map +1 -0
- package/dist/tools/generated/applications/index.d.ts +8 -0
- package/dist/tools/generated/applications/index.d.ts.map +1 -0
- package/dist/tools/generated/applications/index.js +1589 -0
- package/dist/tools/generated/applications/index.js.map +1 -0
- package/dist/tools/generated/bigip/index.d.ts +8 -0
- package/dist/tools/generated/bigip/index.d.ts.map +1 -0
- package/dist/tools/generated/bigip/index.js +1173 -0
- package/dist/tools/generated/bigip/index.js.map +1 -0
- package/dist/tools/generated/billing/index.d.ts +8 -0
- package/dist/tools/generated/billing/index.d.ts.map +1 -0
- package/dist/tools/generated/billing/index.js +759 -0
- package/dist/tools/generated/billing/index.js.map +1 -0
- package/dist/tools/generated/cdn/index.d.ts +8 -0
- package/dist/tools/generated/cdn/index.d.ts.map +1 -0
- package/dist/tools/generated/cdn/index.js +841 -0
- package/dist/tools/generated/cdn/index.js.map +1 -0
- package/dist/tools/generated/config/index.d.ts +8 -0
- package/dist/tools/generated/config/index.d.ts.map +1 -0
- package/dist/tools/generated/config/index.js +316 -0
- package/dist/tools/generated/config/index.js.map +1 -0
- package/dist/tools/generated/identity/index.d.ts +8 -0
- package/dist/tools/generated/identity/index.d.ts.map +1 -0
- package/dist/tools/generated/identity/index.js +5371 -0
- package/dist/tools/generated/identity/index.js.map +1 -0
- package/dist/tools/generated/infrastructure/index.d.ts +8 -0
- package/dist/tools/generated/infrastructure/index.d.ts.map +1 -0
- package/dist/tools/generated/infrastructure/index.js +5342 -0
- package/dist/tools/generated/infrastructure/index.js.map +1 -0
- package/dist/tools/generated/infrastructure_protection/index.d.ts +8 -0
- package/dist/tools/generated/infrastructure_protection/index.d.ts.map +1 -0
- package/dist/tools/generated/infrastructure_protection/index.js +2919 -0
- package/dist/tools/generated/infrastructure_protection/index.js.map +1 -0
- package/dist/tools/generated/integrations/index.d.ts +8 -0
- package/dist/tools/generated/integrations/index.d.ts.map +1 -0
- package/dist/tools/generated/integrations/index.js +1995 -0
- package/dist/tools/generated/integrations/index.js.map +1 -0
- package/dist/tools/generated/load_balancer/index.d.ts +8 -0
- package/dist/tools/generated/load_balancer/index.d.ts.map +1 -0
- package/dist/tools/generated/load_balancer/index.js +2269 -0
- package/dist/tools/generated/load_balancer/index.js.map +1 -0
- package/dist/tools/generated/networking/index.d.ts +8 -0
- package/dist/tools/generated/networking/index.d.ts.map +1 -0
- package/dist/tools/generated/networking/index.js +11289 -0
- package/dist/tools/generated/networking/index.js.map +1 -0
- package/dist/tools/generated/nginx/index.d.ts +8 -0
- package/dist/tools/generated/nginx/index.d.ts.map +1 -0
- package/dist/tools/generated/nginx/index.js +680 -0
- package/dist/tools/generated/nginx/index.js.map +1 -0
- package/dist/tools/generated/observability/index.d.ts +8 -0
- package/dist/tools/generated/observability/index.d.ts.map +1 -0
- package/dist/tools/generated/observability/index.js +6140 -0
- package/dist/tools/generated/observability/index.js.map +1 -0
- package/dist/tools/generated/operations/index.d.ts +8 -0
- package/dist/tools/generated/operations/index.d.ts.map +1 -0
- package/dist/tools/generated/operations/index.js +1759 -0
- package/dist/tools/generated/operations/index.js.map +1 -0
- package/dist/tools/generated/security/index.d.ts +8 -0
- package/dist/tools/generated/security/index.d.ts.map +1 -0
- package/dist/tools/generated/security/index.js +9111 -0
- package/dist/tools/generated/security/index.js.map +1 -0
- package/dist/tools/generated/service_mesh/index.d.ts +8 -0
- package/dist/tools/generated/service_mesh/index.d.ts.map +1 -0
- package/dist/tools/generated/service_mesh/index.js +1628 -0
- package/dist/tools/generated/service_mesh/index.js.map +1 -0
- package/dist/tools/generated/shape_security/index.d.ts +8 -0
- package/dist/tools/generated/shape_security/index.d.ts.map +1 -0
- package/dist/tools/generated/shape_security/index.js +4121 -0
- package/dist/tools/generated/shape_security/index.js.map +1 -0
- package/dist/tools/generated/subscriptions/index.d.ts +8 -0
- package/dist/tools/generated/subscriptions/index.d.ts.map +1 -0
- package/dist/tools/generated/subscriptions/index.js +778 -0
- package/dist/tools/generated/subscriptions/index.js.map +1 -0
- package/dist/tools/generated/tenant_management/index.d.ts +8 -0
- package/dist/tools/generated/tenant_management/index.d.ts.map +1 -0
- package/dist/tools/generated/tenant_management/index.js +2292 -0
- package/dist/tools/generated/tenant_management/index.js.map +1 -0
- package/dist/tools/generated/vpn/index.d.ts +8 -0
- package/dist/tools/generated/vpn/index.d.ts.map +1 -0
- package/dist/tools/generated/vpn/index.js +1183 -0
- package/dist/tools/generated/vpn/index.js.map +1 -0
- package/dist/tools/index.d.ts +7 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +6 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/registry.d.ts +27 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +83 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/utils/error-handling.d.ts +109 -0
- package/dist/utils/error-handling.d.ts.map +1 -0
- package/dist/utils/error-handling.js +239 -0
- package/dist/utils/error-handling.js.map +1 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +6 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logging.d.ts +75 -0
- package/dist/utils/logging.d.ts.map +1 -0
- package/dist/utils/logging.js +131 -0
- package/dist/utils/logging.js.map +1 -0
- package/manifest.json +143 -0
- package/package.json +95 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Resource Handlers
|
|
3
|
+
*
|
|
4
|
+
* Implements resource read handlers for F5XC configuration objects.
|
|
5
|
+
* Supports both documentation mode (returns schema info) and
|
|
6
|
+
* execution mode (fetches actual resource data).
|
|
7
|
+
*/
|
|
8
|
+
import { ResourceType } from "./templates.js";
|
|
9
|
+
import { CredentialManager } from "../auth/credential-manager.js";
|
|
10
|
+
import { HttpClient } from "../auth/http-client.js";
|
|
11
|
+
/**
|
|
12
|
+
* Resource read result
|
|
13
|
+
*/
|
|
14
|
+
export interface ResourceReadResult {
|
|
15
|
+
/** Resource URI */
|
|
16
|
+
uri: string;
|
|
17
|
+
/** MIME type of content */
|
|
18
|
+
mimeType: string;
|
|
19
|
+
/** Resource content */
|
|
20
|
+
content: string;
|
|
21
|
+
/** Whether this is documentation or actual data */
|
|
22
|
+
mode: "documentation" | "execution";
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Resource documentation (for unauthenticated mode)
|
|
26
|
+
*/
|
|
27
|
+
export interface ResourceDocumentation {
|
|
28
|
+
/** Resource URI */
|
|
29
|
+
uri: string;
|
|
30
|
+
/** Resource type information */
|
|
31
|
+
resourceType: ResourceType;
|
|
32
|
+
/** API path for this resource */
|
|
33
|
+
apiPath: string;
|
|
34
|
+
/** Example resource structure */
|
|
35
|
+
exampleResource: Record<string, unknown>;
|
|
36
|
+
/** f5xcctl command to get this resource */
|
|
37
|
+
f5xcctlCommand: string;
|
|
38
|
+
/** Terraform data source */
|
|
39
|
+
terraformDataSource: string;
|
|
40
|
+
/** Related resources */
|
|
41
|
+
relatedResources: string[];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Resource Handler class
|
|
45
|
+
*/
|
|
46
|
+
export declare class ResourceHandler {
|
|
47
|
+
private credentialManager;
|
|
48
|
+
private httpClient;
|
|
49
|
+
constructor(credentialManager: CredentialManager, httpClient: HttpClient | null);
|
|
50
|
+
/**
|
|
51
|
+
* Read a resource by URI
|
|
52
|
+
*/
|
|
53
|
+
readResource(uri: string): Promise<ResourceReadResult>;
|
|
54
|
+
/**
|
|
55
|
+
* List available resource templates
|
|
56
|
+
*/
|
|
57
|
+
listResourceTemplates(): Array<{
|
|
58
|
+
uriTemplate: string;
|
|
59
|
+
name: string;
|
|
60
|
+
description: string;
|
|
61
|
+
mimeType: string;
|
|
62
|
+
}>;
|
|
63
|
+
/**
|
|
64
|
+
* List resources of a specific type in a namespace
|
|
65
|
+
*/
|
|
66
|
+
listResources(namespace: string, resourceType: string): Promise<ResourceReadResult>;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Create resource handler
|
|
70
|
+
*/
|
|
71
|
+
export declare function createResourceHandler(credentialManager: CredentialManager, httpClient: HttpClient | null): ResourceHandler;
|
|
72
|
+
//# sourceMappingURL=handlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/resources/handlers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAKL,YAAY,EACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAY,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAIpD;;GAE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,EACpC,UAAU,EAAE,UAAU,GAAG,IAAI,GAC5B,eAAe,CAEjB"}
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Resource Handlers
|
|
3
|
+
*
|
|
4
|
+
* Implements resource read handlers for F5XC configuration objects.
|
|
5
|
+
* Supports both documentation mode (returns schema info) and
|
|
6
|
+
* execution mode (fetches actual resource data).
|
|
7
|
+
*/
|
|
8
|
+
import { parseResourceUri, getResourceType, buildApiPath, RESOURCE_TYPES, } from "./templates.js";
|
|
9
|
+
import { AuthMode } from "../auth/credential-manager.js";
|
|
10
|
+
import { logger } from "../utils/logging.js";
|
|
11
|
+
import { F5XCApiError } from "../utils/error-handling.js";
|
|
12
|
+
/**
|
|
13
|
+
* Generate example resource structure based on type
|
|
14
|
+
*/
|
|
15
|
+
function generateExampleResource(resourceType, namespace, name) {
|
|
16
|
+
const baseMetadata = {
|
|
17
|
+
name,
|
|
18
|
+
namespace,
|
|
19
|
+
labels: {},
|
|
20
|
+
annotations: {},
|
|
21
|
+
description: `Example ${resourceType}`,
|
|
22
|
+
};
|
|
23
|
+
switch (resourceType) {
|
|
24
|
+
case "http_loadbalancer":
|
|
25
|
+
return {
|
|
26
|
+
metadata: baseMetadata,
|
|
27
|
+
spec: {
|
|
28
|
+
domains: ["app.example.com"],
|
|
29
|
+
http: {
|
|
30
|
+
dns_volterra_managed: true,
|
|
31
|
+
},
|
|
32
|
+
default_route_pools: [
|
|
33
|
+
{
|
|
34
|
+
pool: {
|
|
35
|
+
tenant: "your-tenant",
|
|
36
|
+
namespace,
|
|
37
|
+
name: "example-origin-pool",
|
|
38
|
+
},
|
|
39
|
+
weight: 1,
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
advertise_on_public_default_vip: {},
|
|
43
|
+
},
|
|
44
|
+
system_metadata: {
|
|
45
|
+
creation_timestamp: "2024-01-01T00:00:00Z",
|
|
46
|
+
modification_timestamp: "2024-01-01T00:00:00Z",
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
case "origin_pool":
|
|
50
|
+
return {
|
|
51
|
+
metadata: baseMetadata,
|
|
52
|
+
spec: {
|
|
53
|
+
origin_servers: [
|
|
54
|
+
{
|
|
55
|
+
public_ip: {
|
|
56
|
+
ip: "10.0.0.1",
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
port: 80,
|
|
61
|
+
no_tls: {},
|
|
62
|
+
endpoint_selection: "LOCAL_PREFERRED",
|
|
63
|
+
loadbalancer_algorithm: "ROUND_ROBIN",
|
|
64
|
+
},
|
|
65
|
+
system_metadata: {
|
|
66
|
+
creation_timestamp: "2024-01-01T00:00:00Z",
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
case "dns_zone":
|
|
70
|
+
return {
|
|
71
|
+
metadata: baseMetadata,
|
|
72
|
+
spec: {
|
|
73
|
+
primary: {
|
|
74
|
+
soa_parameters: {
|
|
75
|
+
refresh: 3600,
|
|
76
|
+
retry: 600,
|
|
77
|
+
expire: 604800,
|
|
78
|
+
negative_ttl: 1800,
|
|
79
|
+
},
|
|
80
|
+
default_rr_set_group: [],
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
system_metadata: {
|
|
84
|
+
creation_timestamp: "2024-01-01T00:00:00Z",
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
case "app_firewall":
|
|
88
|
+
return {
|
|
89
|
+
metadata: baseMetadata,
|
|
90
|
+
spec: {
|
|
91
|
+
detection_settings: {
|
|
92
|
+
signature_selection_setting: {
|
|
93
|
+
default_attack_type_settings: {},
|
|
94
|
+
high_medium_accuracy_signatures: {},
|
|
95
|
+
},
|
|
96
|
+
enable_suppression: {},
|
|
97
|
+
enable_threat_campaigns: {},
|
|
98
|
+
},
|
|
99
|
+
bot_protection_setting: {
|
|
100
|
+
malicious_bot_action: "BLOCK",
|
|
101
|
+
suspicious_bot_action: "REPORT",
|
|
102
|
+
good_bot_action: "REPORT",
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
system_metadata: {
|
|
106
|
+
creation_timestamp: "2024-01-01T00:00:00Z",
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
default:
|
|
110
|
+
return {
|
|
111
|
+
metadata: baseMetadata,
|
|
112
|
+
spec: {},
|
|
113
|
+
system_metadata: {
|
|
114
|
+
creation_timestamp: "2024-01-01T00:00:00Z",
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Generate f5xcctl command for resource
|
|
121
|
+
*/
|
|
122
|
+
function generateF5xcctlCommand(resourceType, namespace, name) {
|
|
123
|
+
const rt = resourceType.replace(/-/g, "_");
|
|
124
|
+
return `f5xcctl get ${rt} ${name} -n ${namespace} -o yaml`;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Generate Terraform data source
|
|
128
|
+
*/
|
|
129
|
+
function generateTerraformDataSource(resourceType, namespace, name) {
|
|
130
|
+
const tfResource = `volterra_${resourceType.replace(/-/g, "_")}`;
|
|
131
|
+
return `data "${tfResource}" "example" {
|
|
132
|
+
name = "${name}"
|
|
133
|
+
namespace = "${namespace}"
|
|
134
|
+
}`;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Build documentation response for a resource
|
|
138
|
+
*/
|
|
139
|
+
function buildDocumentationResponse(uri, _tenant, namespace, resourceType, name) {
|
|
140
|
+
const rt = getResourceType(resourceType);
|
|
141
|
+
if (!rt) {
|
|
142
|
+
throw new F5XCApiError(`Unknown resource type: ${resourceType}`, 400);
|
|
143
|
+
}
|
|
144
|
+
const apiPath = buildApiPath(resourceType, namespace, name);
|
|
145
|
+
return {
|
|
146
|
+
uri,
|
|
147
|
+
resourceType: rt,
|
|
148
|
+
apiPath: apiPath ?? "",
|
|
149
|
+
exampleResource: generateExampleResource(resourceType, namespace, name),
|
|
150
|
+
f5xcctlCommand: generateF5xcctlCommand(resourceType, namespace, name),
|
|
151
|
+
terraformDataSource: generateTerraformDataSource(resourceType, namespace, name),
|
|
152
|
+
relatedResources: rt.relatedResources ?? [],
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Resource Handler class
|
|
157
|
+
*/
|
|
158
|
+
export class ResourceHandler {
|
|
159
|
+
credentialManager;
|
|
160
|
+
httpClient;
|
|
161
|
+
constructor(credentialManager, httpClient) {
|
|
162
|
+
this.credentialManager = credentialManager;
|
|
163
|
+
this.httpClient = httpClient;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Read a resource by URI
|
|
167
|
+
*/
|
|
168
|
+
async readResource(uri) {
|
|
169
|
+
const parsed = parseResourceUri(uri);
|
|
170
|
+
if (!parsed) {
|
|
171
|
+
throw new F5XCApiError(`Invalid resource URI: ${uri}`, 400);
|
|
172
|
+
}
|
|
173
|
+
const { tenant, namespace, resourceType, name } = parsed;
|
|
174
|
+
// Check if resource type is valid
|
|
175
|
+
const rt = getResourceType(resourceType);
|
|
176
|
+
if (!rt) {
|
|
177
|
+
throw new F5XCApiError(`Unknown resource type: ${resourceType}`, 400);
|
|
178
|
+
}
|
|
179
|
+
// Documentation mode - return schema and examples
|
|
180
|
+
if (this.credentialManager.getAuthMode() === AuthMode.NONE || !this.httpClient) {
|
|
181
|
+
const doc = buildDocumentationResponse(uri, tenant, namespace, resourceType, name);
|
|
182
|
+
return {
|
|
183
|
+
uri,
|
|
184
|
+
mimeType: "application/json",
|
|
185
|
+
content: JSON.stringify(doc, null, 2),
|
|
186
|
+
mode: "documentation",
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
// Execution mode - fetch actual resource
|
|
190
|
+
const apiPath = buildApiPath(resourceType, namespace, name);
|
|
191
|
+
if (!apiPath) {
|
|
192
|
+
throw new F5XCApiError(`Cannot build API path for: ${uri}`, 400);
|
|
193
|
+
}
|
|
194
|
+
try {
|
|
195
|
+
const response = await this.httpClient.get(apiPath);
|
|
196
|
+
return {
|
|
197
|
+
uri,
|
|
198
|
+
mimeType: "application/json",
|
|
199
|
+
content: JSON.stringify(response.data, null, 2),
|
|
200
|
+
mode: "execution",
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
catch (error) {
|
|
204
|
+
logger.error(`Failed to read resource: ${uri}`, {
|
|
205
|
+
error: error instanceof Error ? error.message : String(error),
|
|
206
|
+
});
|
|
207
|
+
throw error;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* List available resource templates
|
|
212
|
+
*/
|
|
213
|
+
listResourceTemplates() {
|
|
214
|
+
const tenant = this.credentialManager.getTenant() ?? "{tenant}";
|
|
215
|
+
return Object.values(RESOURCE_TYPES).map((rt) => ({
|
|
216
|
+
uriTemplate: rt.namespaceScoped
|
|
217
|
+
? `f5xc://${tenant}/{namespace}/${rt.type}/{name}`
|
|
218
|
+
: `f5xc://${tenant}/system/${rt.type}/{name}`,
|
|
219
|
+
name: rt.name,
|
|
220
|
+
description: rt.description,
|
|
221
|
+
mimeType: "application/json",
|
|
222
|
+
}));
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* List resources of a specific type in a namespace
|
|
226
|
+
*/
|
|
227
|
+
async listResources(namespace, resourceType) {
|
|
228
|
+
const rt = getResourceType(resourceType);
|
|
229
|
+
if (!rt) {
|
|
230
|
+
throw new F5XCApiError(`Unknown resource type: ${resourceType}`, 400);
|
|
231
|
+
}
|
|
232
|
+
const tenant = this.credentialManager.getTenant() ?? "unknown";
|
|
233
|
+
const uri = `f5xc://${tenant}/${namespace}/${resourceType}`;
|
|
234
|
+
// Documentation mode
|
|
235
|
+
if (this.credentialManager.getAuthMode() === AuthMode.NONE || !this.httpClient) {
|
|
236
|
+
const doc = {
|
|
237
|
+
uri,
|
|
238
|
+
resourceType: rt,
|
|
239
|
+
apiPath: buildApiPath(resourceType, namespace),
|
|
240
|
+
note: "In documentation mode. Provide F5XC credentials to list actual resources.",
|
|
241
|
+
f5xcctlCommand: `f5xcctl get ${resourceType.replace(/-/g, "_")}s -n ${namespace}`,
|
|
242
|
+
};
|
|
243
|
+
return {
|
|
244
|
+
uri,
|
|
245
|
+
mimeType: "application/json",
|
|
246
|
+
content: JSON.stringify(doc, null, 2),
|
|
247
|
+
mode: "documentation",
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
// Execution mode - list resources
|
|
251
|
+
const apiPath = buildApiPath(resourceType, namespace);
|
|
252
|
+
if (!apiPath) {
|
|
253
|
+
throw new F5XCApiError(`Cannot build API path for listing: ${resourceType}`, 400);
|
|
254
|
+
}
|
|
255
|
+
try {
|
|
256
|
+
const response = await this.httpClient.get(apiPath);
|
|
257
|
+
return {
|
|
258
|
+
uri,
|
|
259
|
+
mimeType: "application/json",
|
|
260
|
+
content: JSON.stringify(response.data, null, 2),
|
|
261
|
+
mode: "execution",
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
catch (error) {
|
|
265
|
+
logger.error(`Failed to list resources: ${resourceType}`, {
|
|
266
|
+
namespace,
|
|
267
|
+
error: error instanceof Error ? error.message : String(error),
|
|
268
|
+
});
|
|
269
|
+
throw error;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Create resource handler
|
|
275
|
+
*/
|
|
276
|
+
export function createResourceHandler(credentialManager, httpClient) {
|
|
277
|
+
return new ResourceHandler(credentialManager, httpClient);
|
|
278
|
+
}
|
|
279
|
+
//# sourceMappingURL=handlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handlers.js","sourceRoot":"","sources":["../../src/resources/handlers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,cAAc,GAEf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAqB,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAE5E,OAAO,EAAE,MAAM,EA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,UAAU,qBAAqB,CACnC,iBAAoC,EACpC,UAA6B;IAE7B,OAAO,IAAI,eAAe,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resources Module - Export all resource utilities
|
|
3
|
+
*/
|
|
4
|
+
export { RESOURCE_SCHEMES, RESOURCE_TYPES, buildResourceUri, parseResourceUri, getResourceType, getResourceTypesByTier, buildApiPath, } from "./templates.js";
|
|
5
|
+
export type { ResourceType } from "./templates.js";
|
|
6
|
+
export { ResourceHandler, createResourceHandler } from "./handlers.js";
|
|
7
|
+
export type { ResourceReadResult, ResourceDocumentation } from "./handlers.js";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,sBAAsB,EACtB,YAAY,GACb,MAAM,gBAAgB,CAAC;AAExB,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEvE,YAAY,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resources Module - Export all resource utilities
|
|
3
|
+
*/
|
|
4
|
+
export { RESOURCE_SCHEMES, RESOURCE_TYPES, buildResourceUri, parseResourceUri, getResourceType, getResourceTypesByTier, buildApiPath, } from "./templates.js";
|
|
5
|
+
export { ResourceHandler, createResourceHandler } from "./handlers.js";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,sBAAsB,EACtB,YAAY,GACb,MAAM,gBAAgB,CAAC;AAIxB,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Resource URI Templates
|
|
3
|
+
*
|
|
4
|
+
* Defines URI templates for F5XC configuration resources.
|
|
5
|
+
* URI scheme: f5xc://{tenant}/{namespace}/{resource-type}/{name}
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Resource URI schemes
|
|
9
|
+
*/
|
|
10
|
+
export declare const RESOURCE_SCHEMES: {
|
|
11
|
+
/** Base scheme for all F5XC resources */
|
|
12
|
+
readonly BASE: "f5xc://";
|
|
13
|
+
/** System namespace for global resources */
|
|
14
|
+
readonly SYSTEM: "system";
|
|
15
|
+
/** Shared namespace for cross-tenant resources */
|
|
16
|
+
readonly SHARED: "shared";
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Resource type definitions
|
|
20
|
+
*/
|
|
21
|
+
export interface ResourceType {
|
|
22
|
+
/** Resource type identifier */
|
|
23
|
+
type: string;
|
|
24
|
+
/** Human-readable name */
|
|
25
|
+
name: string;
|
|
26
|
+
/** Resource description */
|
|
27
|
+
description: string;
|
|
28
|
+
/** API path template */
|
|
29
|
+
apiPath: string;
|
|
30
|
+
/** Whether resource is namespace-scoped */
|
|
31
|
+
namespaceScoped: boolean;
|
|
32
|
+
/** Subscription tier required */
|
|
33
|
+
tier: "NO_TIER" | "STANDARD" | "ADVANCED";
|
|
34
|
+
/** Related resources */
|
|
35
|
+
relatedResources?: string[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* All supported resource types
|
|
39
|
+
*/
|
|
40
|
+
export declare const RESOURCE_TYPES: Record<string, ResourceType>;
|
|
41
|
+
/**
|
|
42
|
+
* Build resource URI from components
|
|
43
|
+
*
|
|
44
|
+
* @param tenant - Tenant name
|
|
45
|
+
* @param namespace - Namespace (or 'system'/'shared')
|
|
46
|
+
* @param resourceType - Resource type identifier
|
|
47
|
+
* @param name - Resource name
|
|
48
|
+
* @returns Formatted resource URI
|
|
49
|
+
*/
|
|
50
|
+
export declare function buildResourceUri(tenant: string, namespace: string, resourceType: string, name: string): string;
|
|
51
|
+
/**
|
|
52
|
+
* Parse resource URI into components
|
|
53
|
+
*
|
|
54
|
+
* @param uri - Resource URI to parse
|
|
55
|
+
* @returns Parsed components or null if invalid
|
|
56
|
+
*/
|
|
57
|
+
export declare function parseResourceUri(uri: string): {
|
|
58
|
+
tenant: string;
|
|
59
|
+
namespace: string;
|
|
60
|
+
resourceType: string;
|
|
61
|
+
name: string;
|
|
62
|
+
} | null;
|
|
63
|
+
/**
|
|
64
|
+
* Get resource type definition
|
|
65
|
+
*
|
|
66
|
+
* @param type - Resource type identifier
|
|
67
|
+
* @returns Resource type definition or undefined
|
|
68
|
+
*/
|
|
69
|
+
export declare function getResourceType(type: string): ResourceType | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Get all resource types for a tier
|
|
72
|
+
*
|
|
73
|
+
* @param tier - Subscription tier
|
|
74
|
+
* @returns Array of resource types
|
|
75
|
+
*/
|
|
76
|
+
export declare function getResourceTypesByTier(tier: "NO_TIER" | "STANDARD" | "ADVANCED"): ResourceType[];
|
|
77
|
+
/**
|
|
78
|
+
* Build API path for a resource
|
|
79
|
+
*
|
|
80
|
+
* @param resourceType - Resource type identifier
|
|
81
|
+
* @param namespace - Namespace name
|
|
82
|
+
* @param name - Resource name (optional)
|
|
83
|
+
* @returns API path
|
|
84
|
+
*/
|
|
85
|
+
export declare function buildApiPath(resourceType: string, namespace: string, name?: string): string | null;
|
|
86
|
+
//# sourceMappingURL=templates.d.ts.map
|
|
@@ -0,0 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