A Model Context Protocol (MCP) server for interacting with the BinaryLane VPS hosting API.
- Comprehensive API Coverage: 70+ tools covering all BinaryLane API endpoints
- Input Validation: Zod schema validation with descriptive error messages
- Tool Annotations: Proper hints for read-only, destructive, and idempotent operations
- Actionable Errors: Clear error messages with suggestions for resolution
- Well-Documented: Every tool includes detailed descriptions with examples
Before installing binarylane-mcp, ensure you have:
- Node.js 18.0.0 or higher - Check with
node --version - npm or yarn package manager
Install Node.js from:
- macOS/Windows: https://nodejs.org/
- Linux: https://nodejs.org/en/download/package-manager/
npm install
npm run buildSet your BinaryLane API token as an environment variable:
export BINARYLANE_API_TOKEN="your-api-token-here"Get your API token from: https://home.binarylane.com.au/api-info
Add to your Claude Desktop configuration (~/.config/claude/claude_desktop_config.json):
{
"mcpServers": {
"binarylane": {
"command": "node",
"args": ["/path/to/bl-mcp/dist/index.js"],
"env": {
"BINARYLANE_API_TOKEN": "your-api-token-here"
}
}
}
}npm startget_account- Get account informationget_balance- Get current balance and usagelist_invoices- List all invoicesget_invoice- Get specific invoice detailsget_unpaid_invoices- Get unpaid failed invoicesproceed_action- Respond to pending actions
list_servers- List all VPS serversget_server- Get server detailscreate_server- Create a new serverdelete_server- Cancel/delete a serverserver_action- Perform server actions (power, backup, resize, etc.)list_server_actions- List server action historyget_server_action- Get specific action statusget_server_backups- List server backupsget_server_snapshots- List server snapshotsupload_backup- Upload external backupget_server_firewall- Get firewall rulesget_server_console- Get VNC console accessget_data_usage- Get data transfer usagelist_all_data_usage- List usage for all serversget_server_kernels- List available kernelsget_server_features- Get available featuresget_server_threshold_alerts- Get resource alertslist_exceeded_alerts- List servers with exceeded alertsget_server_software- Get installed softwareget_server_user_data- Get cloud-init dataget_server_metrics- Get performance metricsget_server_latest_metrics- Get latest metrics
New servers have outbound port blocking enabled by default, which blocks common spam/attack ports. This will prevent:
- HTTPS outbound connections (apt, wget, curl over HTTPS)
- DNS resolution in some cases
- SSL certificate renewal (certbot, Let's Encrypt)
If your server needs outbound connectivity, set port_blocking: false during creation or use the change_port_blocking server action.
list_images- List OS images and backupsget_image- Get image detailsdelete_image- Delete backup imageupdate_image- Update image metadataget_image_download- Get download URL
IMPORTANT: BinaryLane image slugs do NOT include architecture suffixes.
✅ Correct format:
ubuntu-24.04(not ubuntu-24.04-x64)debian-12(not debian-12-amd64)fedora-40centos-stream-9
❌ Incorrect format:
- Architecture suffixes not usedubuntu-24.04-x64- Architecture handled by server plandebian-12-arm64
list_ssh_keys- List SSH keysget_ssh_key- Get SSH key detailscreate_ssh_key- Add new SSH keyupdate_ssh_key- Update SSH keydelete_ssh_key- Delete SSH key
list_domains- List DNS domainsget_domain- Get domain detailscreate_domain- Add new domaindelete_domain- Remove domainlist_domain_records- List DNS recordsget_domain_record- Get record detailscreate_domain_record- Create DNS recordupdate_domain_record- Update DNS recorddelete_domain_record- Delete DNS recordlist_nameservers- List BinaryLane nameserversrefresh_nameserver_cache- Refresh DNS cachelist_ipv6_reverse_names- List IPv6 PTR recordsupdate_ipv6_reverse- Update IPv6 PTR record
TTL Constraints: BinaryLane DNS supports a TTL range of 3600-86400 seconds (1-24 hours), with 3600 seconds (1 hour) as the standard and default value. The minimum TTL is 3600 seconds.
list_vpcs- List VPCsget_vpc- Get VPC detailscreate_vpc- Create new VPCupdate_vpc- Update VPC settingsdelete_vpc- Delete VPCget_vpc_members- List VPC members
list_load_balancers- List load balancersget_load_balancer- Get load balancer detailscreate_load_balancer- Create load balancerupdate_load_balancer- Update load balancerdelete_load_balancer- Delete load balancerget_load_balancer_availability- Check availability/pricingadd_servers_to_load_balancer- Add backend serversremove_servers_from_load_balancer- Remove backend serversadd_forwarding_rules- Add forwarding rulesremove_forwarding_rules- Remove forwarding rules
BinaryLane load balancers are anycast and regionless. After creating a load balancer:
- Do NOT specify a region parameter when creating (causes IP allocation errors)
- Each backend server MUST have the LB's anycast IP configured on its loopback interface:
ip addr add <LB_IP>/32 dev lo
- Persist the VIP with netplan (create
/etc/netplan/60-lb-loopback.yaml):network: version: 2 ethernets: lo: addresses: - <LB_IP>/32
- Health check hostname defaults to the LB name. If backends use server_name matching, update the health check hostname to your actual domain.
Without the loopback VIP, health checks will fail and traffic will not be forwarded.
list_regions- List available regionslist_sizes- List server sizes and pricinglist_actions- List recent actionsget_action- Get action details
list_software- List available softwareget_software- Get software detailslist_software_for_os- List software for specific OS
The server_action tool supports many action types:
Power Actions: power_on, power_off, reboot, shutdown, power_cycle
Status Checks: ping, uptime, is_running
Backup Actions: take_backup, restore, enable_backups, disable_backups, attach_backup, detach_backup, clone_using_backup
Configuration: rebuild, resize, rename, change_region, change_kernel
Network: enable_ipv6, change_ipv6, change_port_blocking, change_network, change_vpc_ipv4, change_reverse_name
Disk Operations: add_disk, resize_disk, delete_disk
Advanced: change_advanced_features, change_advanced_firewall_rules, change_threshold_alerts
BinaryLane firewalls are STATELESS with NO implicit deny. Critical requirements:
- Rules are evaluated in order (first match wins)
- MUST include explicit DROP rules at the end or all traffic is allowed
- MUST allow UDP 53 (DNS) before any UDP DROP or servers cannot resolve hostnames
- DB-only servers still need HTTP/HTTPS rules for apt to work
- Web servers need TCP 3306 ACCEPT for MySQL return traffic (stateless)
Example: SSH, HTTP, HTTPS, DNS, ICMP allowed, all else blocked:
[
{"source_addresses": ["0.0.0.0/0"], "destination_addresses": ["0.0.0.0/0"], "destination_ports": ["22"], "protocol": "tcp", "action": "accept"},
{"source_addresses": ["0.0.0.0/0"], "destination_addresses": ["0.0.0.0/0"], "destination_ports": ["80"], "protocol": "tcp", "action": "accept"},
{"source_addresses": ["0.0.0.0/0"], "destination_addresses": ["0.0.0.0/0"], "destination_ports": ["443"], "protocol": "tcp", "action": "accept"},
{"source_addresses": ["0.0.0.0/0"], "destination_addresses": ["0.0.0.0/0"], "protocol": "icmp", "action": "accept"},
{"source_addresses": ["0.0.0.0/0"], "destination_addresses": ["0.0.0.0/0"], "destination_ports": ["53"], "protocol": "udp", "action": "accept"},
{"source_addresses": ["0.0.0.0/0"], "destination_addresses": ["0.0.0.0/0"], "protocol": "tcp", "action": "drop"},
{"source_addresses": ["0.0.0.0/0"], "destination_addresses": ["0.0.0.0/0"], "protocol": "udp", "action": "drop"}
]This section provides step-by-step instructions for common tasks using the MCP tools.
- Create the server with port_blocking disabled for outbound HTTPS:
create_server({
name: "web-app-1",
region: "syd",
image: "ubuntu-24.04",
size: "vps-1vcpu-1gb",
port_blocking: false // Enable outbound HTTPS
})- Wait for server to be active, then configure firewall:
server_action({
server_id: <server_id>,
type: "change_advanced_firewall_rules",
firewall_rules: [
{source_addresses: ["0.0.0.0/0"], destination_ports: ["22"], protocol: "tcp", action: "accept"},
{source_addresses: ["0.0.0.0/0"], destination_ports: ["80"], protocol: "tcp", action: "accept"},
{source_addresses: ["0.0.0.0/0"], destination_ports: ["443"], protocol: "tcp", action: "accept"},
{source_addresses: ["0.0.0.0/0"], destination_ports: ["53"], protocol: "udp", action: "accept"},
{source_addresses: ["0.0.0.0/0"], protocol: "tcp", action: "drop"},
{source_addresses: ["0.0.0.0/0"], protocol: "udp", action: "drop"}
]
})- Create backend servers:
create_server({name: "app-1", region: "syd", image: "ubuntu-24.04", size: "vps-2vcpu-4gb"})
create_server({name: "app-2", region: "mel", image: "ubuntu-24.04", size: "vps-2vcpu-4gb"})- Create load balancer (regionless/anycast):
create_load_balancer({
name: "app-lb",
forwarding_rules: [{entry_protocol: "http", entry_port: 80, target_protocol: "http", target_port: 80}],
health_check: {protocol: "http", port: 80, path: "/health"}
})- Add servers to load balancer:
add_servers_to_load_balancer({
load_balancer_id: <lb_id>,
server_ids: [<app_1_id>, <app_2_id>]
})- Configure loopback VIP on each backend (required): SSH to each server and run:
ip addr add <LB_IP>/32 dev lo
# Persist with netplan in /etc/netplan/60-lb-loopback.yaml- Take a snapshot:
server_action({
server_id: <server_id>,
type: "take_backup",
backup_type: "snapshot",
label: "pre-upgrade-backup"
})- Restore from backup:
server_action({
server_id: <server_id>,
type: "restore",
image: <backup_id>
})# Build
npm run build
# Watch mode (development)
npm run devProblem: API calls fail with 401/403 errors Solutions:
- Verify token is set:
echo $BINARYLANE_API_TOKEN - Check token format (should be raw token, not wrapped in quotes)
- Regenerate token in BinaryLane console if expired
- Test with
get_accounttool to verify authentication
Problem: create_server returns validation or quota errors
Solutions:
- Use
list_regionsto verify valid region codes - Use
list_sizesto get valid size slugs - Check account limits with
get_account - Ensure image slug format is correct (no architecture suffix)
Problem: DNS changes don't propagate Solutions:
- TTL minimum is 3600 seconds (1 hour) on BinaryLane
- Allow 24-48 hours for global propagation
- Use
refresh_nameserver_cacheto force cache update - Clear local DNS cache for testing
Problem: Backends marked unhealthy Solutions:
- Ensure loopback VIP is configured on each backend (
ip addr add <LB_IP>/32 dev lo) - Verify application listens on all interfaces (0.0.0.0, not just public IP)
- Check health check path returns 200 OK
- Review firewall rules don't block health check traffic
Problem: Server loses network after firewall changes Solutions:
- Remember firewalls are stateless - need explicit rules for both directions
- No implicit deny - must add explicit DROP rules at end
- Include UDP 53 (DNS) before UDP DROP rule
- Test incrementally, starting with SSH access
bl-mcp/
├── src/
│ ├── index.ts # Main entry point
│ ├── api-client.ts # BinaryLane API client
│ ├── tools.ts # Tool definitions with annotations
│ ├── handlers.ts # Tool handler implementations
│ └── schemas.ts # Zod validation schemas
├── dist/ # Compiled JavaScript
├── package.json
└── tsconfig.json
For detailed API documentation, see: https://api.binarylane.com.au/reference/
MIT