@takashito/linode-mcp-server
Version:
MCP server for Linode API
583 lines • 28 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.registerAccountTools = registerAccountTools;
const client_1 = require("../../client");
const schemas_1 = require("../common/schemas");
const schemas = __importStar(require("./schemas"));
const errorHandler_1 = require("../common/errorHandler");
function registerAccountTools(server) {
// Account operations
server.addTool({
name: 'get_account',
description: 'Get your account information',
parameters: (0, schemas_1.mcpInput)(schemas.getAccountSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).account.getAccount();
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'update_account',
description: 'Update your account information',
parameters: (0, schemas_1.mcpInput)(schemas.updateAccountSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).account.updateAccount(params);
return JSON.stringify(result, null, 2);
})
});
// Agreements operations
server.addTool({
name: 'list_agreements',
description: 'List legal agreements',
parameters: (0, schemas_1.mcpInput)(schemas.listAgreementsSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).account.getAgreements();
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'acknowledge_agreements',
description: 'Acknowledge legal agreements',
parameters: (0, schemas_1.mcpInput)(schemas.acknowledgeAgreementsSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
await (0, client_1.createClient)(context).account.acknowledgeAgreements(params);
return JSON.stringify({ success: true }, null, 2);
})
});
// Service availability operations
server.addTool({
name: 'list_available_services',
description: 'List available services by region',
parameters: (0, schemas_1.mcpInput)(schemas.listServiceAvailabilitySchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).account.getServiceAvailability();
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'get_region_service_availability',
description: 'Get service availability for a specific region',
parameters: (0, schemas_1.mcpInput)(schemas.getRegionServiceAvailabilitySchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).account.getRegionServiceAvailability(params.regionId);
return JSON.stringify(result, null, 2);
})
});
// Account cancellation
server.addTool({
name: 'cancel_account',
description: 'Cancel your account',
parameters: (0, schemas_1.mcpInput)(schemas.cancelAccountSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
await (0, client_1.createClient)(context).account.cancelAccount(params);
return JSON.stringify({ success: true }, null, 2);
})
});
// Event operations
server.addTool({
name: 'list_events',
description: 'List account events',
parameters: (0, schemas_1.mcpInput)(schemas.listEventsSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const paginationParams = {
page: params.page,
page_size: params.page_size
};
const result = await (0, client_1.createClient)(context).account.getEvents(paginationParams);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'get_event',
description: 'Get a specific event',
parameters: (0, schemas_1.mcpInput)(schemas.getEventSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).account.getEvent(params.eventId);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'mark_event_as_seen',
description: 'Mark an event as seen',
parameters: (0, schemas_1.mcpInput)(schemas.markEventAsSeenSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
await (0, client_1.createClient)(context).account.markEventAsSeen(params.eventId);
return JSON.stringify({ success: true }, null, 2);
})
});
// Invoice operations
server.addTool({
name: 'list_invoices',
description: 'List invoices',
parameters: (0, schemas_1.mcpInput)(schemas.listInvoicesSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const paginationParams = {
page: params.page,
page_size: params.page_size
};
const result = await (0, client_1.createClient)(context).account.getInvoices(paginationParams);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'get_invoice',
description: 'Get a specific invoice',
parameters: (0, schemas_1.mcpInput)(schemas.getInvoiceSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).account.getInvoice(params.invoiceId);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'list_invoice_items',
description: 'List items for a specific invoice',
parameters: (0, schemas_1.mcpInput)(schemas.listInvoiceItemsSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const { invoiceId, ...paginationParams } = params;
const result = await (0, client_1.createClient)(context).account.getInvoiceItems(invoiceId, paginationParams);
return JSON.stringify(result, null, 2);
})
});
// Login operations
server.addTool({
name: 'list_account_logins',
description: 'List account logins',
parameters: (0, schemas_1.mcpInput)(schemas.listAccountLoginsSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const paginationParams = {
page: params.page,
page_size: params.page_size
};
const result = await (0, client_1.createClient)(context).account.getLogins(paginationParams);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'get_account_login',
description: 'Get a specific account login',
parameters: (0, schemas_1.mcpInput)(schemas.getAccountLoginSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).account.getLogin(params.loginId);
return JSON.stringify(result, null, 2);
})
});
// Maintenance operations
server.addTool({
name: 'list_maintenances',
description: 'List maintenance events',
parameters: (0, schemas_1.mcpInput)(schemas.listMaintenancesSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const paginationParams = {
page: params.page,
page_size: params.page_size
};
const result = await (0, client_1.createClient)(context).account.getMaintenances(paginationParams);
return JSON.stringify(result, null, 2);
})
});
// Notification operations
server.addTool({
name: 'list_notifications',
description: 'List notifications',
parameters: (0, schemas_1.mcpInput)(schemas.listNotificationsSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).account.getNotifications();
return JSON.stringify(result, null, 2);
})
});
// OAuth client operations
server.addTool({
name: 'list_oauth_clients',
description: 'List OAuth clients',
parameters: (0, schemas_1.mcpInput)(schemas.listOAuthClientsSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const paginationParams = {
page: params.page,
page_size: params.page_size
};
const result = await (0, client_1.createClient)(context).account.getOAuthClients(paginationParams);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'create_oauth_client',
description: 'Create an OAuth client',
parameters: (0, schemas_1.mcpInput)(schemas.createOAuthClientSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).account.createOAuthClient(params);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'get_oauth_client',
description: 'Get an OAuth client',
parameters: (0, schemas_1.mcpInput)(schemas.getOAuthClientSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).account.getOAuthClient(params.clientId);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'update_oauth_client',
description: 'Update an OAuth client',
parameters: (0, schemas_1.mcpInput)(schemas.updateOAuthClientSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const { clientId, ...data } = params;
const result = await (0, client_1.createClient)(context).account.updateOAuthClient(clientId, data);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'delete_oauth_client',
description: 'Delete an OAuth client',
parameters: (0, schemas_1.mcpInput)(schemas.deleteOAuthClientSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
await (0, client_1.createClient)(context).account.deleteOAuthClient(params.clientId);
return JSON.stringify({ success: true }, null, 2);
})
});
server.addTool({
name: 'reset_oauth_client_secret',
description: 'Reset an OAuth client secret',
parameters: (0, schemas_1.mcpInput)(schemas.resetOAuthClientSecretSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).account.resetOAuthClientSecret(params.clientId);
return JSON.stringify(result, null, 2);
})
});
// Account settings operations
server.addTool({
name: 'get_account_settings',
description: 'Get account settings',
parameters: (0, schemas_1.mcpInput)(schemas.getAccountSettingsSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).account.getAccountSettings();
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'update_account_settings',
description: 'Update account settings',
parameters: (0, schemas_1.mcpInput)(schemas.updateAccountSettingsSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).account.updateAccountSettings(params);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'enable_managed_service',
description: 'Enable Linode Managed service',
parameters: (0, schemas_1.mcpInput)(schemas.enableManagedServiceSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
await (0, client_1.createClient)(context).account.enableManagedService();
return JSON.stringify({ success: true }, null, 2);
})
});
// Network transfer operations
server.addTool({
name: 'get_account_network_transfer',
description: 'Get network transfer information for the entire account',
parameters: (0, schemas_1.mcpInput)(schemas.getAccountNetworkTransferSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).account.getNetworkTransfer();
return JSON.stringify(result, null, 2);
})
});
// User operations
server.addTool({
name: 'list_users',
description: 'List users',
parameters: (0, schemas_1.mcpInput)(schemas.listUsersSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const paginationParams = {
page: params.page,
page_size: params.page_size
};
const result = await (0, client_1.createClient)(context).account.getUsers(paginationParams);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'create_user',
description: 'Create a user',
parameters: (0, schemas_1.mcpInput)(schemas.createUserSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).account.createUser(params);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'get_user',
description: 'Get a user',
parameters: (0, schemas_1.mcpInput)(schemas.getUserSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).account.getUser(params.username);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'update_user',
description: 'Update a user',
parameters: (0, schemas_1.mcpInput)(schemas.updateUserSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const { username, ...data } = params;
const result = await (0, client_1.createClient)(context).account.updateUser(username, data);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'delete_user',
description: 'Delete a user',
parameters: (0, schemas_1.mcpInput)(schemas.deleteUserSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
await (0, client_1.createClient)(context).account.deleteUser(params.username);
return JSON.stringify({ success: true }, null, 2);
})
});
server.addTool({
name: 'get_user_grants',
description: '[DEPRECATED] Get a user\'s grants. Use IAM role-permissions instead.',
parameters: (0, schemas_1.mcpInput)(schemas.getUserGrantsSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).account.getUserGrants(params.username);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'update_user_grants',
description: '[DEPRECATED] Update a user\'s grants. Use IAM role-permissions instead.',
parameters: (0, schemas_1.mcpInput)(schemas.updateUserGrantsSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const { username, ...data } = params;
const updateData = data; // Type assertion to resolve the type mismatch
const result = await (0, client_1.createClient)(context).account.updateUserGrants(username, updateData);
return JSON.stringify(result, null, 2);
})
});
// Entity operations
server.addTool({
name: 'list_entities',
description: 'List entities associated with your account',
parameters: (0, schemas_1.mcpInput)(schemas.listEntitiesSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const paginationParams = {
page: params.page,
page_size: params.page_size
};
const result = await (0, client_1.createClient)(context).account.getEntities(paginationParams);
return JSON.stringify(result, null, 2);
})
});
// IAM Role Permission operations
server.addTool({
name: 'list_iam_roles',
description: 'List available IAM roles and their permissions',
parameters: (0, schemas_1.mcpInput)(schemas.listIamRolesSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).account.getIamRoles();
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'get_user_role_permissions',
description: 'Get a user\'s IAM role permissions and access level',
parameters: (0, schemas_1.mcpInput)(schemas.getUserRolePermissionsSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).account.getUserRolePermissions(params.username);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'update_user_role_permissions',
description: 'Update a user\'s IAM role permissions and access level',
parameters: (0, schemas_1.mcpInput)(schemas.updateUserRolePermissionsSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const { username, ...data } = params;
const result = await (0, client_1.createClient)(context).account.updateUserRolePermissions(username, data);
return JSON.stringify(result, null, 2);
})
});
// Delegation Child Account operations
server.addTool({
name: 'list_delegation_child_accounts',
description: 'List child accounts for delegation',
parameters: (0, schemas_1.mcpInput)(schemas.listDelegationChildAccountsSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const paginationParams = {
page: params.page,
page_size: params.page_size
};
const result = await (0, client_1.createClient)(context).account.getDelegationChildAccounts(paginationParams);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'get_delegation_child_account_users',
description: 'Get the account delegation for a child account',
parameters: (0, schemas_1.mcpInput)(schemas.getDelegationChildAccountUsersSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).account.getDelegationChildAccountUsers(params.euuid);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'update_delegation_child_account_users',
description: 'Update the account delegation for a child account',
parameters: (0, schemas_1.mcpInput)(schemas.updateDelegationChildAccountUsersSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const { euuid, ...data } = params;
const result = await (0, client_1.createClient)(context).account.updateDelegationChildAccountUsers(euuid, data);
return JSON.stringify(result, null, 2);
})
});
// Delegation Default Roles operations
server.addTool({
name: 'get_delegation_default_roles',
description: 'Get the default role assignment for delegate users',
parameters: (0, schemas_1.mcpInput)(schemas.getDelegationDefaultRolesSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).account.getDelegationDefaultRoles();
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'update_delegation_default_roles',
description: 'Update the default role assignment for delegate users',
parameters: (0, schemas_1.mcpInput)(schemas.updateDelegationDefaultRolesSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).account.updateDelegationDefaultRoles(params);
return JSON.stringify(result, null, 2);
})
});
// Delegation Profile operations
server.addTool({
name: 'list_delegation_profile_accounts',
description: 'Get your account delegations',
parameters: (0, schemas_1.mcpInput)(schemas.listDelegationProfileAccountsSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const paginationParams = {
page: params.page,
page_size: params.page_size
};
const result = await (0, client_1.createClient)(context).account.getDelegationProfileAccounts(paginationParams);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'get_delegation_profile_account',
description: 'Get a child account from your delegations',
parameters: (0, schemas_1.mcpInput)(schemas.getDelegationProfileAccountSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).account.getDelegationProfileAccount(params.euuid);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'create_delegation_token',
description: 'Create a delegate user token for a child account',
parameters: (0, schemas_1.mcpInput)(schemas.createDelegationTokenSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).account.createDelegationToken(params.euuid);
return JSON.stringify(result, null, 2);
})
});
// User Delegations operations
server.addTool({
name: 'get_user_delegations',
description: 'Get a user\'s account delegations',
parameters: (0, schemas_1.mcpInput)(schemas.getUserDelegationsSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).account.getUserDelegations(params.username);
return JSON.stringify(result, null, 2);
})
});
// Maintenance Policy operations
server.addTool({
name: 'list_maintenance_policies',
description: 'List maintenance policies',
parameters: (0, schemas_1.mcpInput)(schemas.listMaintenancePoliciesSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const paginationParams = {
page: params.page,
page_size: params.page_size
};
const result = await (0, client_1.createClient)(context).account.getMaintenancePolicies(paginationParams);
return JSON.stringify(result, null, 2);
})
});
// Resource Lock operations
server.addTool({
name: 'list_resource_locks',
description: 'List resource locks on the account',
parameters: (0, schemas_1.mcpInput)(schemas.listResourceLocksSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const paginationParams = {
page: params.page,
page_size: params.page_size
};
const result = await (0, client_1.createClient)(context).account.getResourceLocks(paginationParams);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'get_resource_lock',
description: 'Get a specific resource lock',
parameters: (0, schemas_1.mcpInput)(schemas.getResourceLockSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).account.getResourceLock(params.resourceLockId);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'create_resource_lock',
description: 'Create a resource lock',
parameters: (0, schemas_1.mcpInput)(schemas.createResourceLockSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).account.createResourceLock(params);
return JSON.stringify(result, null, 2);
})
});
server.addTool({
name: 'delete_resource_lock',
description: 'Delete a resource lock',
parameters: (0, schemas_1.mcpInput)(schemas.deleteResourceLockSchema),
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
await (0, client_1.createClient)(context).account.deleteResourceLock(params.resourceLockId);
return JSON.stringify({ success: true }, null, 2);
})
});
}
//# sourceMappingURL=tools.js.map