@takashito/linode-mcp-server
Version:
MCP server for Linode API
348 lines • 17.9 kB
JavaScript
"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.registerMonitorTools = registerMonitorTools;
const client_1 = require("../../client");
const schemas_1 = require("../common/schemas");
const schemas = __importStar(require("./schemas"));
const errorHandler_1 = require("../common/errorHandler");
function registerMonitorTools(server) {
// Notification Channels
server.addTool({
name: 'list_notification_channels',
description: 'List all notification channels for monitor alerts',
parameters: (0, schemas_1.mcpInput)(schemas.listNotificationChannelsSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).monitor.getNotificationChannels(params);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'get_notification_channel',
description: 'Get details for a specific notification channel',
parameters: (0, schemas_1.mcpInput)(schemas.getNotificationChannelSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).monitor.getNotificationChannel(params.channelId);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'create_notification_channel',
description: 'Create a new notification channel for monitor alerts',
parameters: (0, schemas_1.mcpInput)(schemas.createNotificationChannelSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).monitor.createNotificationChannel(params);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'update_notification_channel',
description: 'Update an existing notification channel',
parameters: (0, schemas_1.mcpInput)(schemas.updateNotificationChannelSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const { channelId, ...data } = params;
const result = await (0, client_1.createClient)(context).monitor.updateNotificationChannel(channelId, data);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'delete_notification_channel',
description: 'Delete a notification channel',
parameters: (0, schemas_1.mcpInput)(schemas.deleteNotificationChannelSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
await (0, client_1.createClient)(context).monitor.deleteNotificationChannel(params.channelId);
return JSON.stringify({ success: true }, null, 2);
})
});
server.addTool({
name: 'list_channel_alerts',
description: 'List alerts associated with a specific notification channel',
parameters: (0, schemas_1.mcpInput)(schemas.listChannelAlertsSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const { channelId, ...paginationParams } = params;
const result = await (0, client_1.createClient)(context).monitor.getChannelAlerts(channelId, paginationParams);
return JSON.stringify(result, null, 2);
})
});
// Alert Definitions
server.addTool({
name: 'list_alert_definitions',
description: 'List all alert definitions across all service types',
parameters: (0, schemas_1.mcpInput)(schemas.listAlertDefinitionsSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).monitor.getAlertDefinitions(params);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'list_service_alert_definitions',
description: 'List alert definitions for a specific service type',
parameters: (0, schemas_1.mcpInput)(schemas.listServiceAlertDefinitionsSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const { serviceType, ...paginationParams } = params;
const result = await (0, client_1.createClient)(context).monitor.getServiceAlertDefinitions(serviceType, paginationParams);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'get_alert_definition',
description: 'Get details for a specific alert definition',
parameters: (0, schemas_1.mcpInput)(schemas.getAlertDefinitionSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).monitor.getAlertDefinition(params.serviceType, params.alertId);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'create_alert_definition',
description: 'Create a new alert definition for a specific service type',
parameters: (0, schemas_1.mcpInput)(schemas.createAlertDefinitionSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const { serviceType, ...data } = params;
const result = await (0, client_1.createClient)(context).monitor.createAlertDefinition(serviceType, data);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'update_alert_definition',
description: 'Update an existing alert definition',
parameters: (0, schemas_1.mcpInput)(schemas.updateAlertDefinitionSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const { serviceType, alertId, ...data } = params;
const result = await (0, client_1.createClient)(context).monitor.updateAlertDefinition(serviceType, alertId, data);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'delete_alert_definition',
description: 'Delete an alert definition',
parameters: (0, schemas_1.mcpInput)(schemas.deleteAlertDefinitionSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
await (0, client_1.createClient)(context).monitor.deleteAlertDefinition(params.serviceType, params.alertId);
return JSON.stringify({ success: true }, null, 2);
})
});
// Log Streams
server.addTool({
name: 'list_log_streams',
description: 'Get a list of all log streams',
parameters: (0, schemas_1.mcpInput)(schemas.listLogStreamsSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).monitor.getLogStreams(params);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'get_log_stream',
description: 'Get details for a specific log stream',
parameters: (0, schemas_1.mcpInput)(schemas.getLogStreamSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).monitor.getLogStream(params.streamId);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'create_log_stream',
description: 'Create a new log stream',
parameters: (0, schemas_1.mcpInput)(schemas.createLogStreamSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).monitor.createLogStream(params);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'update_log_stream',
description: 'Update an existing log stream',
parameters: (0, schemas_1.mcpInput)(schemas.updateLogStreamSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const { streamId, ...data } = params;
const result = await (0, client_1.createClient)(context).monitor.updateLogStream(streamId, data);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'delete_log_stream',
description: 'Delete a log stream',
parameters: (0, schemas_1.mcpInput)(schemas.deleteLogStreamSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
await (0, client_1.createClient)(context).monitor.deleteLogStream(params.streamId);
return JSON.stringify({ success: true }, null, 2);
})
});
server.addTool({
name: 'get_log_stream_history',
description: 'Get the history for a specific log stream',
parameters: (0, schemas_1.mcpInput)(schemas.getLogStreamHistorySchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const { streamId, ...paginationParams } = params;
const result = await (0, client_1.createClient)(context).monitor.getLogStreamHistory(streamId, paginationParams);
return JSON.stringify(result, null, 2);
})
});
// Log Destinations
server.addTool({
name: 'list_log_destinations',
description: 'Get a list of all log destinations',
parameters: (0, schemas_1.mcpInput)(schemas.listLogDestinationsSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).monitor.getLogDestinations(params);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'get_log_destination',
description: 'Get details for a specific log destination',
parameters: (0, schemas_1.mcpInput)(schemas.getLogDestinationSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).monitor.getLogDestination(params.destinationId);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'create_log_destination',
description: 'Create a new log destination',
parameters: (0, schemas_1.mcpInput)(schemas.createLogDestinationSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).monitor.createLogDestination(params);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'update_log_destination',
description: 'Update an existing log destination',
parameters: (0, schemas_1.mcpInput)(schemas.updateLogDestinationSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const { destinationId, ...data } = params;
const result = await (0, client_1.createClient)(context).monitor.updateLogDestination(destinationId, data);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'delete_log_destination',
description: 'Delete a log destination',
parameters: (0, schemas_1.mcpInput)(schemas.deleteLogDestinationSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
await (0, client_1.createClient)(context).monitor.deleteLogDestination(params.destinationId);
return JSON.stringify({ success: true }, null, 2);
})
});
server.addTool({
name: 'get_log_destination_history',
description: 'Get the history for a specific log destination',
parameters: (0, schemas_1.mcpInput)(schemas.getLogDestinationHistorySchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const { destinationId, ...paginationParams } = params;
const result = await (0, client_1.createClient)(context).monitor.getLogDestinationHistory(destinationId, paginationParams);
return JSON.stringify(result, null, 2);
})
});
// Dashboards
server.addTool({
name: 'list_monitor_dashboards',
description: 'List all monitor dashboards',
parameters: (0, schemas_1.mcpInput)(schemas.listMonitorDashboardsSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).monitor.listDashboards(params);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'get_monitor_dashboard',
description: 'Get details for a specific monitor dashboard',
parameters: (0, schemas_1.mcpInput)(schemas.getMonitorDashboardSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).monitor.getDashboard(params.dashboardId);
return JSON.stringify(result, null, 2);
})
});
// Services & Metrics
server.addTool({
name: 'list_monitor_services',
description: 'List all supported monitoring service types',
parameters: (0, schemas_1.mcpInput)(schemas.listMonitorServicesSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).monitor.listServices(params);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'get_monitor_service',
description: 'Get details for a specific supported monitoring service type',
parameters: (0, schemas_1.mcpInput)(schemas.getMonitorServiceSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).monitor.getService(params.serviceType);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'list_service_dashboards',
description: 'List dashboards for a specific monitoring service type',
parameters: (0, schemas_1.mcpInput)(schemas.listServiceDashboardsSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const { serviceType, ...paginationParams } = params;
const result = await (0, client_1.createClient)(context).monitor.listServiceDashboards(serviceType, paginationParams);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'list_service_metric_definitions',
description: 'List metric definitions for a specific monitoring service type',
parameters: (0, schemas_1.mcpInput)(schemas.listServiceMetricDefinitionsSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).monitor.listServiceMetricDefinitions(params.serviceType);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'get_service_metrics',
description: 'Get metrics for entities of a specific monitoring service type',
parameters: (0, schemas_1.mcpInput)(schemas.getServiceMetricsSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const { serviceType, ...data } = params;
const result = await (0, client_1.createClient)(context).monitor.getServiceMetrics(serviceType, data);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'create_service_token',
description: 'Create a token for a specific monitoring service type',
parameters: (0, schemas_1.mcpInput)(schemas.createServiceTokenSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).monitor.createServiceToken(params.serviceType);
return JSON.stringify(result, null, 2);
})
});
}
//# sourceMappingURL=tools.js.map