UNPKG

@takashito/linode-mcp-server

Version:

MCP server for Linode API

323 lines 16.3 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || (function () { var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; return function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.registerKubernetesTools = registerKubernetesTools; const client_1 = require("../../client"); const schemas_1 = require("../common/schemas"); const schemas = __importStar(require("./schemas")); const errorHandler_1 = require("../common/errorHandler"); /** * Registers Kubernetes tools with the MCP server */ function registerKubernetesTools(server) { // Cluster operations server.addTool({ name: 'list_kubernetes_clusters', description: 'List all Kubernetes clusters', parameters: (0, schemas_1.mcpInput)(schemas.listKubernetesClustersSchema), execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { const result = await (0, client_1.createClient)(context).kubernetes.getClusters(params); return JSON.stringify(result.data, null, 2); }) }); server.addTool({ name: 'get_kubernetes_cluster', description: 'Get details for a specific Kubernetes cluster', parameters: (0, schemas_1.mcpInput)(schemas.getClusterSchema), execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { const result = await (0, client_1.createClient)(context).kubernetes.getCluster(params.id); return JSON.stringify(result, null, 2); }) }); server.addTool({ name: 'create_kubernetes_cluster', description: 'Create a new Kubernetes cluster', parameters: (0, schemas_1.mcpInput)(schemas.createClusterSchema), execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { const result = await (0, client_1.createClient)(context).kubernetes.createCluster(params); return JSON.stringify(result, null, 2); }) }); server.addTool({ name: 'update_kubernetes_cluster', description: 'Update an existing Kubernetes cluster', parameters: (0, schemas_1.mcpInput)(schemas.updateClusterSchema), execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { const { id, ...data } = params; const result = await (0, client_1.createClient)(context).kubernetes.updateCluster(id, data); return JSON.stringify(result, null, 2); }) }); server.addTool({ name: 'delete_kubernetes_cluster', description: 'Delete a Kubernetes cluster', parameters: (0, schemas_1.mcpInput)(schemas.deleteClusterSchema), execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { await (0, client_1.createClient)(context).kubernetes.deleteCluster(params.id); return JSON.stringify({ success: true }, null, 2); }) }); // Node pool operations server.addTool({ name: 'list_kubernetes_node_pools', description: 'List all node pools in a Kubernetes cluster', parameters: (0, schemas_1.mcpInput)(schemas.getNodePoolsSchema), execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { const result = await (0, client_1.createClient)(context).kubernetes.getNodePools(params.clusterId); return JSON.stringify(result, null, 2); }) }); server.addTool({ name: 'get_kubernetes_node_pool', description: 'Get details for a specific node pool in a Kubernetes cluster', parameters: (0, schemas_1.mcpInput)(schemas.getNodePoolSchema), execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { const result = await (0, client_1.createClient)(context).kubernetes.getNodePool(params.clusterId, params.poolId); return JSON.stringify(result, null, 2); }) }); server.addTool({ name: 'create_kubernetes_node_pool', description: 'Create a new node pool in a Kubernetes cluster', parameters: (0, schemas_1.mcpInput)(schemas.createNodePoolSchema), execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { const { clusterId, ...data } = params; const result = await (0, client_1.createClient)(context).kubernetes.createNodePool(clusterId, data); return JSON.stringify(result, null, 2); }) }); server.addTool({ name: 'update_kubernetes_node_pool', description: 'Update an existing node pool in a Kubernetes cluster', parameters: (0, schemas_1.mcpInput)(schemas.updateNodePoolSchema), execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { const { clusterId, poolId, ...data } = params; const result = await (0, client_1.createClient)(context).kubernetes.updateNodePool(clusterId, poolId, data); return JSON.stringify(result, null, 2); }) }); server.addTool({ name: 'delete_kubernetes_node_pool', description: 'Delete a node pool from a Kubernetes cluster', parameters: (0, schemas_1.mcpInput)(schemas.deleteNodePoolSchema), execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { await (0, client_1.createClient)(context).kubernetes.deleteNodePool(params.clusterId, params.poolId); return JSON.stringify({ success: true }, null, 2); }) }); server.addTool({ name: 'recycle_kubernetes_nodes', description: 'Recycle specified nodes in a node pool', parameters: (0, schemas_1.mcpInput)(schemas.recycleNodesSchema), execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { const { clusterId, poolId, nodes } = params; await (0, client_1.createClient)(context).kubernetes.recycleNodes(clusterId, poolId, { nodes }); return JSON.stringify({ success: true }, null, 2); }) }); // Other Kubernetes operations server.addTool({ name: 'list_kubernetes_versions', description: 'List all available Kubernetes versions', parameters: (0, schemas_1.mcpInput)(schemas.getVersionsSchema), execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { const result = await (0, client_1.createClient)(context).kubernetes.getVersions(); return JSON.stringify(result, null, 2); }) }); server.addTool({ name: 'get_kubernetes_kubeconfig', description: 'Get the kubeconfig for a Kubernetes cluster', parameters: (0, schemas_1.mcpInput)(schemas.getKubeconfigSchema), execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { const result = await (0, client_1.createClient)(context).kubernetes.getKubeconfig(params.clusterId); return JSON.stringify(result, null, 2); }) }); server.addTool({ name: 'get_kubernetes_api_endpoints', description: 'Get the API endpoints for a Kubernetes cluster', parameters: (0, schemas_1.mcpInput)(schemas.getAPIEndpointsSchema), execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { const result = await (0, client_1.createClient)(context).kubernetes.getAPIEndpoints(params.clusterId); return JSON.stringify(result, null, 2); }) }); server.addTool({ name: 'recycle_kubernetes_cluster', description: 'Recycle all nodes in a Kubernetes cluster', parameters: (0, schemas_1.mcpInput)(schemas.recycleClusterSchema), execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { await (0, client_1.createClient)(context).kubernetes.recycleCluster(params.id); return JSON.stringify({ success: true }, null, 2); }) }); // Node operations server.addTool({ name: 'delete_kubernetes_node', description: 'Delete a node from a Kubernetes cluster', parameters: (0, schemas_1.mcpInput)(schemas.deleteNodeSchema), execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { await (0, client_1.createClient)(context).kubernetes.deleteNode(params.clusterId, params.nodeId); return JSON.stringify({ success: true }, null, 2); }) }); server.addTool({ name: 'recycle_kubernetes_node', description: 'Recycle a node in a Kubernetes cluster', parameters: (0, schemas_1.mcpInput)(schemas.recycleNodeSchema), execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { await (0, client_1.createClient)(context).kubernetes.recycleNode(params.clusterId, params.nodeId); return JSON.stringify({ success: true }, null, 2); }) }); // Dashboard and service token operations server.addTool({ name: 'get_kubernetes_dashboard_url', description: 'Get the dashboard URL for a Kubernetes cluster', parameters: (0, schemas_1.mcpInput)(schemas.getDashboardURLSchema), execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { const result = await (0, client_1.createClient)(context).kubernetes.getDashboardURL(params.clusterId); return JSON.stringify(result, null, 2); }) }); server.addTool({ name: 'delete_kubernetes_service_token', description: 'Delete the service token for a Kubernetes cluster', parameters: (0, schemas_1.mcpInput)(schemas.deleteServiceTokenSchema), execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { await (0, client_1.createClient)(context).kubernetes.deleteServiceToken(params.clusterId); return JSON.stringify({ success: true }, null, 2); }) }); // Version and type operations server.addTool({ name: 'get_kubernetes_version', description: 'Get details for a specific Kubernetes version', parameters: (0, schemas_1.mcpInput)(schemas.getVersionSchema), execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { const result = await (0, client_1.createClient)(context).kubernetes.getVersion(params.version); return JSON.stringify(result, null, 2); }) }); server.addTool({ name: 'list_kubernetes_types', description: 'List all available Kubernetes types', parameters: (0, schemas_1.mcpInput)(schemas.getTypesSchema), execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { const result = await (0, client_1.createClient)(context).kubernetes.getTypes(); return JSON.stringify(result, null, 2); }) }); // Control Plane ACL operations server.addTool({ name: 'get_kubernetes_control_plane_acl', description: 'Get the control plane ACL configuration for a Kubernetes cluster', parameters: (0, schemas_1.mcpInput)(schemas.getControlPlaneACLSchema), execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { const result = await (0, client_1.createClient)(context).kubernetes.getControlPlaneACL(params.clusterId); return JSON.stringify(result, null, 2); }) }); server.addTool({ name: 'update_kubernetes_control_plane_acl', description: 'Update the control plane ACL configuration for a Kubernetes cluster', parameters: (0, schemas_1.mcpInput)(schemas.updateControlPlaneACLSchema), execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { const { clusterId, ...data } = params; const result = await (0, client_1.createClient)(context).kubernetes.updateControlPlaneACL(clusterId, data); return JSON.stringify(result, null, 2); }) }); server.addTool({ name: 'delete_kubernetes_control_plane_acl', description: 'Delete the control plane ACL configuration for a Kubernetes cluster', parameters: (0, schemas_1.mcpInput)(schemas.deleteControlPlaneACLSchema), execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { await (0, client_1.createClient)(context).kubernetes.deleteControlPlaneACL(params.clusterId); return JSON.stringify({ success: true }, null, 2); }) }); // Kubeconfig operations server.addTool({ name: 'delete_kubernetes_kubeconfig', description: 'Delete (revoke) the kubeconfig for a Kubernetes cluster', parameters: (0, schemas_1.mcpInput)(schemas.deleteKubeconfigSchema), execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { await (0, client_1.createClient)(context).kubernetes.deleteKubeconfig(params.clusterId); return JSON.stringify({ success: true }, null, 2); }) }); // Cluster regeneration server.addTool({ name: 'regenerate_kubernetes_cluster', description: 'Regenerate a Kubernetes cluster', parameters: (0, schemas_1.mcpInput)(schemas.regenerateClusterSchema), execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { await (0, client_1.createClient)(context).kubernetes.regenerateCluster(params.clusterId); return JSON.stringify({ success: true }, null, 2); }) }); // Get node server.addTool({ name: 'get_kubernetes_node', description: 'Get details about a specific node in a Kubernetes cluster', parameters: (0, schemas_1.mcpInput)(schemas.getNodeSchema), execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { const result = await (0, client_1.createClient)(context).kubernetes.getNode(params.clusterId, params.nodeId); return JSON.stringify(result, null, 2); }) }); // Tier version operations server.addTool({ name: 'list_kubernetes_tier_versions', description: 'List available Kubernetes versions for a specific tier', parameters: (0, schemas_1.mcpInput)(schemas.listTierVersionsSchema), execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { const result = await (0, client_1.createClient)(context).kubernetes.getTierVersions(params.tier); return JSON.stringify(result, null, 2); }) }); server.addTool({ name: 'get_kubernetes_tier_version', description: 'Get details for a specific Kubernetes version for a tier', parameters: (0, schemas_1.mcpInput)(schemas.getTierVersionSchema), execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { const result = await (0, client_1.createClient)(context).kubernetes.getTierVersion(params.tier, params.version); return JSON.stringify(result, null, 2); }) }); } //# sourceMappingURL=tools.js.map