mcpField
H
hostinger-tools

hostinger-tools

github.com/bsamiee云与 DevOps298 次安装6 天前更新
代码仓库

关于 hostinger-tools

hostinger-tools 是通过 Python 封装调用 Hostinger API 的技能,面向管理 Hostinger 服务的运维人员。它涵盖 VPS、托管、域名、DNS 和账单等命令行操作。

主要功能

  1. 01管理 VPS 状态与配置
  2. 02查看和操作 Docker 项目
  3. 03配置防火墙与 SSH 密钥
  4. 04管理快照和备份
  5. 05处理域名、DNS 与账单

适用场景

  1. 01重启 VPS 并查看其指标
  2. 02创建防火墙规则并关联 SSH 密钥
  3. 03查看 DNS 记录或配置域名转发
  4. 04查看订阅并设置付款方式

MCP 相关

README 提到 Hostinger 另有 MCP 服务;此技能通过 Python 封装调用 Hostinger API。

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/bsamiee/parametric_forge --skill hostinger-tools

安装后在 Claude Code 中输入/hostinger-tools确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

scripts/
_billing_dispatch.py
_dns_dispatch.py
_docker_dispatch.py
_vps_dispatch.py
hostinger.py

详细介绍

[H1][HOSTINGER-TOOLS]

通过 Python 封装调用 Hostinger API,使用 HOSTINGER_TOKEN 环境变量。基础 URL:https://developers.hostinger.com。

[IMPORTANT] 不带参数的命令默认使用 page=1、limit=30。使用 --key value 标志语法。Hostinger 还提供 MCP 服务和 n8n 节点用于自动化。

[01]-[VPS_CORE]

uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py vps-list
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py vps-view --id 1196440
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py vps-start --id 1196440
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py vps-stop --id 1196440
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py vps-restart --id 1196440
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py vps-metrics --id 1196440 --from 2025-01-01 --to 2025-01-07
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py vps-actions --id 1196440
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py vps-action-view --id 1196440 --action-id 71183700

[02]-[VPS_CONFIG]

uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py vps-hostname-set --id 1196440 --hostname myserver.example.com
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py vps-hostname-reset --id 1196440
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py vps-nameservers-set --id 1196440 --ns1 8.8.8.8 --ns2 8.8.4.4
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py vps-password-set --id 1196440 --password "SecurePass123!"
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py vps-panel-password-set --id 1196440 --password "PanelPass123!"
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py vps-ptr-create --id 1196440 --ip-id 1154886 --domain mail.example.com
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py vps-ptr-delete --id 1196440 --ip-id 1154886

[03]-[VPS_RECOVERY]

uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py vps-recovery-start --id 1196440 --root-password "TempPass123!"
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py vps-recovery-stop --id 1196440
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py vps-recreate --id 1196440 --template-id 1007 --password "NewPass123!"

[04]-[DOCKER]

uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py docker-list --id 1196440
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py docker-view --id 1196440 --project myapp
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py docker-containers --id 1196440 --project myapp
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py docker-logs --id 1196440 --project myapp
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py docker-create --id 1196440 --project myapp --content "version: '3'..."
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py docker-start --id 1196440 --project myapp
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py docker-stop --id 1196440 --project myapp
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py docker-restart --id 1196440 --project myapp
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py docker-update --id 1196440 --project myapp
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py docker-delete --id 1196440 --project myapp

[05]-[FIREWALL]

uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py firewall-list
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py firewall-view --id 12345
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py firewall-create --name "Web Server"
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py firewall-delete --id 12345
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py firewall-activate --firewall-id 12345 --vps-id 1196440
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py firewall-deactivate --firewall-id 12345 --vps-id 1196440
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py firewall-sync --firewall-id 12345 --vps-id 1196440
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py firewall-rule-create --id 12345 --protocol SSH --port 22 --source any --source-detail any
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py firewall-rule-update --id 12345 --rule-id 67890 --protocol TCP --port 443 --source any --source-detail any
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py firewall-rule-delete --id 12345 --rule-id 67890

[06]-[SSH_KEYS]

uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py ssh-key-list
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py ssh-key-create --name "MacBook" --key "ssh-ed25519 AAAA..."
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py ssh-key-delete --id 380228
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py ssh-key-attach --key-ids 380228 --vps-id 1196440
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py ssh-key-attached --vps-id 1196440

[07]-[SCRIPTS]

uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py script-list
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py script-view --id 12345
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py script-create --name "Setup" --content "#!/bin/bash\napt update"
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py script-update --id 12345 --name "Setup v2" --content "#!/bin/bash\napt upgrade"
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py script-delete --id 12345

[08]-[SNAPSHOTS]

uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py snapshot-view --id 1196440
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py snapshot-create --id 1196440
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py snapshot-delete --id 1196440
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py snapshot-restore --id 1196440
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py backup-list --id 1196440
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py backup-restore --id 1196440 --backup-id 67890

[09]-[DNS]

uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py dns-records --domain example.com
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py dns-snapshots --domain example.com

[10]-[DOMAINS]

uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py domain-list
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py domain-view --domain example.com
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py domain-check --domain example --tlds com,net,io

[11]-[DOMAIN_EXTENDED]

uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py domain-lock-enable --domain example.com
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py domain-lock-disable --domain example.com
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py domain-privacy-enable --domain example.com
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py domain-privacy-disable --domain example.com
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py domain-forwarding-view --domain example.com
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py domain-forwarding-create --domain example.com --redirect-url https://target.com --redirect-type 301
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py domain-forwarding-delete --domain example.com
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py domain-nameservers-set --domain example.com --ns1 ns1.hostinger.com --ns2 ns2.hostinger.com

[12]-[WHOIS]

uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py whois-list
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py whois-list --tld com
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py whois-view --id 12345
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py whois-create --tld com --entity-type individual --country US --whois-details '{"first_name":"John"}'
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py whois-delete --id 12345
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py whois-usage --id 12345

[13]-[BILLING]

uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py billing-catalog
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py billing-catalog --category VPS
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py billing-payment-methods
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py billing-payment-method-set-default --id 40404360
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py billing-payment-method-delete --id 40404360
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py billing-subscriptions
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py billing-subscription-cancel --id AzqaEWV5FiDYT4Ka3
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py billing-auto-renewal-enable --id AzqaEWV5FiDYT4Ka3
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py billing-auto-renewal-disable --id AzqaEWV5FiDYT4Ka3

[14]-[HOSTING]

uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py hosting-orders-list
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py hosting-websites-list
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py hosting-website-create --domain mysite.com --order-id 12345
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py hosting-website-create --domain mysite.com --order-id 12345 --datacenter us
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py hosting-datacenters-list --order-id 12345

[15]-[REFERENCE]

uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py datacenter-list
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py template-list
uv run $CLAUDE_HOME/skills/hostinger-tools/scripts/hostinger.py template-view --id 1007

[16]-[OUTPUT]

命令返回:{"status": "success|error", ...}。

[INDEX][PATTERN][RESPONSE]
[01]列出命令{items: object[]}
[02]查看命令{id: int, item: object}
[03]操作命令{id: int, action: bool}
[04]创建命令{id: int, created: bool}

[17]-[ENVIRONMENT]

[VAR][REQUIRED][DESCRIPTION]
HOSTINGER_TOKEN是Hostinger API bearer token

[18]-[ERROR_HANDLING]

  • HTTP 错误会打印 [ERROR] <status>: <body> 并以状态码 1 退出
  • 缺少令牌:[ERROR] HOSTINGER_TOKEN environment variable not set
  • 未找到 VPS:[ERROR] 404: Virtual machine not found
  • 操作待处理:[ERROR] 409: Action already in progress;请等待操作完成

评论

支持 Markdown