UNPKG

@takashito/linode-mcp-server

Version:

MCP server for Linode API

320 lines 18.2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getLinodeInterfaceSchema = exports.listLinodeInterfacesSchema = exports.listNetworkTransferPricesSchema = exports.deleteVLANSchema = exports.deleteIPv6RangeSchema = exports.createIPv6RangeSchema = exports.shareIPv4AddressesSchema = exports.assignIPv4AddressesSchema = exports.assignIPsSchema = exports.getFirewallTemplateSchema = exports.listFirewallTemplatesSchema = exports.updateFirewallSettingsSchema = exports.getFirewallSettingsSchema = exports.getFirewallRuleVersionSchema = exports.listFirewallHistorySchema = exports.getFirewallDeviceSchema = exports.deleteFirewallDeviceSchema = exports.createFirewallDeviceSchema = exports.getFirewallDevicesSchema = exports.updateFirewallRulesSchema = exports.getFirewallRulesSchema = exports.deleteFirewallSchema = exports.updateFirewallSchema = exports.createFirewallSchema = exports.getFirewallSchema = exports.getFirewallsSchema = exports.getVLANSchema = exports.getVLANsSchema = exports.getIPv6PoolsSchema = exports.getIPv6RangeSchema = exports.getIPv6RangesSchema = exports.getIPAddressSchema = exports.getIPAddressesSchema = exports.vlansResponseSchema = exports.ipv6PoolsResponseSchema = exports.ipv6RangesResponseSchema = exports.firewallDevicesResponseSchema = exports.firewallsResponseSchema = exports.vlanSchema = exports.firewallDeviceSchema = exports.firewallSchema = exports.firewallRulesSchema = exports.firewallRuleSchema = exports.shareIPsSchema = exports.updateIPSchema = exports.allocateIPSchema = exports.ipv6PoolSchema = exports.ipv6RangeSchema = exports.ipAddressesResponseSchema = exports.ipAddressSchema = void 0; exports.upgradeLinodeInterfacesSchema = exports.listLinodeInterfaceFirewallsSchema = exports.updateLinodeInterfaceSettingsSchema = exports.getLinodeInterfaceSettingsSchema = exports.listLinodeInterfaceHistorySchema = exports.deleteLinodeInterfaceSchema = exports.updateLinodeInterfaceSchema = exports.createLinodeInterfaceSchema = void 0; const zod_1 = require("zod"); const schemas_1 = require("../common/schemas"); // IP Address schemas exports.ipAddressSchema = zod_1.z.object({ address: zod_1.z.string().describe('The IP address'), gateway: zod_1.z.string().nullable().describe('The gateway'), subnet_mask: zod_1.z.string().nullable().describe('The subnet mask'), prefix: zod_1.z.coerce.number().nullable().describe('The prefix'), type: zod_1.z.string().describe('The type of IP address'), public: (0, schemas_1.coerceBoolean)().describe('Whether the IP is public'), rdns: zod_1.z.string().nullable().describe('The reverse DNS entry'), linode_id: zod_1.z.coerce.number().nullable().describe('The ID of the Linode this IP is assigned to'), region: zod_1.z.string().nullable().describe('The region this IP is in') }); exports.ipAddressesResponseSchema = zod_1.z.object({ ipv4: zod_1.z.object({ public: zod_1.z.array(exports.ipAddressSchema), private: zod_1.z.array(exports.ipAddressSchema), shared: zod_1.z.array(exports.ipAddressSchema) }), ipv6: zod_1.z.object({ slaac: exports.ipAddressSchema, link_local: exports.ipAddressSchema, ranges: zod_1.z.array(zod_1.z.object({ range: zod_1.z.string(), region: zod_1.z.string(), prefix: zod_1.z.coerce.number(), route_target: zod_1.z.string().nullable() })) }) }); exports.ipv6RangeSchema = zod_1.z.object({ range: zod_1.z.string().describe('The IPv6 range'), prefix: zod_1.z.coerce.number().describe('The prefix length'), region: zod_1.z.string().describe('The region of the IPv6 range'), route_target: zod_1.z.string().nullable().describe('The route target') }); exports.ipv6PoolSchema = zod_1.z.object({ range: zod_1.z.string().describe('The IPv6 pool'), prefix: zod_1.z.coerce.number().describe('The prefix length'), region: zod_1.z.string().describe('The region of the IPv6 pool') }); exports.allocateIPSchema = zod_1.z.object({ type: zod_1.z.literal('ipv4').describe('Type of IP address (currently only ipv4 is supported)'), public: (0, schemas_1.coerceBoolean)().describe('Whether the IP should be public'), linode_id: zod_1.z.coerce.number().describe('The ID of the Linode to assign the IP to') }); exports.updateIPSchema = zod_1.z.object({ address: zod_1.z.string().describe('The IP address'), rdns: zod_1.z.string().nullable().describe('The reverse DNS entry') }); exports.shareIPsSchema = zod_1.z.object({ linode_id: zod_1.z.coerce.number().describe('The ID of the Linode to share IPs with'), ips: zod_1.z.array(zod_1.z.string()).describe('The IPs to share') }); // Firewall schemas exports.firewallRuleSchema = zod_1.z.object({ ports: zod_1.z.string().describe('The ports this rule applies to'), protocol: zod_1.z.enum(['TCP', 'UDP', 'ICMP']).describe('The network protocol'), addresses: zod_1.z.object({ ipv4: zod_1.z.array(zod_1.z.string()).optional().describe('IPv4 addresses or ranges'), ipv6: zod_1.z.array(zod_1.z.string()).optional().describe('IPv6 addresses or ranges') }).describe('The IPs and ranges this rule applies to'), action: zod_1.z.enum(['ACCEPT', 'DROP']).describe('The action for this rule') }); exports.firewallRulesSchema = zod_1.z.object({ inbound_policy: zod_1.z.enum(['ACCEPT', 'DROP']).describe('Default inbound policy'), outbound_policy: zod_1.z.enum(['ACCEPT', 'DROP']).describe('Default outbound policy'), inbound: zod_1.z.array(exports.firewallRuleSchema).optional().describe('Inbound rules'), outbound: zod_1.z.array(exports.firewallRuleSchema).optional().describe('Outbound rules') }); exports.firewallSchema = zod_1.z.object({ id: zod_1.z.coerce.number().describe('The ID of the Firewall'), label: zod_1.z.string().describe('The label of the Firewall'), created: zod_1.z.string().describe('When the Firewall was created'), updated: zod_1.z.string().describe('When the Firewall was last updated'), status: zod_1.z.string().describe('The status of the Firewall'), rules: exports.firewallRulesSchema, tags: zod_1.z.array(zod_1.z.string()).describe('Tags applied to the Firewall') }); exports.firewallDeviceSchema = zod_1.z.object({ id: zod_1.z.coerce.number().describe('The ID of the Firewall Device'), entity_id: zod_1.z.coerce.number().describe('The ID of the entity'), type: zod_1.z.enum(['linode', 'nodebalancer']).describe('The type of the entity'), label: zod_1.z.string().describe('The label of the entity'), url: zod_1.z.string().describe('The URL of the entity'), created: zod_1.z.string().describe('When the Firewall Device was created'), updated: zod_1.z.string().describe('When the Firewall Device was last updated') }); exports.vlanSchema = zod_1.z.object({ id: zod_1.z.string().describe('The ID of the VLAN'), description: zod_1.z.string().describe('The description of the VLAN'), region: zod_1.z.string().describe('The region of the VLAN'), linodes: zod_1.z.array(zod_1.z.coerce.number()).describe('The Linodes attached to this VLAN'), created: zod_1.z.string().describe('When the VLAN was created') }); // Paginated responses exports.firewallsResponseSchema = zod_1.z.object({ data: zod_1.z.array(exports.firewallSchema), page: zod_1.z.coerce.number(), pages: zod_1.z.coerce.number(), results: zod_1.z.coerce.number() }); exports.firewallDevicesResponseSchema = zod_1.z.object({ data: zod_1.z.array(exports.firewallDeviceSchema), page: zod_1.z.coerce.number(), pages: zod_1.z.coerce.number(), results: zod_1.z.coerce.number() }); exports.ipv6RangesResponseSchema = zod_1.z.object({ data: zod_1.z.array(exports.ipv6RangeSchema), page: zod_1.z.coerce.number(), pages: zod_1.z.coerce.number(), results: zod_1.z.coerce.number() }); exports.ipv6PoolsResponseSchema = zod_1.z.object({ data: zod_1.z.array(exports.ipv6PoolSchema), page: zod_1.z.coerce.number(), pages: zod_1.z.coerce.number(), results: zod_1.z.coerce.number() }); exports.vlansResponseSchema = zod_1.z.object({ data: zod_1.z.array(exports.vlanSchema), page: zod_1.z.coerce.number(), pages: zod_1.z.coerce.number(), results: zod_1.z.coerce.number() }); // Request schemas exports.getIPAddressesSchema = zod_1.z.object({ ...schemas_1.pagingParamsSchema.shape }); exports.getIPAddressSchema = zod_1.z.object({ address: zod_1.z.string().describe('The IP address') }); exports.getIPv6RangesSchema = zod_1.z.object({ ...schemas_1.pagingParamsSchema.shape }); exports.getIPv6RangeSchema = zod_1.z.object({ range: zod_1.z.string().describe('The IPv6 range') }); exports.getIPv6PoolsSchema = zod_1.z.object({ ...schemas_1.pagingParamsSchema.shape }); exports.getVLANsSchema = zod_1.z.object({ ...schemas_1.pagingParamsSchema.shape }); exports.getVLANSchema = zod_1.z.object({ regionId: zod_1.z.string().describe('The region ID'), label: zod_1.z.string().describe('The VLAN label') }); exports.getFirewallsSchema = zod_1.z.object({ ...schemas_1.pagingParamsSchema.shape }); exports.getFirewallSchema = zod_1.z.object({ id: zod_1.z.coerce.number().describe('The ID of the firewall') }); exports.createFirewallSchema = zod_1.z.object({ label: zod_1.z.string().describe(`The label for the firewall. Must begin and end with an alphanumeric character. May only consist of alphanumeric characters, hyphens (-), underscores (_) or periods (.). Cannot have two hyphens (--), underscores (__) or periods (..) in a row. Must be between 3 and 32 characters. Must be unique.`), rules: exports.firewallRulesSchema, devices: zod_1.z.object({ linodes: zod_1.z.array(zod_1.z.coerce.number()).optional().describe('Array of Linode IDs'), nodebalancers: zod_1.z.array(zod_1.z.coerce.number()).optional().describe('Array of NodeBalancer IDs') }).optional().describe('Devices to assign to this firewall'), tags: zod_1.z.array(zod_1.z.string()).optional().describe('Tags to apply to the firewall') }); exports.updateFirewallSchema = zod_1.z.object({ id: zod_1.z.coerce.number().describe('The ID of the firewall'), label: zod_1.z.string().optional().describe('The label for the firewall'), tags: zod_1.z.array(zod_1.z.string()).optional().describe('Tags to apply to the firewall'), status: zod_1.z.enum(['enabled', 'disabled']).optional().describe('The status of the firewall') }); exports.deleteFirewallSchema = zod_1.z.object({ id: zod_1.z.coerce.number().describe('The ID of the firewall') }); exports.getFirewallRulesSchema = zod_1.z.object({ firewallId: zod_1.z.coerce.number().describe('The ID of the firewall') }); exports.updateFirewallRulesSchema = zod_1.z.object({ firewallId: zod_1.z.coerce.number().describe('The ID of the firewall'), inbound_policy: zod_1.z.enum(['ACCEPT', 'DROP']).optional().describe('Default inbound policy'), outbound_policy: zod_1.z.enum(['ACCEPT', 'DROP']).optional().describe('Default outbound policy'), inbound: zod_1.z.array(exports.firewallRuleSchema).optional().describe('Inbound rules'), outbound: zod_1.z.array(exports.firewallRuleSchema).optional().describe('Outbound rules') }); exports.getFirewallDevicesSchema = zod_1.z.object({ firewallId: zod_1.z.coerce.number().describe('The ID of the firewall'), ...schemas_1.pagingParamsSchema.shape }); exports.createFirewallDeviceSchema = zod_1.z.object({ firewallId: zod_1.z.coerce.number().describe('The ID of the firewall'), id: zod_1.z.coerce.number().describe('The ID of the entity'), type: zod_1.z.enum(['linode', 'nodebalancer']).describe('The type of entity') }); exports.deleteFirewallDeviceSchema = zod_1.z.object({ firewallId: zod_1.z.coerce.number().describe('The ID of the firewall'), deviceId: zod_1.z.coerce.number().describe('The ID of the device') }); exports.getFirewallDeviceSchema = zod_1.z.object({ firewallId: zod_1.z.coerce.number().describe('The ID of the firewall'), deviceId: zod_1.z.coerce.number().describe('The ID of the device') }); // Firewall history schemas exports.listFirewallHistorySchema = zod_1.z.object({ firewallId: zod_1.z.coerce.number().describe('The ID of the firewall'), ...schemas_1.pagingParamsSchema.shape }); exports.getFirewallRuleVersionSchema = zod_1.z.object({ firewallId: zod_1.z.coerce.number().describe('The ID of the firewall'), version: zod_1.z.coerce.number().describe('The version number of the firewall rule') }); // Firewall settings schemas exports.getFirewallSettingsSchema = zod_1.z.object({}); exports.updateFirewallSettingsSchema = zod_1.z.object({ settings: zod_1.z.array(zod_1.z.record(zod_1.z.any())).describe('Array of default firewall settings to update') }); // Firewall template schemas exports.listFirewallTemplatesSchema = zod_1.z.object({}); exports.getFirewallTemplateSchema = zod_1.z.object({ slug: zod_1.z.string().describe('The slug identifier of the firewall template') }); // IP assignment schema exports.assignIPsSchema = zod_1.z.object({ assignments: zod_1.z.array(zod_1.z.object({ address: zod_1.z.string().describe('The IP address to assign'), linode_id: zod_1.z.coerce.number().describe('The ID of the Linode to assign the IP to'), region: zod_1.z.string().describe('The region of the Linode') })).describe('Array of IP assignment objects') }); // IPv4 operation schemas exports.assignIPv4AddressesSchema = zod_1.z.object({ assignments: zod_1.z.array(zod_1.z.object({ address: zod_1.z.string().describe('The IPv4 address to assign'), linode_id: zod_1.z.coerce.number().describe('The ID of the Linode to assign the IP to'), region: zod_1.z.string().describe('The region of the Linode') })).describe('Array of IPv4 assignment objects') }); exports.shareIPv4AddressesSchema = zod_1.z.object({ ips: zod_1.z.array(zod_1.z.string()).describe('Array of IPv4 addresses to share'), linode_id: zod_1.z.coerce.number().describe('The ID of the Linode to share the IPs with') }); // IPv6 range operation schemas exports.createIPv6RangeSchema = zod_1.z.object({ linode_id: zod_1.z.coerce.number().describe('The ID of the Linode to create the IPv6 range for'), prefix_length: zod_1.z.coerce.number().describe('The prefix length for the IPv6 range (e.g. 56 or 64)') }); exports.deleteIPv6RangeSchema = zod_1.z.object({ range: zod_1.z.string().describe('The IPv6 range to delete') }); // VLAN delete schema exports.deleteVLANSchema = zod_1.z.object({ regionId: zod_1.z.string().describe('The region ID of the VLAN'), label: zod_1.z.string().describe('The label of the VLAN') }); // Network Transfer Prices schema exports.listNetworkTransferPricesSchema = zod_1.z.object({}); // Linode Interface schemas exports.listLinodeInterfacesSchema = zod_1.z.object({ linodeId: zod_1.z.coerce.number().describe('The ID of the Linode') }); exports.getLinodeInterfaceSchema = zod_1.z.object({ linodeId: zod_1.z.coerce.number().describe('The ID of the Linode'), interfaceId: zod_1.z.coerce.number().describe('The ID of the interface') }); exports.createLinodeInterfaceSchema = zod_1.z.object({ linodeId: zod_1.z.coerce.number().describe('The ID of the Linode'), default_route: zod_1.z.object({ ipv4: (0, schemas_1.coerceBoolean)().optional().describe('Whether this interface is the default route for IPv4'), ipv6: (0, schemas_1.coerceBoolean)().optional().describe('Whether this interface is the default route for IPv6') }).optional().describe('Default route configuration'), subnet: zod_1.z.object({ id: zod_1.z.coerce.number().optional().describe('The ID of the subnet') }).optional().describe('Subnet configuration'), public: zod_1.z.record(zod_1.z.any()).optional().describe('Public interface configuration with ipv4/ipv6 settings'), vpc: zod_1.z.record(zod_1.z.any()).optional().describe('VPC interface configuration with subnet and ipv4 settings') }); exports.updateLinodeInterfaceSchema = zod_1.z.object({ linodeId: zod_1.z.coerce.number().describe('The ID of the Linode'), interfaceId: zod_1.z.coerce.number().describe('The ID of the interface'), default_route: zod_1.z.object({ ipv4: (0, schemas_1.coerceBoolean)().optional().describe('Whether this interface is the default route for IPv4'), ipv6: (0, schemas_1.coerceBoolean)().optional().describe('Whether this interface is the default route for IPv6') }).optional().describe('Default route configuration'), subnet: zod_1.z.object({ id: zod_1.z.coerce.number().optional().describe('The ID of the subnet') }).optional().describe('Subnet configuration'), public: zod_1.z.record(zod_1.z.any()).optional().describe('Public interface configuration with ipv4/ipv6 settings'), vpc: zod_1.z.record(zod_1.z.any()).optional().describe('VPC interface configuration with subnet and ipv4 settings') }); exports.deleteLinodeInterfaceSchema = zod_1.z.object({ linodeId: zod_1.z.coerce.number().describe('The ID of the Linode'), interfaceId: zod_1.z.coerce.number().describe('The ID of the interface') }); exports.listLinodeInterfaceHistorySchema = zod_1.z.object({ linodeId: zod_1.z.coerce.number().describe('The ID of the Linode'), ...schemas_1.pagingParamsSchema.shape }); exports.getLinodeInterfaceSettingsSchema = zod_1.z.object({ linodeId: zod_1.z.coerce.number().describe('The ID of the Linode') }); exports.updateLinodeInterfaceSettingsSchema = zod_1.z.object({ linodeId: zod_1.z.coerce.number().describe('The ID of the Linode'), settings: zod_1.z.record(zod_1.z.any()).describe('Interface settings to update') }); exports.listLinodeInterfaceFirewallsSchema = zod_1.z.object({ linodeId: zod_1.z.coerce.number().describe('The ID of the Linode'), interfaceId: zod_1.z.coerce.number().describe('The ID of the interface') }); exports.upgradeLinodeInterfacesSchema = zod_1.z.object({ linodeId: zod_1.z.coerce.number().describe('The ID of the Linode') }); //# sourceMappingURL=schemas.js.map