@takashito/linode-mcp-server
Version:
MCP server for Linode API
406 lines • 16.5 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.answerSecurityQuestionsSchema = exports.getSecurityQuestionsSchema = exports.SecurityQuestionSchema = exports.updateUserPreferencesSchema = exports.getUserPreferencesSchema = exports.UserPreferencesSchema = exports.verifyPhoneNumberSchema = exports.sendPhoneVerificationSchema = exports.deletePhoneNumberSchema = exports.getLoginSchema = exports.listLoginsSchema = exports.LoginSchema = exports.listGrantsSchema = exports.GrantSchema = exports.revokeTrustedDeviceSchema = exports.getTrustedDeviceSchema = exports.listTrustedDevicesSchema = exports.TrustedDeviceSchema = exports.revokeAuthorizedAppSchema = exports.getAuthorizedAppSchema = exports.listAuthorizedAppsSchema = exports.AuthorizedAppSchema = exports.ScopeListResponseSchema = exports.listAPIScopesSchema = exports.ScopeSchema = exports.API_SCOPES = exports.disableTwoFactorSchema = exports.enableTwoFactorSchema = exports.getTwoFactorSecretSchema = exports.TwoFactorResponseSchema = exports.deleteTokenSchema = exports.updateTokenSchema = exports.createPersonalAccessTokenSchema = exports.getAPITokenSchema = exports.listAPITokensSchema = exports.APITokenSchema = exports.deleteSSHKeySchema = exports.updateSSHKeySchema = exports.createSSHKeySchema = exports.getSSHKeySchema = exports.listSSHKeysSchema = exports.SSHKeySchema = exports.updateProfileSchema = exports.getProfileSchema = exports.UserProfileSchema = void 0;
const zod_1 = require("zod");
// Profile schemas
exports.UserProfileSchema = zod_1.z.object({
username: zod_1.z.string(),
email: zod_1.z.string().email(),
timezone: zod_1.z.string(),
email_notifications: zod_1.z.boolean(),
restricted: zod_1.z.boolean(),
two_factor_auth: zod_1.z.boolean(),
referrals: zod_1.z.object({
total: zod_1.z.number(),
completed: zod_1.z.number(),
pending: zod_1.z.number(),
credit: zod_1.z.number(),
code: zod_1.z.string(),
url: zod_1.z.string()
}),
authorized_keys: zod_1.z.array(zod_1.z.string())
});
// Get profile schema
exports.getProfileSchema = zod_1.z.object({});
// Update profile schema
exports.updateProfileSchema = zod_1.z.object({
email: zod_1.z.string().email().optional().describe('Your email address'),
timezone: zod_1.z.string().optional().describe('Your timezone in IANA format (e.g. America/New_York)'),
email_notifications: zod_1.z.boolean().optional().describe('Whether you want to receive email notifications'),
restricted: zod_1.z.boolean().optional().describe('Whether your account has restricted access')
});
// SSH Key schemas
exports.SSHKeySchema = zod_1.z.object({
id: zod_1.z.number(),
label: zod_1.z.string(),
ssh_key: zod_1.z.string(),
created: zod_1.z.string()
});
// List SSH Keys schema
exports.listSSHKeysSchema = zod_1.z.object({
page: zod_1.z.number().optional().describe('Page number of results to return'),
page_size: zod_1.z.number().optional().describe('Number of results to return per page')
});
// Get SSH Key schema
exports.getSSHKeySchema = zod_1.z.object({
id: zod_1.z.number().describe('ID of the SSH key')
});
// Create SSH Key schema
exports.createSSHKeySchema = zod_1.z.object({
label: zod_1.z.string().describe('A label for the SSH key'),
ssh_key: zod_1.z.string().describe('The public SSH key')
});
// Update SSH Key schema
exports.updateSSHKeySchema = zod_1.z.object({
id: zod_1.z.number().describe('ID of the SSH key to update'),
label: zod_1.z.string().describe('A new label for the SSH key')
});
// Delete SSH Key schema
exports.deleteSSHKeySchema = zod_1.z.object({
id: zod_1.z.number().describe('ID of the SSH key to delete')
});
// API Token schemas
exports.APITokenSchema = zod_1.z.object({
id: zod_1.z.number(),
label: zod_1.z.string(),
created: zod_1.z.string(),
expiry: zod_1.z.string().nullable(),
token: zod_1.z.string().optional(),
scopes: zod_1.z.array(zod_1.z.string()),
website: zod_1.z.string().optional(),
thumbnail_url: zod_1.z.string().optional()
});
// List API Tokens schema
exports.listAPITokensSchema = zod_1.z.object({
page: zod_1.z.number().optional().describe('Page number of results to return'),
page_size: zod_1.z.number().optional().describe('Number of results to return per page')
});
// Get API Token schema
exports.getAPITokenSchema = zod_1.z.object({
id: zod_1.z.number().describe('ID of the API token')
});
// Create Personal Access Token schema
exports.createPersonalAccessTokenSchema = zod_1.z.object({
label: zod_1.z.string().describe('A label for the API token'),
expiry: zod_1.z.string().optional().describe('The expiry date for the token in ISO 8601 format (e.g. 2022-12-31T23:59:59)'),
scopes: zod_1.z.array(zod_1.z.string()).describe('The permissions this token has')
});
// Update Token schema
exports.updateTokenSchema = zod_1.z.object({
id: zod_1.z.number().describe('ID of the API token to update'),
label: zod_1.z.string().optional().describe('A new label for the API token'),
expiry: zod_1.z.string().optional().describe('A new expiry date for the token in ISO 8601 format'),
scopes: zod_1.z.array(zod_1.z.string()).optional().describe('The new permissions for this token')
});
// Delete Token schema
exports.deleteTokenSchema = zod_1.z.object({
id: zod_1.z.number().describe('ID of the API token to delete')
});
// Two-Factor Authentication schemas
exports.TwoFactorResponseSchema = zod_1.z.object({
secret: zod_1.z.string(),
service_name: zod_1.z.string(),
qr_code: zod_1.z.string()
});
// Get Two-Factor Secret schema
exports.getTwoFactorSecretSchema = zod_1.z.object({});
// Enable Two-Factor schema
exports.enableTwoFactorSchema = zod_1.z.object({
tfa_code: zod_1.z.string().describe('The code generated by your authentication app'),
scratch_code: zod_1.z.string().optional().describe('A scratch code for emergency access')
});
// Disable Two-Factor schema
exports.disableTwoFactorSchema = zod_1.z.object({
tfa_code: zod_1.z.string().describe('The code generated by your authentication app')
});
// List of all available API scopes
exports.API_SCOPES = [
{
name: 'account:read_only',
description: 'Allows access to GET information about your account.',
category: 'Account'
},
{
name: 'account:read_write',
description: 'Allows access to all operations related to your account.',
category: 'Account'
},
{
name: 'databases:read_only',
description: 'Allows access to GET managed databases on your account.',
category: 'Databases'
},
{
name: 'databases:read_write',
description: 'Allows access to all operations related to your managed databases.',
category: 'Databases'
},
{
name: 'domains:read_only',
description: 'Allows access to GET domains on your account.',
category: 'Domains'
},
{
name: 'domains:read_write',
description: 'Allows access to all domain operations.',
category: 'Domains'
},
{
name: 'events:read_only',
description: 'Allows access to GET your events.',
category: 'Events'
},
{
name: 'events:read_write',
description: 'Allows access to all operations related to your events.',
category: 'Events'
},
{
name: 'firewall:read_only',
description: 'Allows access to GET information about your firewalls.',
category: 'Firewall'
},
{
name: 'firewall:read_write',
description: 'Allows access to all firewall operations.',
category: 'Firewall'
},
{
name: 'images:read_only',
description: 'Allows access to GET your images.',
category: 'Images'
},
{
name: 'images:read_write',
description: 'Allows access to all operations related to your images.',
category: 'Images'
},
{
name: 'ips:read_only',
description: 'Allows access to GET your IPs.',
category: 'IPs'
},
{
name: 'ips:read_write',
description: 'Allows access to all operations related to your IPs.',
category: 'IPs'
},
{
name: 'linodes:read_only',
description: 'Allows access to GET Linodes on your account.',
category: 'Linodes'
},
{
name: 'linodes:read_write',
description: 'Allow access to all operations related to your Linodes.',
category: 'Linodes'
},
{
name: 'lke:read_only',
description: 'Allows access to GET LKE clusters on your account.',
category: 'LKE'
},
{
name: 'lke:read_write',
description: 'Allows access to all operations related to LKE clusters on your account.',
category: 'LKE'
},
{
name: 'longview:read_only',
description: 'Allows access to GET your Longview clients.',
category: 'Longview'
},
{
name: 'longview:read_write',
description: 'Allows access to all operations related to your Longview clients.',
category: 'Longview'
},
{
name: 'nodebalancers:read_only',
description: 'Allows access to GET NodeBalancers on your account.',
category: 'NodeBalancers'
},
{
name: 'nodebalancers:read_write',
description: 'Allows access to all NodeBalancer operations.',
category: 'NodeBalancers'
},
{
name: 'object_storage:read_only',
description: 'Allows access to GET information related to your Object Storage.',
category: 'Object Storage'
},
{
name: 'object_storage:read_write',
description: 'Allows access to all Object Storage operations.',
category: 'Object Storage'
},
{
name: 'stackscripts:read_only',
description: 'Allows access to GET your StackScripts.',
category: 'StackScripts'
},
{
name: 'stackscripts:read_write',
description: 'Allows access to all operations related to your StackScripts.',
category: 'StackScripts'
},
{
name: 'volumes:read_only',
description: 'Allows access to GET your volumes.',
category: 'Volumes'
},
{
name: 'volumes:read_write',
description: 'Allows access to all operations related to your volumes.',
category: 'Volumes'
},
{
name: 'vpc:read_only',
description: 'Allows access to GET VPC and subnet information.',
category: 'VPC'
},
{
name: 'vpc:read_write',
description: 'Allows access to all operations related to VPC and subnet creation, updating, and deletion',
category: 'VPC'
}
];
// API Scope schema
exports.ScopeSchema = zod_1.z.object({
name: zod_1.z.string(),
description: zod_1.z.string(),
category: zod_1.z.string()
});
// List API Scopes schema
exports.listAPIScopesSchema = zod_1.z.object({
category: zod_1.z.string().optional().describe('Filter scopes by category (e.g., "Linodes", "Volumes", "NodeBalancers")')
});
// Scope Response schema
exports.ScopeListResponseSchema = zod_1.z.object({
scopes: zod_1.z.array(exports.ScopeSchema)
});
// Authorized App schemas
exports.AuthorizedAppSchema = zod_1.z.object({
id: zod_1.z.number(),
label: zod_1.z.string(),
thumbnail_url: zod_1.z.string(),
access: zod_1.z.string(),
scopes: zod_1.z.array(zod_1.z.string()),
website: zod_1.z.string(),
created: zod_1.z.string(),
expiry: zod_1.z.string()
});
// List Authorized Apps schema
exports.listAuthorizedAppsSchema = zod_1.z.object({
page: zod_1.z.number().optional().describe('Page number of results to return'),
page_size: zod_1.z.number().optional().describe('Number of results to return per page')
});
// Get Authorized App schema
exports.getAuthorizedAppSchema = zod_1.z.object({
appId: zod_1.z.number().describe('ID of the authorized app')
});
// Revoke Authorized App schema
exports.revokeAuthorizedAppSchema = zod_1.z.object({
appId: zod_1.z.number().describe('ID of the authorized app to revoke')
});
// Trusted Device schemas
exports.TrustedDeviceSchema = zod_1.z.object({
id: zod_1.z.number(),
user_agent: zod_1.z.string(),
last_remote_addr: zod_1.z.string(),
last_authenticated: zod_1.z.string(),
created: zod_1.z.string(),
expiry: zod_1.z.string()
});
// List Trusted Devices schema
exports.listTrustedDevicesSchema = zod_1.z.object({
page: zod_1.z.number().optional().describe('Page number of results to return'),
page_size: zod_1.z.number().optional().describe('Number of results to return per page')
});
// Get Trusted Device schema
exports.getTrustedDeviceSchema = zod_1.z.object({
deviceId: zod_1.z.number().describe('ID of the trusted device')
});
// Revoke Trusted Device schema
exports.revokeTrustedDeviceSchema = zod_1.z.object({
deviceId: zod_1.z.number().describe('ID of the trusted device to revoke')
});
// Grant schemas
exports.GrantSchema = zod_1.z.object({
id: zod_1.z.number(),
permissions: zod_1.z.string(),
label: zod_1.z.string(),
entity: zod_1.z.object({
id: zod_1.z.number(),
type: zod_1.z.string(),
label: zod_1.z.string()
})
});
// List Grants schema
exports.listGrantsSchema = zod_1.z.object({
page: zod_1.z.number().optional().describe('Page number of results to return'),
page_size: zod_1.z.number().optional().describe('Number of results to return per page')
});
// Login schemas
exports.LoginSchema = zod_1.z.object({
id: zod_1.z.number(),
ip: zod_1.z.string(),
datetime: zod_1.z.string(),
username: zod_1.z.string(),
status: zod_1.z.string()
});
// List Logins schema
exports.listLoginsSchema = zod_1.z.object({
page: zod_1.z.number().optional().describe('Page number of results to return'),
page_size: zod_1.z.number().optional().describe('Number of results to return per page')
});
// Get Login schema
exports.getLoginSchema = zod_1.z.object({
loginId: zod_1.z.number().describe('ID of the login')
});
// Phone Number schemas
exports.deletePhoneNumberSchema = zod_1.z.object({});
exports.sendPhoneVerificationSchema = zod_1.z.object({
phone_number: zod_1.z.string().describe('The phone number to verify in E.164 format (e.g. +14155551234)')
});
exports.verifyPhoneNumberSchema = zod_1.z.object({
otp_code: zod_1.z.string().describe('The one-time password sent to the phone number')
});
// User Preferences schemas
exports.UserPreferencesSchema = zod_1.z.object({
sortKeys: zod_1.z.record(zod_1.z.string()).optional(),
timezone: zod_1.z.string().optional(),
email_notifications: zod_1.z.boolean().optional(),
default_from_email: zod_1.z.string().optional(),
authorized_keys: zod_1.z.array(zod_1.z.string()).optional(),
theme: zod_1.z.string().optional(),
editorMode: zod_1.z.string().optional()
});
// Get User Preferences schema
exports.getUserPreferencesSchema = zod_1.z.object({});
// Update User Preferences schema
exports.updateUserPreferencesSchema = zod_1.z.object({
sortKeys: zod_1.z.record(zod_1.z.string()).optional().describe('Sort keys for different views'),
timezone: zod_1.z.string().optional().describe('Your timezone in IANA format (e.g. America/New_York)'),
email_notifications: zod_1.z.boolean().optional().describe('Whether you want to receive email notifications'),
default_from_email: zod_1.z.string().optional().describe('Default email to use as from address'),
authorized_keys: zod_1.z.array(zod_1.z.string()).optional().describe('Authorized SSH keys'),
theme: zod_1.z.string().optional().describe('UI theme preference'),
editorMode: zod_1.z.string().optional().describe('Editor mode preference')
});
// Security Question schemas
exports.SecurityQuestionSchema = zod_1.z.object({
id: zod_1.z.number(),
question: zod_1.z.string()
});
// Get Security Questions schema
exports.getSecurityQuestionsSchema = zod_1.z.object({});
// Answer Security Questions schema
exports.answerSecurityQuestionsSchema = zod_1.z.object({
answers: zod_1.z.array(zod_1.z.object({
question_id: zod_1.z.number().describe('ID of the security question'),
answer: zod_1.z.string().describe('Answer to the security question')
})).describe('Answers to security questions')
});
//# sourceMappingURL=schemas.js.map