UNPKG

@takashito/linode-mcp-server

Version:

MCP server for Linode API

66 lines 2.77 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.createClient = createClient; const axios_1 = __importDefault(require("axios")); const index_1 = require("./client/index"); const API_ROOT = 'https://api.linode.com/v4'; /** * Creates and configures a Linode API client with the provided token */ function createClient(context, server) { const token = context.session?.headers?.['authorization']?.split(' ')[1] || server?.options?.token || null; // Create an axios instance with the Linode API configuration const axiosInstance = axios_1.default.create({ baseURL: API_ROOT, headers: { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json', }, }); //console.error(`Context: ${JSON.stringify(context)}`); //console.error(`Client Created for API token: ${token}`); // Create category-specific clients const instances = (0, index_1.createInstancesClient)(axiosInstance); const volumes = (0, index_1.createVolumesClient)(axiosInstance); const networking = (0, index_1.createNetworkingClient)(axiosInstance); const nodeBalancers = (0, index_1.createNodeBalancersClient)(axiosInstance); const regions = (0, index_1.createRegionsClient)(axiosInstance); const placement = (0, index_1.createPlacementClient)(axiosInstance); const vpcs = (0, index_1.createVPCsClient)(axiosInstance); const objectStorage = (0, index_1.createObjectStorageClient)(axiosInstance); const domains = (0, index_1.createDomainsClient)(axiosInstance); const databases = (0, index_1.createDatabasesClient)(axiosInstance); const kubernetes = (0, index_1.createKubernetesClient)(axiosInstance); const images = (0, index_1.createImagesClient)(axiosInstance); const stackScripts = (0, index_1.createStackScriptsClient)(axiosInstance); const tags = (0, index_1.createTagsClient)(axiosInstance); const support = (0, index_1.createSupportClient)(axiosInstance); const longview = (0, index_1.createLongviewClient)(axiosInstance); const profile = (0, index_1.createProfileClient)(axiosInstance); const account = (0, index_1.createAccountClient)(axiosInstance); // Return the combined client return { instances, volumes, networking, nodeBalancers, regions, placement, vpcs, objectStorage, domains, databases, kubernetes, images, stackScripts, tags, support, longview, profile, account }; } //# sourceMappingURL=client.js.map