@takashito/linode-mcp-server
Version:
MCP server for Linode API
117 lines • 5.4 kB
JavaScript
;
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.registerLongviewTools = registerLongviewTools;
const schemas = __importStar(require("./schemas"));
const errorHandler_1 = require("../common/errorHandler");
function registerLongviewTools(server, client) {
// Longview client operations
server.tool('list_longview_clients', 'Get a list of all Longview clients', schemas.listLongviewClientsSchema.shape, (0, errorHandler_1.withErrorHandling)(async (params, extra) => {
const paginationParams = {
page: params.page,
page_size: params.page_size
};
const result = await client.longview.getLongviewClients(paginationParams);
return {
content: [
{ type: 'text', text: JSON.stringify(result, null, 2) },
],
};
}));
server.tool('get_longview_client', 'Get details for a specific Longview client', schemas.getLongviewClientSchema.shape, (0, errorHandler_1.withErrorHandling)(async (params, extra) => {
const result = await client.longview.getLongviewClient(params.id);
return {
content: [
{ type: 'text', text: JSON.stringify(result, null, 2) },
],
};
}));
server.tool('create_longview_client', 'Create a new Longview client', schemas.createLongviewClientSchema.shape, (0, errorHandler_1.withErrorHandling)(async (params, extra) => {
const result = await client.longview.createLongviewClient(params);
return {
content: [
{ type: 'text', text: JSON.stringify(result, null, 2) },
],
};
}));
server.tool('update_longview_client', 'Update a Longview client', schemas.updateLongviewClientSchema.shape, (0, errorHandler_1.withErrorHandling)(async (params, extra) => {
const { id, ...updateData } = params;
const result = await client.longview.updateLongviewClient(id, updateData);
return {
content: [
{ type: 'text', text: JSON.stringify(result, null, 2) },
],
};
}));
server.tool('delete_longview_client', 'Delete a Longview client', schemas.deleteLongviewClientSchema.shape, (0, errorHandler_1.withErrorHandling)(async (params, extra) => {
await client.longview.deleteLongviewClient(params.id);
return {
content: [
{ type: 'text', text: JSON.stringify({ success: true }, null, 2) },
],
};
}));
// Longview subscription operations
server.tool('list_longview_subscriptions', 'Get a list of all Longview subscription plans', schemas.listLongviewSubscriptionsSchema.shape, (0, errorHandler_1.withErrorHandling)(async (params, extra) => {
const paginationParams = {
page: params.page,
page_size: params.page_size
};
const result = await client.longview.getLongviewSubscriptions(paginationParams);
return {
content: [
{ type: 'text', text: JSON.stringify(result, null, 2) },
],
};
}));
server.tool('get_longview_subscription', 'Get details for a specific Longview subscription plan', schemas.getLongviewSubscriptionSchema.shape, (0, errorHandler_1.withErrorHandling)(async (params, extra) => {
const result = await client.longview.getLongviewSubscription(params.id);
return {
content: [
{ type: 'text', text: JSON.stringify(result, null, 2) },
],
};
}));
// Longview data operations
server.tool('get_longview_data', 'Get monitoring data from a Longview client', schemas.getLongviewDataSchema.shape, (0, errorHandler_1.withErrorHandling)(async (params, extra) => {
const result = await client.longview.getLongviewData(params.id);
return {
content: [
{ type: 'text', text: JSON.stringify(result, null, 2) },
],
};
}));
}
//# sourceMappingURL=tools.js.map