UNPKG

@takashito/linode-mcp-server

Version:

MCP server for Linode API

206 lines 10.8 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); 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; 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.number().nullable().describe('The prefix'), type: zod_1.z.string().describe('The type of IP address'), public: zod_1.z.boolean().describe('Whether the IP is public'), rdns: zod_1.z.string().nullable().describe('The reverse DNS entry'), linode_id: zod_1.z.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.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.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.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: zod_1.z.boolean().describe('Whether the IP should be public'), linode_id: zod_1.z.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.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.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.number().describe('The ID of the Firewall Device'), entity_id: zod_1.z.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.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.number(), pages: zod_1.z.number(), results: zod_1.z.number() }); exports.firewallDevicesResponseSchema = zod_1.z.object({ data: zod_1.z.array(exports.firewallDeviceSchema), page: zod_1.z.number(), pages: zod_1.z.number(), results: zod_1.z.number() }); exports.ipv6RangesResponseSchema = zod_1.z.object({ data: zod_1.z.array(exports.ipv6RangeSchema), page: zod_1.z.number(), pages: zod_1.z.number(), results: zod_1.z.number() }); exports.ipv6PoolsResponseSchema = zod_1.z.object({ data: zod_1.z.array(exports.ipv6PoolSchema), page: zod_1.z.number(), pages: zod_1.z.number(), results: zod_1.z.number() }); exports.vlansResponseSchema = zod_1.z.object({ data: zod_1.z.array(exports.vlanSchema), page: zod_1.z.number(), pages: zod_1.z.number(), results: zod_1.z.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.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.number()).optional().describe('Array of Linode IDs'), nodebalancers: zod_1.z.array(zod_1.z.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.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.number().describe('The ID of the firewall') }); exports.getFirewallRulesSchema = zod_1.z.object({ firewallId: zod_1.z.number().describe('The ID of the firewall') }); exports.updateFirewallRulesSchema = zod_1.z.object({ firewallId: zod_1.z.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.number().describe('The ID of the firewall'), ...schemas_1.pagingParamsSchema.shape }); exports.createFirewallDeviceSchema = zod_1.z.object({ firewallId: zod_1.z.number().describe('The ID of the firewall'), id: zod_1.z.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.number().describe('The ID of the firewall'), deviceId: zod_1.z.number().describe('The ID of the device') }); //# sourceMappingURL=schemas.js.map