From 7cb556fc04eb22c717719cc9c8bda5481e5bea2b Mon Sep 17 00:00:00 2001 From: Arnas Donauskas Date: Wed, 30 Sep 2026 15:09:29 +0300 Subject: [PATCH] feat: ship the web hosting skills from hostinger/api-mcp-server The seven deployment skills named operations that hostinger-api-mcp renamed in 2.1.0 (hosting_listWebsitesV1, hosting_generateUploadURLV1 and the rest), so every step failed on the hosted server. Replace them with the seven web hosting skills published by hostinger/api-mcp-server, synced by scripts/sync-skills.mjs, and flag future drift in CI. --- .claude-plugin/plugin.json | 2 +- .github/workflows/skills-drift.yml | 32 +++++ README.md | 36 +++--- scripts/sync-skills.mjs | 69 +++++++++++ .../agency-hosting-deploy-php-site/SKILL.md | 74 ----------- .../SKILL.md | 87 ------------- skills/audit-hosting/SKILL.md | 83 +++++++++++++ skills/connect-domain/SKILL.md | 69 +++++++++++ skills/deploy-to-hosting/SKILL.md | 115 ++++++++++++++++++ skills/hosting-deploy-nodejs-app/SKILL.md | 99 --------------- skills/hosting-deploy-static-site/SKILL.md | 74 ----------- .../hosting-deploy-wordpress-plugin/SKILL.md | 73 ----------- skills/hosting-deploy-wordpress-site/SKILL.md | 96 --------------- .../hosting-deploy-wordpress-theme/SKILL.md | 71 ----------- skills/hostinger-headless/SKILL.md | 56 +++++++++ .../hostinger-headless/references/DATABASE.md | 49 ++++++++ .../references/DEPLOYMENT.md | 36 ++++++ skills/hostinger-headless/references/SETUP.md | 35 ++++++ skills/hostinger-headless/references/STORE.md | 52 ++++++++ .../references/WORDPRESS.md | 51 ++++++++ skills/maintain-wordpress/SKILL.md | 74 +++++++++++ skills/migrate-to-hosting/SKILL.md | 80 ++++++++++++ skills/troubleshoot-website/SKILL.md | 104 ++++++++++++++++ 23 files changed, 926 insertions(+), 591 deletions(-) create mode 100644 .github/workflows/skills-drift.yml create mode 100755 scripts/sync-skills.mjs delete mode 100644 skills/agency-hosting-deploy-php-site/SKILL.md delete mode 100644 skills/agency-hosting-deploy-static-site/SKILL.md create mode 100644 skills/audit-hosting/SKILL.md create mode 100644 skills/connect-domain/SKILL.md create mode 100644 skills/deploy-to-hosting/SKILL.md delete mode 100644 skills/hosting-deploy-nodejs-app/SKILL.md delete mode 100644 skills/hosting-deploy-static-site/SKILL.md delete mode 100644 skills/hosting-deploy-wordpress-plugin/SKILL.md delete mode 100644 skills/hosting-deploy-wordpress-site/SKILL.md delete mode 100644 skills/hosting-deploy-wordpress-theme/SKILL.md create mode 100644 skills/hostinger-headless/SKILL.md create mode 100644 skills/hostinger-headless/references/DATABASE.md create mode 100644 skills/hostinger-headless/references/DEPLOYMENT.md create mode 100644 skills/hostinger-headless/references/SETUP.md create mode 100644 skills/hostinger-headless/references/STORE.md create mode 100644 skills/hostinger-headless/references/WORDPRESS.md create mode 100644 skills/maintain-wordpress/SKILL.md create mode 100644 skills/migrate-to-hosting/SKILL.md create mode 100644 skills/troubleshoot-website/SKILL.md diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index 8e1f727..1bdce8e 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "hostinger", "description": "Deploy, manage and monitor Hostinger services — Websites, Domains & DNS, Ecommerce, Email, Email Marketing, WordPress, Subscriptions & Payments, and VPS. Runs as a remote MCP server with browser (OAuth) sign-in — nothing to install locally.", - "version": "1.2.0", + "version": "1.3.0", "author": { "name": "Hostinger", "url": "https://www.hostinger.com" diff --git a/.github/workflows/skills-drift.yml b/.github/workflows/skills-drift.yml new file mode 100644 index 0000000..ccc9cb5 --- /dev/null +++ b/.github/workflows/skills-drift.yml @@ -0,0 +1,32 @@ +name: skills-drift + +on: + pull_request: + push: + branches: [main] + schedule: + - cron: "0 6 * * 1" + +jobs: + skills-drift: + runs-on: ubuntu-latest + continue-on-error: true + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 22 + + - name: Regenerate skills from the latest published server + run: node scripts/sync-skills.mjs + + - name: Report drift + run: | + if [ -z "$(git status --porcelain -- skills)" ]; then + echo "Skills are up to date with hostinger-api-mcp@latest." + else + echo "::warning::skills/ is behind hostinger-api-mcp@latest." + echo "Run 'node scripts/sync-skills.mjs' and commit the result." + git status --short -- skills + fi diff --git a/README.md b/README.md index 65f88f9..ca2afaf 100644 --- a/README.md +++ b/README.md @@ -20,20 +20,22 @@ A single remote Hostinger MCP server at `https://mcp.hostinger.com`, covering: | Subscriptions & Payments | Subscriptions, payment methods, catalog, orders | | VPS | Virtual servers, firewalls, snapshots, monitoring | -Plus seven **deployment skills** that let the agent push your project files to -Hostinger and deploy them: +Plus seven **web hosting skills** for Shared, Cloud and Agency plans: | Skill | Use for | |---|---| -| `hosting-deploy-static-site` | Pre-built static site (no build step) | -| `hosting-deploy-nodejs-app` | Node.js app — built on Hostinger | -| `hosting-deploy-wordpress-site` | Import a WordPress site (archive + SQL dump) | -| `hosting-deploy-wordpress-plugin` | Deploy a WordPress plugin | -| `hosting-deploy-wordpress-theme` | Deploy a WordPress theme | -| `agency-hosting-deploy-static-site` | Agency Plan static / node-static site | -| `agency-hosting-deploy-php-site` | Agency Plan PHP app, deployed as-is | - -The agent picks the right one from your request — you don't invoke them by name. +| `troubleshoot-website` | A site that is down, slow, erroring, insecure or failing to build — cause and fix | +| `connect-domain` | Attach a domain, point DNS without losing email records, install SSL | +| `deploy-to-hosting` | Deploy static sites, Node.js apps, PHP apps, WordPress plugins and themes; Git auto-deploy, environment variables, databases | +| `maintain-wordpress` | Updates and vulnerability checks across one or all WordPress sites | +| `audit-hosting` | Read-only review of the whole hosting account with a prioritised to-do list | +| `migrate-to-hosting` | Move a site from another host, tested before DNS moves | +| `hostinger-headless` | Build a new site from a prompt, optionally with a store or a WordPress backend | + +The agent picks the right one from your request; you can also name a skill. The +skills come from [hostinger/api-mcp-server](https://github.com/hostinger/api-mcp-server) +and are synced into `skills/` with `node scripts/sync-skills.mjs` — change them +upstream, not here. ## Installation @@ -68,16 +70,18 @@ export HOSTINGER_API_TOKEN="your-token-here" The remote server can't read files off your machine, so deploys run in three stages, all driven by the agent: -1. **Get a short-lived upload URL** — `hosting_generateUploadURLV1` (or the - `agency-hosting` equivalent) returns a URL plus `auth_key` / `rest_auth_key`. +1. **Get a short-lived upload URL** — `hosting_files_generate-upload-url` (or + `agency-hosting_files_generate-upload-url`) returns a URL plus `auth_key` / + `rest_auth_key`. 2. **Upload the archive over TUS** — plain `curl`, authenticated with those keys. This is the one step with no tool wrapper, because it talks to the file-storage host directly. 3. **Trigger the deploy or build** — an MCP tool call referencing the uploaded - filename. + file, e.g. `hosting_websites_deploy-static-site-archive` or + `hosting_nodejs_start-build`. -The skills document each variant of this flow, including the destructive steps -that overwrite a site's contents. +The `deploy-to-hosting` skill documents each variant of this flow, including the +destructive steps that overwrite a site's contents. > **Deployment requires an agent with shell access**, since the upload step runs > `curl`. Everything else — domains, DNS, VPS, WordPress management, email — diff --git a/scripts/sync-skills.mjs b/scripts/sync-skills.mjs new file mode 100755 index 0000000..292d70a --- /dev/null +++ b/scripts/sync-skills.mjs @@ -0,0 +1,69 @@ +#!/usr/bin/env node + +import { execFileSync } from "node:child_process"; +import { cpSync, existsSync, mkdtempSync, readFileSync, readdirSync, rmSync, statSync } from "node:fs"; +import { tmpdir } from "node:os"; +import path from "node:path"; +import process from "node:process"; + +const source = process.argv[2] ?? "latest"; +const outDir = path.join(import.meta.dirname, "..", "skills"); +const work = mkdtempSync(path.join(tmpdir(), "hostinger-skills-")); + +function resolveSkillsRoot() { + if (existsSync(source) && statSync(source).isDirectory()) { + const root = path.resolve(source); + return { root, label: root }; + } + + const spec = `hostinger-api-mcp@${source}`; + const packed = execFileSync("npm", ["pack", spec, "--silent", "--pack-destination", work], { + encoding: "utf8", + }) + .trim() + .split("\n") + .pop(); + execFileSync("tar", ["xzf", path.join(work, packed), "-C", work]); + + const pkgRoot = path.join(work, "package"); + const { version } = JSON.parse(readFileSync(path.join(pkgRoot, "package.json"), "utf8")); + return { root: path.join(pkgRoot, "skills"), label: `hostinger-api-mcp@${version}` }; +} + +function skillName(skillFile) { + const text = readFileSync(skillFile, "utf8").replace(/\r\n/g, "\n"); + const end = text.indexOf("\n---\n", 4); + const frontmatter = text.startsWith("---\n") && end !== -1 ? text.slice(4, end) : ""; + const match = frontmatter.match(/^name:\s*["']?([a-z0-9]+(?:-[a-z0-9]+)*)["']?\s*$/m); + if (!match) { + throw new Error(`No valid name in the frontmatter of ${skillFile}`); + } + return match[1]; +} + +try { + const { root, label } = resolveSkillsRoot(); + const folders = readdirSync(root) + .filter((folder) => existsSync(path.join(root, folder, "SKILL.md"))) + .sort(); + if (folders.length === 0) { + throw new Error(`No skills found in ${root}`); + } + + rmSync(outDir, { recursive: true, force: true }); + + const names = []; + for (const folder of folders) { + const from = path.join(root, folder); + const name = skillName(path.join(from, "SKILL.md")); + cpSync(from, path.join(outDir, name), { + recursive: true, + filter: (src) => path.relative(from, src).split(path.sep)[0] !== "entry", + }); + names.push(name); + } + + console.log(`Synced ${names.length} skills from ${label}: ${names.join(", ")}`); +} finally { + rmSync(work, { recursive: true, force: true }); +} diff --git a/skills/agency-hosting-deploy-php-site/SKILL.md b/skills/agency-hosting-deploy-php-site/SKILL.md deleted file mode 100644 index 0ba1098..0000000 --- a/skills/agency-hosting-deploy-php-site/SKILL.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -name: agency-hosting-deploy-php-site -description: >- - Deploy a PHP (or other no-build) Agency Plan website from an archive via public-api, using - standalone MCP tools/plain curl instead of a filesystem-driven deploy tool. Use when asked to - deploy a PHP app to an Agency Plan / h5g / agency-hosting website. ---- - -# Deploy a PHP app to an Agency Plan website - -No filesystem access needed. Call the public-api MCP tools by name below — these need a Bearer -token and the target `domain`. The upload step has no tool wrapper: it hits the file-storage host -directly via TUS, authenticated with the `auth_key`/`rest_auth_key` from -`agency-hosting_generateUploadURLV1` (not the Bearer token), so it's always plain curl. - -## Tools used, in order - -| # | Tool | Notes | -|---|------|-------| -| 1 | `agency-hosting_listDomainsV1` | paginate, match `fqdn` → resolve `website_uid` | -| 2 | `agency-hosting_generateUploadURLV1` | no body → `{ url, auth_key, rest_auth_key }` | -| 3 | *(no tool — plain curl)* | TUS upload of the archive | -| 4 | `agency-hosting_importWebsiteFromArchiveV1` | body `{"archive_name"}` — **destructive** | - -## Steps - -1. **Resolve `website_uid`**: call `agency-hosting_listDomainsV1` with `page=1&per_page=100` - (paginate until found) → match the entry whose `fqdn` equals `domain`, take its `website_uid`. -2. **Get upload credentials**: call `agency-hosting_generateUploadURLV1` for that `website_uid` - — no request body — → `{ url, auth_key, rest_auth_key }`. -3. **Upload the archive via TUS** (plain curl — no MCP tool for this) to a **fixed path under - `.h5g/`** — no random directory for this flow, just `.h5g/{bare filename}` (e.g. `.h5g/app.zip`): - ``` - FILE=app.zip - SIZE=$(wc -c < "$FILE") - - curl -sS -i -X POST "${url}/.h5g/${FILE}?override=true" \ - -H "X-Auth: ${auth_key}" -H "X-Auth-Rest: ${rest_auth_key}" \ - -H "Tus-Resumable: 1.0.0" -H "Upload-Length: ${SIZE}" -H "Upload-Offset: 0" - - curl -sS -i -X PATCH "${url}/.h5g/${FILE}?override=true" \ - -H "X-Auth: ${auth_key}" -H "X-Auth-Rest: ${rest_auth_key}" \ - -H "Tus-Resumable: 1.0.0" -H "Content-Type: application/offset+octet-stream" \ - -H "Upload-Offset: 0" --data-binary "@${FILE}" - ``` - `?override=true` means re-deploying the same domain overwrites this same path rather than - accumulating files — no cleanup step needed after a successful import. -4. **Trigger import**: call `agency-hosting_importWebsiteFromArchiveV1` with body: - ```json - { "archive_name": "app.zip" } - ``` - `archive_name` must be a **bare filename** (no `/` or `\`) ending in `.zip`, `.tar`, `.tar.gz`, - or `.tgz` — do not pass the `.h5g/` prefix here, the server already knows where it was uploaded. - -## Verify - -``` -curl -s -o /dev/null -w "%{http_code}\n" https://{domain}/ -curl -s https://{domain}/ | grep -o "SOME_TEXT_YOU_ACTUALLY_DEPLOYED" -``` - -A `200` alone is not proof — a fresh or failed deploy can still serve a parking -page. Always grep for a string you know is in the files you just deployed. If it -does not match, call `agency-hosting_clearWebsiteCacheV1` and retry once before -reporting failure. - -## Warning - -**Destructive.** Website contents are overwritten by the archive contents — cannot be undone. -Confirm intent before step 4. - -## When it's the wrong tool - -- Site needs a Node.js build step → use **agency-hosting-deploy-static-site** instead. diff --git a/skills/agency-hosting-deploy-static-site/SKILL.md b/skills/agency-hosting-deploy-static-site/SKILL.md deleted file mode 100644 index fd522ca..0000000 --- a/skills/agency-hosting-deploy-static-site/SKILL.md +++ /dev/null @@ -1,87 +0,0 @@ ---- -name: agency-hosting-deploy-static-site -description: >- - Deploy a node-static Agency Plan website (Node.js-built static site, or a plain simple static - site) from an archive via public-api, using standalone MCP tools/plain curl instead of a - filesystem-driven deploy tool. Use when asked to deploy/build a static or node-static app on - an Agency Plan / h5g / agency-hosting website. ---- - -# Deploy a node-static app to an Agency Plan website - -No filesystem access needed. Call the public-api MCP tools by name below — these need a Bearer -token and the target `domain`. The upload step has no tool wrapper: it hits the file-storage host -directly via TUS, authenticated with the `auth_key`/`rest_auth_key` from -`agency-hosting_generateUploadURLV1` (not the Bearer token), so it's always plain curl. - -## Tools used, in order - -| # | Tool | Notes | -|---|------|-------| -| 1 | `agency-hosting_listDomainsV1` | paginate, match `fqdn` → resolve `website_uid` | -| 2 | `agency-hosting_generateUploadURLV1` | no body → `{ url, auth_key, rest_auth_key }` | -| 3 | *(no tool — plain curl)* | TUS upload of the archive into a scratch directory | -| 4 | `agency-hosting_buildWebsiteNodeJSAssetsV1` | body `{"archive_path"}` — **destructive** | - -## The "random directory" — what it actually is - -This flow needs a **scratch upload directory** under `.h5g/` that's unique per deploy, so -concurrent/repeated builds don't collide (unlike the PHP-app flow, which reuses one fixed path). -It has no special meaning server-side — any unique string works. The reference implementation -generates a 12-character random alphanumeric string (`Math.random()`-based, not a UUID); you can -do the same, e.g.: -``` -UPLOAD_DIR=".h5g/$(cat /dev/urandom | LC_ALL=C tr -dc 'A-Za-z0-9' | head -c 12)" -``` -The server deletes this directory automatically after a **successful** build; on failure it's -left in place for debugging. - -## Steps - -1. **Resolve `website_uid`**: call `agency-hosting_listDomainsV1` with `page=1&per_page=100` - (paginate until found) → match the entry whose `fqdn` equals `domain`, take its `website_uid`. -2. **Get upload credentials**: call `agency-hosting_generateUploadURLV1` for that `website_uid` - — no request body — → `{ url, auth_key, rest_auth_key }`. -3. **Upload the archive via TUS** (plain curl — no MCP tool for this) into the scratch directory - from above, e.g. `${UPLOAD_DIR}/app.zip`: - ``` - FILE=app.zip - SIZE=$(wc -c < "$FILE") - - curl -sS -i -X POST "${url}/${UPLOAD_DIR}/${FILE}?override=true" \ - -H "X-Auth: ${auth_key}" -H "X-Auth-Rest: ${rest_auth_key}" \ - -H "Tus-Resumable: 1.0.0" -H "Upload-Length: ${SIZE}" -H "Upload-Offset: 0" - - curl -sS -i -X PATCH "${url}/${UPLOAD_DIR}/${FILE}?override=true" \ - -H "X-Auth: ${auth_key}" -H "X-Auth-Rest: ${rest_auth_key}" \ - -H "Tus-Resumable: 1.0.0" -H "Content-Type: application/offset+octet-stream" \ - -H "Upload-Offset: 0" --data-binary "@${FILE}" - ``` -4. **Trigger build**: call `agency-hosting_buildWebsiteNodeJSAssetsV1` with body: - ```json - { "archive_path": ".h5g/AbCdEf012345" } - ``` - `archive_path` is the **scratch directory** from step 3 (not the filename) — the server scans - it for the archive to build. - -## Verify - -``` -curl -s -o /dev/null -w "%{http_code}\n" https://{domain}/ -curl -s https://{domain}/ | grep -o "SOME_TEXT_YOU_ACTUALLY_DEPLOYED" -``` - -A `200` alone is not proof — a fresh or failed deploy can still serve a parking -page. Always grep for a string you know is in the files you just deployed. If it -does not match, call `agency-hosting_clearWebsiteCacheV1` and retry once before -reporting failure. - -## Warning - -**Destructive.** On success, the build result overwrites the website's existing contents and is -deployed to `public_html` — cannot be undone. Confirm intent before step 4. - -## When it's the wrong tool - -- Site has no build step and should be deployed as-is → use **agency-hosting-deploy-php-site** - instead (fixed upload path, no scratch directory, no build step). diff --git a/skills/audit-hosting/SKILL.md b/skills/audit-hosting/SKILL.md new file mode 100644 index 0000000..fa71453 --- /dev/null +++ b/skills/audit-hosting/SKILL.md @@ -0,0 +1,83 @@ +--- +name: audit-hosting +description: "Audit a Hostinger web hosting account (Shared, Cloud and Agency plans) and report what needs attention: every plan and website, SSL problems, broken or vulnerable WordPress installs, failed Node.js builds and vulnerable npm packages, databases and Agency Plan orders near their limits, and hosting plans about to lapse. Read-only; produces a prioritised to-do list and names the skill that fixes each item. Triggers: what do I have on Hostinger, audit my hosting, check all my websites, what needs attention, health check my sites, are any of my sites broken, which of my sites are insecure." +--- + +# Audit hosting + +Read-only from start to finish. The output is a report; every fix is a separate, confirmed step through another skill. + +## Calling the operations + +- Read the `inputSchema` that `search` returns before the first call of each operation. If a name below is rejected as unknown, `search` for what the step does (e.g. "ssl status"). +- Batch reads with `multi-execute`, up to 20 steps a batch. Batches chain operations from one server only — the Hostinger Connector runs `hosting`, `wordpress`, `agency-hosting` and `billing` as separate servers. When a product group is switched off, skip its checks and say which were skipped. +- Page every list until `meta.total` is covered. +- Leave `hosting_php_get` out — it is large and says nothing about account health. + +## 1. Inventory + +One batch per server: + +- `hosting_orders_list` with `statuses: ["active", "suspended"]`. `cloud_*` plan names are Cloud; the rest (`hostinger_premium_*`, `hostinger_business_*`, …) are Shared. +- `hosting_websites_list` — every Shared and Cloud website with `website_type`, `username`, `order_id` and `is_enabled` (false means suspended). +- `wordpress_installations_list` with `ownership: "all"` — `id`, `is_valid`, `validation_error`. +- `agency-hosting_orders_list` and `agency-hosting_websites_list-plan` — Agency orders and sites (`details.uid`, `details.type`, `details.domains`, `details.state`). + +Tell the user the size (plans, websites, WordPress installs) before the checks. For large accounts offer to scope the audit to one order or domain. + +## 2. Checks + +Per Shared and Cloud website (skip `builder` and `horizons`): + +- `hosting_ssl_status` — flag `failed` (with `last_error`), `expired`, `not_installed` on a custom domain, `is_https_redirect_enabled: false`, and `expires_at` within 30 days when `is_lifetime` is false. Lifetime certificates renew on their own. +- Node.js sites: `hosting_nodejs_list-builds` with `per_page: 1` (latest build failed?) and `hosting_nodejs_list-vulnerabilities` with `severities: ["critical", "high"]`. + +Per hosting account (`username`): `hosting_databases_list` — flag `disk_usage_mb` above 80% of `max_size_mb`. + +Per WordPress install: `wordpress_installations_show-core-version` (core vulnerabilities) and `wordpress_plugins_list-installed` (vulnerable plugins and pending updates). + +Per Agency order: `agency-hosting_metrics_list-order-resource-usage` with `time_frame_hours: 168` and `agency-hosting_metrics_list-plan-order-disk-usage` with `time_frame_days: 7` — flag usage above 80% of the plan quota and name the heaviest websites. + +Per Agency site: `agency-hosting_ssl_website-status` for each custom domain in `details.domains`; flag `details.state` other than `active`. + +Plans about to lapse (billing product): `billing_subscriptions_list`, joined to hosting orders on `subscription_id` — flag `not_renewing`, or `is_auto_renewed: false` with `expires_at` within 30 days. Every site on that plan goes down with it. + +From outside, for each custom domain: + +```bash +curl -sS -o /dev/null -w "%{http_code}\n" --max-time 15 https://DOMAIN/ +curl -sSI --max-time 15 https://DOMAIN/ | grep -i "^platform" +``` + +No `platform: hostinger` header means the domain does not reach this hosting. + +## 3. Report + +``` +# Hosting audit +3 plans (2 Shared, 1 Cloud) + 1 Agency · 14 websites (6 WordPress, 3 Node.js, 5 other) · 4 Agency sites + +## Fix now +- shop.example.com — latest Node.js build failed 2 days ago → troubleshoot-website +- blog.example.com — contact-form-x 5.2 has a known vulnerability, fixed in 5.3 → maintain-wordpress + +## Soon +- example.org — Business plan expires in 12 days, auto-renew off → renew in hPanel +- Agency order 1000000001 — 86% of disk quota, mostly client-a.com + +## Worth knowing +- 4 WordPress installs have pending plugin updates → maintain-wordpress + +## Healthy +docs.example.com, portfolio.example.com, … +``` + +- **Fix now:** site down or not reaching Hostinger, failed latest build, invalid WordPress install, SSL `failed` or `expired`, critical vulnerabilities, suspended website. +- **Soon:** high vulnerabilities, a plan lapsing within 30 days, usage above 80% of a quota, HTTPS redirect off, non-lifetime certificates expiring. +- **Worth knowing:** pending updates, inactive plugins with vulnerabilities. + +Each item names the evidence and the skill that fixes it: `troubleshoot-website`, `maintain-wordpress`, `connect-domain` or `deploy-to-hosting`. Patchable npm vulnerabilities on GitHub-deployed sites can be fixed with `hosting_nodejs_patch-vulnerabilities`, which opens a pull request — offer it, do not run it as part of the audit. + +## Not available through the API + +CPU and memory usage for Shared and Cloud plans, website backup status, and PHP error logs. Mention them once at the end so the user knows what the audit could not see. diff --git a/skills/connect-domain/SKILL.md b/skills/connect-domain/SKILL.md new file mode 100644 index 0000000..1f4d5eb --- /dev/null +++ b/skills/connect-domain/SKILL.md @@ -0,0 +1,69 @@ +--- +name: connect-domain +description: "Connect a custom domain to a website on Hostinger web hosting (Shared, Cloud or Agency plans) end to end: attach the domain to the site, point DNS at Hostinger without breaking existing email or verification records, install SSL, turn on the HTTPS redirect, and verify it resolves. Handles domains registered at Hostinger or elsewhere, moving a site off its free *.hostingersite.com subdomain, subdomains and aliases. Triggers: connect my domain, point my domain to my site, use my own domain, move off the free subdomain, add a subdomain, park a domain, add a domain alias, my domain is not working." +--- + +# Connect a domain + +Get a domain serving a Hostinger website over HTTPS. The one rule that matters most: records that already work — email (`MX`), SPF, DKIM and verification `TXT` records — must survive every DNS change. + +## Calling the operations + +- Read the `inputSchema` that `search` returns before the first call of each operation. If a name below is rejected as unknown, `search` for what the step does (e.g. "dns records"). +- Batch reads with `multi-execute`; values pass between steps as `$steps..`. Batches chain operations from one server only — the Hostinger Connector runs `hosting`, `agency-hosting`, `domains` and `dns` as separate servers. When `search` cannot find an operation, ask the user to enable that product group in the Connector. +- Every write here changes what the public sees. State the change and get a yes before each one. + +## 1. Gather the facts (read-only) + +- **Website.** `hosting_websites_list` with `domain` (Shared and Cloud; substring match, so take the exact entry) and `agency-hosting_websites_list-plan` with `domain` (Agency). Keep `username` and `order_id`, or `details.uid` and `details.ipv4`. When the domain has no website yet, find the site the user means — often a `*.hostingersite.com` one — or the order to create it on (`hosting_orders_list`, `agency-hosting_orders_list`). +- **Registration.** `domains_portfolio_get` succeeds only for domains registered at Hostinger; its `name_servers` show who runs DNS. Hostinger's own nameservers end in `dns-parking.com`. +- **Live DNS**, to know what must be kept: + +```bash +dig +short NS DOMAIN; dig +short A DOMAIN; dig +short CNAME www.DOMAIN +dig +short MX DOMAIN; dig +short TXT DOMAIN; dig +short CAA DOMAIN +``` + +## 2. Attach the domain to hosting + +Shared and Cloud: + +- **New website on the domain.** For a domain outside this account run `hosting_domains_verify-ownership` first. When `is_accessible` is false, give the user the `TXT` record it returns to add next to the existing ones, then verify again (propagation takes up to ~10 minutes). Create with `hosting_websites_create` (`domain` without `www.`, `order_id`), then poll `hosting_websites_list-setups` with `domain` every 10–15 s until `status: completed`. +- **Moving a site off its free subdomain.** Shared and Cloud websites cannot be renamed through the API. Either create a website on the real domain and redeploy the project there (the `deploy-to-hosting` skill) — required for WordPress, which keeps its URL in the database — or, for static sites, park the domain on the existing site with `hosting_domains_create-website-parked`. +- **Alias** (a second domain showing the same site): `hosting_domains_create-website-parked`. +- **Subdomain** (`shop.example.com`): `hosting_domains_create-website-subdomain`. `www` belongs to the main domain — do not create it as a subdomain. + +Agency Plan: + +- `agency-hosting_domains_link-to-website` adds a domain to the site. +- `agency-hosting_domains_change-website` replaces the primary domain, for example the free subdomain. The old name stops serving at once — confirm first. + +## 3. Point DNS at Hostinger + +**DNS already at Hostinger** (nameservers end in `dns-parking.com`): creating the website normally writes the records. Read the zone with `dns_records_list`; when `@` and `www` already point at the site, change nothing. Before any edit, note the newest `dns_snapshots_list` entry — `dns_snapshots_restore` rolls back to it. + +`dns_records_update` defaults to `overwrite: true`, which deletes every existing record with the same name and type. Adding a `TXT` at `@` that way wipes SPF and verification records. Send `overwrite: false` when adding; use `true` only to replace one record set on purpose, and run `dns_records_validate` on the same payload first. + +**DNS elsewhere** (registered at Hostinger with other nameservers, or registered elsewhere). Two options — let the user choose: + +- **Switch nameservers to Hostinger.** Hostinger then manages every record. First copy each record the current DNS serves beyond the website — `MX`, `TXT`, service `CNAME`s — into the Hostinger zone with `dns_records_update` (`overwrite: false`); otherwise email breaks when the nameservers flip. Hostinger's nameserver pairs differ between domains (`ns1`/`ns2.dns-parking.com`, `solar`/`lunar.dns-parking.com` and others), so use the pair hPanel shows for this domain, never a guessed one. For Hostinger-registered domains apply it with `domains_portfolio_update-nameservers`; otherwise the user changes it at their registrar. +- **Keep the current DNS provider** and change only the web records: `A` for `@` and `CNAME` (or `A`) for `www`. Agency sites point at `details.ipv4`. Shared and Cloud sites point at the targets in the Hostinger zone for the domain (`dns_records_list`) or, when that zone does not exist, the IP hPanel shows for the website. The user makes this change at their DNS provider. + +## 4. SSL and HTTPS + +Start only once `dig` shows the domain resolving to Hostinger — the certificate authority checks the domain against the server. + +- Shared and Cloud: `hosting_ssl_status`. When it is not `active`, call `hosting_ssl_install` and poll the status until `active` (or `failed` with `last_error`), then `hosting_ssl_toggle-https-redirect` with `is_enabled: true` (it returns 422 until a certificate exists). +- Agency: `agency-hosting_ssl_install-website` for each domain, then poll `agency-hosting_ssl_website-status`. A domain allows three setups per seven days and one request a minute — install once DNS is right and never loop. +- A `CAA` record at the apex that does not allow `letsencrypt.org` blocks issuance; the user adds `0 issue "letsencrypt.org"` beside the existing ones. + +## 5. Verify + +```bash +dig +short A DOMAIN; dig +short A www.DOMAIN +curl -sSI https://DOMAIN/ | grep -i -E "^(HTTP|platform|location)" +curl -sSI http://DOMAIN/ | grep -i -E "^(HTTP|location)" +dig +short MX DOMAIN +``` + +Done when both names resolve to Hostinger, HTTPS answers with `platform: hostinger`, HTTP redirects to HTTPS, and `MX` still matches step 1. Nameserver changes can take up to 24–48 hours to reach every resolver; when records are still old, report what is pending and the command to re-check instead of polling for hours. diff --git a/skills/deploy-to-hosting/SKILL.md b/skills/deploy-to-hosting/SKILL.md new file mode 100644 index 0000000..96442d7 --- /dev/null +++ b/skills/deploy-to-hosting/SKILL.md @@ -0,0 +1,115 @@ +--- +name: deploy-to-hosting +description: "Deploy an existing project to a website on Hostinger web hosting (Shared, Cloud or Agency plans) and keep it deployed: picks the right deploy for static sites, Node.js apps (Next.js, Nuxt, Express, Vite and similar), PHP apps and WordPress plugins or themes, sets up auto-deploy from GitHub or GitLab, manages Node.js environment variables and MySQL databases, and verifies the live site. Triggers: deploy this project, deploy to Hostinger, push my app live, redeploy, set up auto-deploy, connect my GitHub repo, add environment variables, my app needs a database, deploy my WordPress plugin or theme." +--- + +# Deploy to hosting + +Ship a project that already exists — on disk or in a Git repository — to a Hostinger website. Building a new site from a prompt (design, store, blog) is the `hostinger-headless` skill; this one takes code as it is. + +## Calling the operations + +- Read the `inputSchema` that `search` returns before the first call of each operation. If a name below is rejected as unknown, `search` for what the step does (e.g. "deploy static"). +- Batch reads with `multi-execute`; values pass between steps as `$steps..`. Batches chain operations from one server only — the Hostinger Connector runs `hosting`, `wordpress` and `agency-hosting` as separate servers. +- Every deploy overwrites the website's current contents. Confirm the target domain with the user before the first deploy to a site that already has content. + +## 1. Pick the target website + +- `.hostinger/site.json` in the project: reuse its `domain` and `username` (or `website_uid`). +- Otherwise look the domain up with `hosting_websites_list` (Shared and Cloud; substring match — take the exact entry) and `agency-hosting_websites_list-plan` (Agency; keep `details.uid`). +- No website yet: + - Shared and Cloud: take a domain (the user's own, or `hosting_domains_generate-free-subdomain`) and an `order_id` from `hosting_orders_list`, then `hosting_websites_create`. `datacenter_code` is needed only for the first website on a new plan (first entry of `hosting_datacenters_list`). Poll `hosting_websites_list-setups` with `domain` every 10–15 s until `status: completed` — uploads and deploys return 404 or 409 before that. + - Agency: `agency-hosting_website-setups_create` with `flavor: "php-fpm"` (plus `type: "node-static"` for built frontends), `settings.php.version` from `agency-hosting_php_list-versions-for-order` and `datacenter_code` from `agency-hosting_datacenters_list`. Poll `agency-hosting_website-setups_status` until `completed`; it returns the `website_uid`. +- Node.js apps run on Business and Cloud plans (`hostinger_business_*`, `cloud_*` in `hosting_orders_list`). On other plans, build locally and deploy the output as a static site. + +## 2. Choose the deploy + +Wrong method is the most common failure. Decide from the project on disk: + +| Project | Shared / Cloud | +| --- | --- | +| Plain HTML/CSS/JS, or a framework's static build output | `hosting_deploy-static-website` | +| `package.json` with a build or a server (Next.js, Nuxt, Express, Vite…) | `hosting_deploy-js-application` | +| PHP code, no build step | `hosting_deploy-static-website` (extracts the archive as-is) | +| WordPress plugin or theme folder | `hosting_deploy-wordpress-plugin` / `hosting_deploy-wordpress-theme` (`activate` optional) | +| A whole WordPress site from elsewhere | the `migrate-to-hosting` skill | + +On Agency the website's type decides (`agency-hosting_websites_get`): sites created as `node-static` take `agency-hosting_deploy-node-static-website`, which runs the build when the project has one; every other site takes `agency-hosting_deploy-php-application`, which extracts the archive as-is. WordPress plugins and themes on Agency sites are installed from wp-admin. + +Archive rules (name archives `name_YYYYMMDD_HHMMSS.zip`): + +- **Static:** build locally first. `index.html` must be at the archive root, not inside a folder: `cd dist && zip -r ../site_20260101_120000.zip .` +- **Node.js source:** no `node_modules/`, no build output (`dist/`, `.next/`, `build/`), no `.env*`, nothing matched by `.gitignore`; 50 MB at most. `git archive --format=zip -o app_20260101_120000.zip HEAD` produces exactly the committed files — mention that uncommitted changes are left out. +- Agency deploys are synchronous: the site is live when the call returns. + +The operations in the table read the archive from this machine, so only the local `hostinger-api-mcp` server has them. On the hosted server (`mcp.hostinger.com`) `search` does not find them — upload the files yourself as below. + +### Without the local deploy operations + +1. Get upload credentials: `hosting_files_generate-upload-url` (`username`, `domain`); Agency: `agency-hosting_files_generate-upload-url` (`website_uid`). Both return `url`, `auth_key` and `rest_auth_key`, which authenticate the upload instead of the API token. +2. Upload each file with TUS, where `DEST` is its path in the website's storage: + +```bash +SIZE=$(wc -c < "$FILE" | tr -d ' ') +curl -sS -X POST "$URL/$DEST?override=true" -H "X-Auth: $AUTH_KEY" -H "X-Auth-Rest: $REST_AUTH_KEY" -H "Tus-Resumable: 1.0.0" -H "Upload-Length: $SIZE" -H "Upload-Offset: 0" +curl -sS -X PATCH "$URL/$DEST?override=true" -H "X-Auth: $AUTH_KEY" -H "X-Auth-Rest: $REST_AUTH_KEY" -H "Tus-Resumable: 1.0.0" -H "Content-Type: application/offset+octet-stream" -H "Upload-Offset: 0" --data-binary "@$FILE" +``` + + The first call returns `201`, the second `204` with an `Upload-Offset` header equal to the file size. `override=true` makes a retry safe. +3. Deploy from the uploaded files (`RANDOM8` is any fresh 8-character string, e.g. `$(LC_ALL=C tr -dc 'a-z0-9' < /dev/urandom | head -c 8)`): + +| Project | `DEST` | Then | +| --- | --- | --- | +| Static or PHP | `site.zip` | `hosting_websites_deploy-static-site-archive` with `archive_path: "site.zip"` | +| Node.js | `app.zip` | `hosting_nodejs_build-settings-from-archive` with `archive_path: "app.zip"`, then `hosting_nodejs_start-build` with those settings, `source_type: "archive"` and `source_options.archive_path: "app.zip"` | +| WordPress plugin | every file, as `wp-content/plugins/SLUG-RANDOM8/` | `wordpress_plugins_deploy` with `slug` and `plugin_path: "SLUG-RANDOM8"` | +| WordPress theme | every file, as `wp-content/themes/SLUG-RANDOM8/` | `wordpress_themes_deploy` with `slug`, `theme_path: "SLUG-RANDOM8"` and optional `is_activated` | +| Agency, extracted as-is | `.h5g/site.zip` | `agency-hosting_files_import-website-from-archive` with `archive_name: "site.zip"` | +| Agency `node-static` | `.h5g/RANDOM8/app.zip` | `agency-hosting_websites_build-nodejs-assets` with `archive_path: ".h5g/RANDOM8"` — the directory, not the file | + +## 3. Node.js builds + +`hosting_deploy-js-application` uploads the archive to the document root, detects settings from `package.json` and starts a build. Track it with `hosting_nodejs_list-builds` and `hosting_nodejs_build` (by `uuid`), polling every 10–20 s — builds take minutes. + +- Failed build: `hosting_nodejs_analyse-failed-build` once per build (5 calls a minute), then `hosting_nodejs_build-logs` if the analysis is empty. +- Wrong detection (framework, `output_directory`, or a missing `entry_file` for express, fastify, nest, nuxt and hono): run `hosting_nodejs_start-build` with explicit values, `source_type: "archive"` and `source_options.archive_path` set to the archive's file name in the document root (check it is there with `hosting_files_list-website-and-directories`). Store the same values with `hosting_nodejs_update-build-settings`. +- To review detected settings before any build: upload the archive with `hosting_files_generate-upload-url` (the TUS steps are in its description), then `hosting_nodejs_build-settings-from-archive`. + +## 4. Auto-deploy from Git + +1. `hosting_git_list-installations`. With no `active` installation (check `status: "pending"` and `"suspended"` too), the user connects GitHub or GitLab once in hPanel under Websites → Manage → Advanced → Git; there is no API for that step. +2. `hosting_git_list-installation-repositories` with the installation `uuid` gives `owner`, `name` and `default_branch` (10 calls a minute). +3. `hosting_git_update-auto-deployment-settings` with `installation_uuid`, `owner`, `repository`, `branch` and optional `directory`. + - PHP and static sites deploy the branch immediately and again on every push. + - Node.js sites clone nothing on save: start the first build with `hosting_nodejs_start-build`, `source_type: "git"` and the same `source_options`. Later pushes build with the stored settings, so keep `hosting_nodejs_update-build-settings` correct. +4. Confirm with `hosting_git_auto-deployment-settings`. + +Agency Plan sites have no Git operations; deploy archives. + +## 5. Environment variables (Node.js) + +`hosting_nodejs_replace-environment-variables` replaces the whole set — anything not sent is deleted. + +1. `hosting_nodejs_list-environment-variables` for the current keys. Values come back as `********`; never send those back. +2. Build the full set: every current key plus the new ones, with real values from the project's `.env` or the user. When the real value of an existing key is unknown, ask — do not drop it. +3. Send it once; the app restarts. Values baked in at build time (Next.js `NEXT_PUBLIC_*`, Vite `VITE_*`) need a new `hosting_nodejs_start-build`. + +Keys use uppercase letters, digits and underscores. Never commit `.env` files or repeat secret values back to the user. + +## 6. Database + +- **Node.js:** `hosting_databases_setup-website` creates a MySQL database and writes `DB_HOST`, `DB_PORT`, `DB_NAME`, `DB_USER`, `DB_PASSWORD` and `DATABASE_URL` into the environment, then restarts the app. The password is generated and never returned. It fails with 422 when any of those keys exists — remove them first with the step 5 replace. +- **PHP:** `hosting_databases_create` with `name`, `user`, a strong generated `password` and `website_domain`; read the prefixed full name back from `hosting_databases_list`. The app reads credentials from a config file on the server that stays out of Git, and connects to `localhost` or `127.0.0.1`. +- **Agency:** `agency-hosting_databases_create-website`; the app connects to `localhost`. +- The `srvNNNN.hstgr.io` host from `hosting_databases_list` is only for connections from outside Hostinger — never put it in the deployed app. + +## 7. Verify and record + +```bash +curl -s -o /dev/null -w "%{http_code}\n" https://DOMAIN/ +curl -s https://DOMAIN/ | grep -o "TEXT THE PROJECT RENDERS" +``` + +A `200` alone can be a placeholder page; match real copy. A new site may serve a default page briefly — clear it with `hosting_cache_clear-website` and retry before calling the deploy failed. + +Write `.hostinger/site.json` in the project so later runs reuse the target: `{ "domain", "username" or "website_uid", "type": "static" | "nodejs" | "php" }`, keeping any fields already there. diff --git a/skills/hosting-deploy-nodejs-app/SKILL.md b/skills/hosting-deploy-nodejs-app/SKILL.md deleted file mode 100644 index 70e305e..0000000 --- a/skills/hosting-deploy-nodejs-app/SKILL.md +++ /dev/null @@ -1,99 +0,0 @@ ---- -name: hosting-deploy-nodejs-app -description: >- - Deploy a Node.js application (needs a build step) to a Hostinger "hosting" website via - public-api, using standalone MCP tools/plain curl instead of a filesystem-driven deploy tool. - Use when asked to deploy/build a Node.js/JS app on hosting (not Agency Plan). ---- - -# Deploy a Node.js app to hosting - -No filesystem access needed. Call the public-api MCP tools by name below — these need a Bearer -token and the target `domain`. The one upload step has no tool wrapper: it hits the file-storage -host directly via TUS, authenticated with the `auth_key`/`rest_auth_key` from -`hosting_generateUploadURLV1` (not the Bearer token), so it's always plain curl. Archive must -contain only application source (exclude `node_modules/` and any build output — the build step -runs install automatically). - -## Tools used, in order - -| # | Tool | Notes | -|---|------|-------| -| 1 | `hosting_listWebsitesV1` | query `domain={domain}` → resolve `username` | -| 2 | `hosting_generateUploadURLV1` | body `{"username","domain"}` → `{ url, auth_key, rest_auth_key }` | -| 3 | *(no tool — plain curl)* | TUS upload of the archive | -| 4 | `hosting_getNode_jsBuildSettingsFromArchiveV1` | query `archive_path={file}` — optional, auto-detects build settings | -| 5 | `hosting_startNode_jsBuildV1` | starts the build — **destructive** | - -## Steps - -1. **Resolve `username`**: call `hosting_listWebsitesV1` with `domain={domain}` → `data[0].username`. -2. **Get upload credentials**: call `hosting_generateUploadURLV1` with body `{"username","domain"}` → `{ url, auth_key, rest_auth_key }`. -3. **Upload the archive via TUS** (plain curl — no MCP tool for this) to its bare filename (no subdirectory): - ``` - FILE=app.zip - SIZE=$(wc -c < "$FILE") - - curl -sS -i -X POST "${url}/${FILE}?override=true" \ - -H "X-Auth: ${auth_key}" -H "X-Auth-Rest: ${rest_auth_key}" \ - -H "Tus-Resumable: 1.0.0" -H "Upload-Length: ${SIZE}" -H "Upload-Offset: 0" - # -> 201 Created - - curl -sS -i -X PATCH "${url}/${FILE}?override=true" \ - -H "X-Auth: ${auth_key}" -H "X-Auth-Rest: ${rest_auth_key}" \ - -H "Tus-Resumable: 1.0.0" -H "Content-Type: application/offset+octet-stream" \ - -H "Upload-Offset: 0" --data-binary "@${FILE}" - # -> 204, Upload-Offset response header == SIZE means done - ``` -4. **Auto-detect build settings** (optional but recommended): call `hosting_getNode_jsBuildSettingsFromArchiveV1` - with `archive_path=app.zip` → returns `app_type`, `node_version`, `root_directory`, - `output_directory`, `build_script`, `entry_file`, `package_manager`. Forward these as-is into - step 5 (override any field the caller wants different first). -5. **Start the build**: call `hosting_startNode_jsBuildV1` with body: - ```json - { - "username": "...", - "domain": "...", - "node_version": 20, - "app_type": "...", - "root_directory": "...", - "output_directory": "...", - "build_script": "...", - "source_type": "archive", - "source_options": { "archive_path": "app.zip" } - } - ``` - `node_version` must be one of `18`/`20`/`22`/`24` (default `20` if step 4 didn't return one). `entry_file` is required only when `app_type` is `express`. Response includes a build `uuid` — poll `hosting_listNodeJSBuildsV1` or `hosting_getNodeJSBuildLogsV1` for progress. - -## Verify - -The build is asynchronous — the previous step only queues it. - -1. Poll `hosting_listNodeJSBuildsV1` until the build reports a finished state. Back - off between polls: builds take minutes, not seconds. -2. If it failed, pull `hosting_getNodeJSBuildLogsV1` for that build `uuid`, fix the - cause, and redeploy. Do not report success on a queued build. -3. Once it succeeds, confirm the app actually serves: - ``` - curl -s -o /dev/null -w "%{http_code}\n" https://{domain}/ - curl -s https://{domain}/ | grep -o "SOME_TEXT_YOU_ACTUALLY_DEPLOYED" - ``` - -A `200` alone is not proof — grep for a string you know is in the build output. - -## One-step alternative - -`hosting_createNodeJSBuildFromArchiveV1` uploads the archive as multipart form data directly in -the request and starts the build in one call — skips steps 2–4 entirely if the caller can send -the raw archive bytes in the request body. Max archive size 50MB. - -## Warning - -**Destructive.** On success, the build result overwrites the entire website root (`public_html`, -except subdomain directories and `.htaccess`) — cannot be undone. Confirm intent before step 5 -(or before calling the one-step alternative). - -## When it's the wrong tool - -- Site has no build step (plain static files) → use **hosting-deploy-static-site** instead. -- Site is WordPress → use **hosting-deploy-wordpress-site** instead. diff --git a/skills/hosting-deploy-static-site/SKILL.md b/skills/hosting-deploy-static-site/SKILL.md deleted file mode 100644 index f69f80b..0000000 --- a/skills/hosting-deploy-static-site/SKILL.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -name: hosting-deploy-static-site -description: >- - Deploy a pre-built static site (HTML/CSS/JS, no build step) to a Hostinger "hosting" website - via public-api, using standalone MCP tools/plain curl instead of a filesystem-driven deploy - tool. Use when asked to deploy/upload a static site to hosting (not Agency Plan). ---- - -# Deploy a static site to hosting - -No filesystem access needed. Call the public-api MCP tools by name below — these need a Bearer -token and the target `domain`. The one upload step has no tool wrapper: it hits the file-storage -host directly via TUS, authenticated with the `auth_key`/`rest_auth_key` from -`hosting_generateUploadURLV1` (not the Bearer token), so it's always plain curl. - -## Tools used, in order - -| # | Tool | Notes | -|---|------|-------| -| 1 | `hosting_listWebsitesV1` | query `domain={domain}` → resolve `username` | -| 2 | `hosting_generateUploadURLV1` | body `{"username","domain"}` → `{ url, auth_key, rest_auth_key }` | -| 3 | *(no tool — plain curl)* | TUS upload of the archive | -| 4 | `hosting_deployStaticSiteArchiveV1` | body `{"archive_path"}` — **destructive** | - -## Steps - -1. **Resolve `username`**: call `hosting_listWebsitesV1` with `domain={domain}` → `data[0].username`. -2. **Get upload credentials**: call `hosting_generateUploadURLV1` with body `{"username": "...", "domain": "..."}` → `{ url, auth_key, rest_auth_key }`. -3. **Upload the archive via TUS** (plain curl — no MCP tool for this), using the archive's bare filename as `relative_file_path` (e.g. `site.zip` — no subdirectory): - ``` - FILE=site.zip - SIZE=$(wc -c < "$FILE") - - curl -sS -i -X POST "${url}/${FILE}?override=true" \ - -H "X-Auth: ${auth_key}" -H "X-Auth-Rest: ${rest_auth_key}" \ - -H "Tus-Resumable: 1.0.0" -H "Upload-Length: ${SIZE}" -H "Upload-Offset: 0" - # -> 201 Created - - curl -sS -i -X PATCH "${url}/${FILE}?override=true" \ - -H "X-Auth: ${auth_key}" -H "X-Auth-Rest: ${rest_auth_key}" \ - -H "Tus-Resumable: 1.0.0" -H "Content-Type: application/offset+octet-stream" \ - -H "Upload-Offset: 0" --data-binary "@${FILE}" - # -> 204, Upload-Offset response header == SIZE means done - ``` - `?override=true` means a re-upload of the same path replaces it — safe to retry. -4. **Trigger deploy**: call `hosting_deployStaticSiteArchiveV1` with: - ```json - { "username": "...", "domain": "...", "archive_path": "site.zip" } - ``` - `archive_path` is the bare filename from step 3 — no directory, no other body fields. - `username` and `domain` are URL path params in the REST API, but the MCP tool takes - them as ordinary arguments — pass all of them. - -## Verify - -``` -curl -s -o /dev/null -w "%{http_code}\n" https://{domain}/ -curl -s https://{domain}/ | grep -o "SOME_TEXT_YOU_ACTUALLY_DEPLOYED" -``` - -A `200` alone is not proof — a fresh or failed deploy can still serve a parking -page. Always grep for a string you know is in the files you just deployed. If it -does not match, call `hosting_clearWebsiteCacheV1` and retry once before -reporting failure. - -## Warning - -**Destructive.** Deploy wipes the entire website root (except subdomain directories) before -extracting the new archive — cannot be undone. Confirm intent before step 4. - -## When it's the wrong tool - -- Site has a `package.json` / needs a build step → use the **hosting-deploy-nodejs-app** skill instead. -- Site is WordPress → use **hosting-deploy-wordpress-site** instead. diff --git a/skills/hosting-deploy-wordpress-plugin/SKILL.md b/skills/hosting-deploy-wordpress-plugin/SKILL.md deleted file mode 100644 index b366e4d..0000000 --- a/skills/hosting-deploy-wordpress-plugin/SKILL.md +++ /dev/null @@ -1,73 +0,0 @@ ---- -name: hosting-deploy-wordpress-plugin -description: >- - Deploy a WordPress plugin (a directory of files, not a single archive) to a Hostinger - "hosting" WordPress website via public-api, using standalone MCP tools/plain curl instead of a - filesystem-driven deploy tool. Use when asked to deploy/upload a WP plugin. ---- - -# Deploy a WordPress plugin to hosting - -No filesystem access needed. Call the public-api MCP tools by name below — these need a Bearer -token, the target `domain`, the plugin `slug`, and the list of plugin files with their paths -relative to the plugin's own root directory (e.g. `my-plugin.php`, `includes/helper.php`). The -upload steps have no tool wrapper: they hit the file-storage host directly via TUS, authenticated -with the `auth_key`/`rest_auth_key` from `hosting_generateUploadURLV1` (not the Bearer token), so -they're always plain curl. - -Unlike archive-based deploys, **every file is uploaded individually via its own TUS sequence** — -there is no zipping step. - -## Tools used, in order - -| # | Tool | Notes | -|---|------|-------| -| 1 | `hosting_listWebsitesV1` | query `domain={domain}` → resolve `username` | -| 2 | `hosting_generateUploadURLV1` | body `{"username","domain"}` → `{ url, auth_key, rest_auth_key }` (reused for every file) | -| 3 | *(no tool — plain curl)* | one TUS upload per file | -| 4 | `hosting_deployWordPressPluginV1` | body `{"slug","plugin_path"}` | - -## Steps - -1. **Resolve `username`**: call `hosting_listWebsitesV1` with `domain={domain}` → `data[0].username`. -2. **Get upload credentials once**: call `hosting_generateUploadURLV1` with body `{"username","domain"}` → `{ url, auth_key, rest_auth_key }` — reuse for every file below. -3. **Pick a unique upload directory** for this deploy: `{slug}-{random}` (any unique suffix — an - 8-char random string works, it just needs to not collide with a directory already in use). -4. **Upload every plugin file via TUS**, one at a time, to - `wp-content/plugins/{slug}-{random}/{file's path relative to the plugin root}`: - ``` - FILE=includes/helper.php - RELATIVE_PATH="wp-content/plugins/my-plugin-a1b2c3d4/${FILE}" - SIZE=$(wc -c < "$FILE") - - curl -sS -i -X POST "${url}/${RELATIVE_PATH}?override=true" \ - -H "X-Auth: ${auth_key}" -H "X-Auth-Rest: ${rest_auth_key}" \ - -H "Tus-Resumable: 1.0.0" -H "Upload-Length: ${SIZE}" -H "Upload-Offset: 0" - # -> 201 Created - - curl -sS -i -X PATCH "${url}/${RELATIVE_PATH}?override=true" \ - -H "X-Auth: ${auth_key}" -H "X-Auth-Rest: ${rest_auth_key}" \ - -H "Tus-Resumable: 1.0.0" -H "Content-Type: application/offset+octet-stream" \ - -H "Upload-Offset: 0" --data-binary "@${FILE}" - # -> 204, Upload-Offset response header == SIZE means done - ``` - Repeat for every file in the plugin. -5. **Trigger deploy** once all files uploaded successfully: call `hosting_deployWordPressPluginV1` - with body: - ```json - { "username": "...", "domain": "...", "slug": "my-plugin", "plugin_path": "my-plugin-a1b2c3d4" } - ``` - `plugin_path` is the upload directory name from step 3 (not a full path) — the plugin will be - activated and made available in the WordPress admin panel. - -## Verify - -Call `hosting_listInstalledWordPressPluginsV1` and confirm `{slug}` is listed and reported -active — this tool always activates the plugin, and a successful upload does not by itself -mean the deploy step succeeded. - -## Note - -This only overwrites the plugin's own directory under `wp-content/plugins/` — the rest of the -site is untouched. Overwriting an existing plugin of the same slug is expected/intended behavior, -not flagged as destructive. diff --git a/skills/hosting-deploy-wordpress-site/SKILL.md b/skills/hosting-deploy-wordpress-site/SKILL.md deleted file mode 100644 index abeecf4..0000000 --- a/skills/hosting-deploy-wordpress-site/SKILL.md +++ /dev/null @@ -1,96 +0,0 @@ ---- -name: hosting-deploy-wordpress-site -description: >- - Import a full WordPress website (archive + database dump) into a Hostinger "hosting" website - via public-api, using standalone MCP tools/plain curl instead of a filesystem-driven deploy - tool. Use when asked to import/restore a whole WordPress site on hosting (not Agency Plan). ---- - -# Import a WordPress site to hosting - -No filesystem access needed. Call the public-api MCP tools by name below — these need a Bearer -token and the target `domain`. Needs two local files: a site archive (zip/tar/tar.gz/tgz) and a -`.sql` database dump. The upload steps have no tool wrapper: they hit the file-storage host -directly via TUS, authenticated with the `auth_key`/`rest_auth_key` from -`hosting_generateUploadURLV1` (not the Bearer token), so they're always plain curl. - -## Tools used, in order - -| # | Tool | Notes | -|---|------|-------| -| 1 | `hosting_listWebsitesV1` | query `domain={domain}` → resolve `username` | -| 2 | `hosting_generateUploadURLV1` | body `{"username","domain"}` → `{ url, auth_key, rest_auth_key }` (reused for both uploads) | -| 3 | *(no tool — plain curl)* | TUS upload of the archive AND the `.sql` dump (two separate sequences) | -| 4 | `hosting_importWordPressWebsiteV1` | body `{"archive_path","sql_path"}` — **destructive** | - -## Steps - -1. **Resolve `username`**: call `hosting_listWebsitesV1` with `domain={domain}` → `data[0].username`. -2. **Get upload credentials once**: call `hosting_generateUploadURLV1` with body `{"username","domain"}` → `{ url, auth_key, rest_auth_key }` — reuse for both uploads below. -3. **Upload the archive via TUS** (plain curl — no MCP tool for this) to its bare filename, e.g. `site.zip`: - ``` - FILE=site.zip - SIZE=$(wc -c < "$FILE") - - curl -sS -i -X POST "${url}/${FILE}?override=true" \ - -H "X-Auth: ${auth_key}" -H "X-Auth-Rest: ${rest_auth_key}" \ - -H "Tus-Resumable: 1.0.0" -H "Upload-Length: ${SIZE}" -H "Upload-Offset: 0" - # -> 201 Created - - curl -sS -i -X PATCH "${url}/${FILE}?override=true" \ - -H "X-Auth: ${auth_key}" -H "X-Auth-Rest: ${rest_auth_key}" \ - -H "Tus-Resumable: 1.0.0" -H "Content-Type: application/offset+octet-stream" \ - -H "Upload-Offset: 0" --data-binary "@${FILE}" - # -> 204, Upload-Offset response header == SIZE means done - ``` -4. **Upload the database dump via TUS** the same way, to its bare filename (e.g. `dump.sql`) — a - second, independent create-POST + PATCH sequence using the same credentials from step 2: - ``` - FILE=dump.sql - SIZE=$(wc -c < "$FILE") - - curl -sS -i -X POST "${url}/${FILE}?override=true" \ - -H "X-Auth: ${auth_key}" -H "X-Auth-Rest: ${rest_auth_key}" \ - -H "Tus-Resumable: 1.0.0" -H "Upload-Length: ${SIZE}" -H "Upload-Offset: 0" - - curl -sS -i -X PATCH "${url}/${FILE}?override=true" \ - -H "X-Auth: ${auth_key}" -H "X-Auth-Rest: ${rest_auth_key}" \ - -H "Tus-Resumable: 1.0.0" -H "Content-Type: application/offset+octet-stream" \ - -H "Upload-Offset: 0" --data-binary "@${FILE}" - ``` -5. **Trigger import**: call `hosting_importWordPressWebsiteV1` with body: - ```json - { "username": "...", "domain": "...", "archive_path": "site.zip", "sql_path": "dump.sql" } - ``` - `archive_path` and `sql_path` are the bare filenames from steps 3/4 — no other body fields. - `username` and `domain` are URL path params in the REST API, but the MCP tool takes - them as ordinary arguments — pass all of them. - -## Verify - -``` -curl -s -o /dev/null -w "%{http_code}\n" https://{domain}/ -curl -s https://{domain}/ | grep -o "SOME_TEXT_YOU_ACTUALLY_DEPLOYED" -``` - -A `200` alone is not proof — a fresh or failed deploy can still serve a parking -page. Always grep for a string you know is in the files you just deployed. If it -does not match, call `hosting_clearWebsiteCacheV1` and retry once before -reporting failure. - -## Before you import - -The website should be empty first (hPanel normally checks this and blocks non-empty imports). -That pre-check has no public-api tool — if the target domain already has content, clear it via -hPanel first, or accept that this import will overwrite whatever's there (see warning below). - -## Warning - -**Destructive.** Existing website contents are moved out of the live web root before the -imported WordPress core is written in — functionally irreversible via the API. Confirm intent -before step 5. - -## When it's the wrong tool - -- Just deploying a plugin or theme into an existing WP site → use **hosting-deploy-wordpress-plugin** - or **hosting-deploy-wordpress-theme** instead (those don't touch the rest of the site). diff --git a/skills/hosting-deploy-wordpress-theme/SKILL.md b/skills/hosting-deploy-wordpress-theme/SKILL.md deleted file mode 100644 index ee8d342..0000000 --- a/skills/hosting-deploy-wordpress-theme/SKILL.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -name: hosting-deploy-wordpress-theme -description: >- - Deploy a WordPress theme (a directory of files, not a single archive) to a Hostinger "hosting" - WordPress website via public-api, using standalone MCP tools/plain curl instead of a - filesystem-driven deploy tool. Use when asked to deploy/upload a WP theme. ---- - -# Deploy a WordPress theme to hosting - -No filesystem access needed. Call the public-api MCP tools by name below — these need a Bearer -token, the target `domain`, the theme `slug`, and the list of theme files with their paths -relative to the theme's own root directory. The upload steps have no tool wrapper: they hit the -file-storage host directly via TUS, authenticated with the `auth_key`/`rest_auth_key` from -`hosting_generateUploadURLV1` (not the Bearer token), so they're always plain curl. - -Unlike archive-based deploys, **every file is uploaded individually via its own TUS sequence** — -there is no zipping step. - -## Tools used, in order - -| # | Tool | Notes | -|---|------|-------| -| 1 | `hosting_listWebsitesV1` | query `domain={domain}` → resolve `username` | -| 2 | `hosting_generateUploadURLV1` | body `{"username","domain"}` → `{ url, auth_key, rest_auth_key }` (reused for every file) | -| 3 | *(no tool — plain curl)* | one TUS upload per file | -| 4 | `hosting_deployWordPressThemeV1` | body `{"slug","theme_path","is_activated"}` | - -## Steps - -1. **Resolve `username`**: call `hosting_listWebsitesV1` with `domain={domain}` → `data[0].username`. -2. **Get upload credentials once**: call `hosting_generateUploadURLV1` with body `{"username","domain"}` → `{ url, auth_key, rest_auth_key }` — reuse for every file below. -3. **Pick a unique upload directory** for this deploy: `{slug}-{random}` (any unique suffix). -4. **Upload every theme file via TUS**, one at a time, to - `wp-content/themes/{slug}-{random}/{file's path relative to the theme root}`: - ``` - FILE=style.css - RELATIVE_PATH="wp-content/themes/my-theme-a1b2c3d4/${FILE}" - SIZE=$(wc -c < "$FILE") - - curl -sS -i -X POST "${url}/${RELATIVE_PATH}?override=true" \ - -H "X-Auth: ${auth_key}" -H "X-Auth-Rest: ${rest_auth_key}" \ - -H "Tus-Resumable: 1.0.0" -H "Upload-Length: ${SIZE}" -H "Upload-Offset: 0" - # -> 201 Created - - curl -sS -i -X PATCH "${url}/${RELATIVE_PATH}?override=true" \ - -H "X-Auth: ${auth_key}" -H "X-Auth-Rest: ${rest_auth_key}" \ - -H "Tus-Resumable: 1.0.0" -H "Content-Type: application/offset+octet-stream" \ - -H "Upload-Offset: 0" --data-binary "@${FILE}" - # -> 204, Upload-Offset response header == SIZE means done - ``` - Repeat for every file in the theme. -5. **Trigger deploy** once all files uploaded successfully: call `hosting_deployWordPressThemeV1` - with body: - ```json - { "username": "...", "domain": "...", "slug": "my-theme", "theme_path": "my-theme-a1b2c3d4", "is_activated": false } - ``` - `theme_path` is the upload directory name from step 3 (not a full path). `is_activated` - is optional (default `false`) — set `true` to activate the theme after deploy. - -## Verify - -Call `hosting_listInstalledWordPressThemesV1` and confirm `{slug}` is listed with the -expected version. If you passed `is_activated: true`, check it is reported active — -a successful upload does not guarantee activation. - -## Note - -This only overwrites the theme's own directory under `wp-content/themes/` — the rest of the site -is untouched. Overwriting an existing theme of the same slug is expected/intended behavior, not -flagged as destructive. diff --git a/skills/hostinger-headless/SKILL.md b/skills/hostinger-headless/SKILL.md new file mode 100644 index 0000000..d709179 --- /dev/null +++ b/skills/hostinger-headless/SKILL.md @@ -0,0 +1,56 @@ +--- +name: hostinger-headless +description: "Build, connect, or iterate on a website hosted on Hostinger — provision hosting and a domain, optionally seed an ecommerce store with a real hosted checkout or a WordPress content backend (headless CMS/blog), build the frontend, deploy, and verify. Requires an authenticated Hostinger MCP session (see entry/skill.md). Triggers: build me a site on Hostinger, deploy this to Hostinger, connect this project to Hostinger, add a store to my Hostinger site, add a blog to my Hostinger site, update my Hostinger site." +--- + +# Hostinger Headless + +This skill turns a prompt into a live website on Hostinger. Its job is to own the full run: check the account, provision hosting and a domain, seed the backend (an ecommerce store when the intent calls for selling), build the frontend, deploy it, and verify the result. + +The frontend is built ad-hoc to the user's intent — there is no template library. The backend pieces are real Hostinger products: web hosting (static or Node.js), domains and DNS, Hostinger Ecommerce with its public Storefront API and hosted checkout, and WordPress as a headless CMS/blog backend read through the public WP REST API. + +## Preconditions + +1. An authenticated Hostinger MCP session — the entry skill's bootstrap handled this. If MCP tools fail with auth errors, send the user back through `entry/skill.md`. +2. The Hostinger MCP operations for **hosting** (plus **ecommerce** when the run involves a store, and **wordpress** when it involves a content backend). Operation availability varies per user — product groups can be toggled in the Hostinger Connector. When search cannot find a needed operation, ask the user to enable that product group (or configure the scoped binary, e.g. `hostinger-hosting-mcp`) rather than improvising around it. +3. An active hosting plan (checked in Setup §1). Hostinger hosting is a paid product: if the account has no usable plan, inform the user plainly that a subscription is required, link them to https://www.hostinger.com/web-hosting, and pause until they confirm the purchase. Do not treat this as an error — it is a normal step for new accounts. Everything that doesn't need hosting (planning, building the frontend locally) can proceed while they decide. + +## Resolving the operation + +Resolve by intent first, disk second — never let an empty directory override what the user is asking for. Check `iterate` first (it's decided by an unambiguous on-disk signal): + +- `iterate` — a `.hostinger/site.json` is present in the project: the site is already deployed through this skill and the user wants changes. Reuse the recorded domain/site details; apply only the delta the new intent needs (edit frontend → redeploy; add a store → run `references/STORE.md` then redeploy). Never re-provision an existing site. +- `connect` — a frontend project already on disk (or brought in as a zip/export/URL) that is not yet on Hostinger, with language like "deploy this / host this on Hostinger / connect this project". Emptiness of the CWD at trigger time is not a create signal when a design is brought in from elsewhere. +- `create` — a new site from a prompt with nothing brought in: "build me a store / portfolio / site…". + +If signals conflict, ask the user — don't guess. + +## The run + +1. **Discovery** — from the prompt (and the project on disk for connect/iterate), infer: does this run need a store (any buy/sell/product intent → yes)? Does it need owner-managed content — a blog, news, or anything the owner edits without a redeploy (→ WordPress backend; static copy that rarely changes does not qualify)? What brand, copy, and structure does the site need? What stack fits — plain static HTML/CSS/JS for simple sites (default), a static-output framework build, or a Node.js app when SSR or server code is genuinely required? Prefer static: it deploys fastest and has no build-failure surface. Ask the user only what you cannot infer. +2. **Setup** (`references/SETUP.md`) — plan check, then provision the website on a free subdomain (or the user's own domain) and wait until it's ready. +3. **Store** (`references/STORE.md`, only when commerce is needed) — resolve or create the store and its `custom` sales channel, seed products/shipping/payment, and note the `sales_channel_id` for the frontend. +4. **Content backend** (`references/WORDPRESS.md`, only when owner-managed content is needed) — install WordPress on a dedicated subdomain, wait until it's ready, and hand the owner a wp-admin login link. The frontend reads it through the public WP REST API. +5. **Build** — create or wire the frontend. For store runs, follow the frontend contract in `references/STORE.md` (catalog fetched at runtime from the public Storefront API, cart in `localStorage`, client-side checkout — never embed an API token in the site). For content runs, follow the frontend contract in `references/WORDPRESS.md` (posts fetched at runtime from the WP REST API, rendered HTML bodies, graceful empty states). When the app needs MySQL, follow `references/DATABASE.md` (which host each runtime connects to, credentials via env vars or a server-side config file, never in the frontend). +6. **Deploy** (`references/DEPLOYMENT.md`) — archive and deploy via the matching hosting operation, polling build logs for Node.js runs. +7. **Verify** — curl the live URL for a 200 and a piece of real page copy; for store runs, confirm a checkout POST returns a redirect URL; for content runs, confirm the WP REST API returns 200 and the frontend renders posts. Show the user the live URL and where to manage things (hPanel: https://hpanel.hostinger.com, the store dashboard for commerce, wp-admin for content). +8. **Record** — write `.hostinger/site.json` into the project: `{ "domain", "username", "type": "static"|"nodejs", "sales_channel_id"?, "store_id"?, "cms_domain"? }`. This is what makes future runs resolve as `iterate`. + +Run non-interactively wherever possible. The exceptions that must involve the user: the paid-plan confirmation, anything that costs money (a domain purchase, a new subscription), and picking between genuinely equal options the prompt doesn't decide. + +## Paths + +| What | Path | +| --- | --- | +| Plan check + website/domain provisioning | `references/SETUP.md` | +| Store: seed the backend + the frontend API contract | `references/STORE.md` | +| WordPress: headless CMS/blog backend + the frontend read contract | `references/WORDPRESS.md` | +| Deploy: static vs Node.js, archive rules, logs, verify | `references/DEPLOYMENT.md` | +| Database + runtime: MySQL host per runtime, env vars, what to poll, runtime logs | `references/DATABASE.md` | + +## Where the how comes from + +The inputSchema returned by search is authoritative for request shapes — read it before calling. Two live sources supersede anything written here when they disagree: + +- The ecommerce operation `ecommerce_miscellaneous_custom-storefront-setup-instructions` returns the current storefront integration guide from the server — execute it at the start of any store run. +- The Hostinger API reference at https://developers.hostinger.com describes every endpoint behind the operations. diff --git a/skills/hostinger-headless/references/DATABASE.md b/skills/hostinger-headless/references/DATABASE.md new file mode 100644 index 0000000..4e70a41 --- /dev/null +++ b/skills/hostinger-headless/references/DATABASE.md @@ -0,0 +1,49 @@ +# Database and runtime — MySQL hosts, env vars, and what to poll + +Use this when the app needs MySQL, or when a deploy "succeeded" but the app cannot reach its database. Everything here uses the **hosting** MCP operations; Agency Plan differences are at the end. + +## 1. Create the database + +1. `hosting_databases_create` on the site's `username` with a database name, a user and a password you generate — name and user are prefixed with the account username automatically. +2. Read the full, prefixed `name` and `user` back from `hosting_databases_list`; every other database operation wants the full name. +3. Do not print the password to the user once it is stored, and never commit it. + +## 2. Which host the app connects to + +| Where the code runs | Host | Port | Why | +| --- | --- | --- | --- | +| PHP on the website | `localhost` or `127.0.0.1` | 3306 | `localhost` uses the MySQL socket; both are granted | +| Node.js on the website | `127.0.0.1` | 3306 | `localhost` may resolve to IPv6 `::1`, and not every database user has that grant | +| Outside Hostinger (a laptop, another server) | the `host` from `hosting_databases_list` (`srvNNNN.hstgr.io`) | 3306 | needs `hosting_databases_create-remote-connection` for that client's IP first — never `%`, it opens the database to every address on the internet | + +Do not put the remote `host` into the deployed app — it has no grant for connections that come from the server itself. + +## 3. Hand credentials to the app + +- **Node.js:** environment variables via `hosting_nodejs_replace-environment-variables`. Conventional keys: `DB_HOST=127.0.0.1`, `DB_PORT=3306`, `DB_NAME`, `DB_USER`, `DB_PASSWORD`, plus `DATABASE_URL=mysql://USER:PASSWORD@127.0.0.1:3306/NAME` for ORMs that want one string — URL-encode `USER` and `PASSWORD` there (`encodeURIComponent`), or a password containing `@`, `:`, `/` or `#` breaks the URL. The call is a **full replace**: list the current keys with `hosting_nodejs_list-environment-variables` (values come back masked as `********` — never copy those), then send the complete set with real values. Saving restarts the process; frameworks that bake variables into the build (Next.js, `NEXT_PUBLIC_*`) need a new `hosting_nodejs_start-build` afterwards. +- **PHP:** a config file on the server that the app reads (its own `config.php`, WordPress's `wp-config.php`). Ship it with the deploy, keep it out of git. +- **Never** in client-side JavaScript, in a committed `.env`, or in chat replies. + +## 4. What is asynchronous, and what to poll + +| You called | Poll this until | Typical wait | +| --- | --- | --- | +| `hosting_websites_create` | `hosting_websites_list-setups` with the domain reports `status: completed` | up to a few minutes | +| `hosting_deploy-js-application` | `hosting_list-js-deployments` shows the build finished | minutes | +| `hosting_nodejs_start-build` | `hosting_nodejs_build` state is `completed` or `failed` | minutes | +| `wordpress_installations_install`, plugin/theme/core jobs | `wordpress_installations_list` lists the install | 1–2 minutes | +| `hosting_databases_repair`, `hosting_websites_delete` | nothing to poll — runs in the background | minutes | +| `agency-hosting_website-setups_create` | `agency-hosting_website-setups_status` with `setup_uuid` is `completed` | minutes | + +Poll with backoff (a few seconds, then tens of seconds). A queued response is not a failure, and re-sending the write does not speed it up. + +## 5. When the app is up but broken + +- Build failed: `hosting_nodejs_build-logs` for the raw log, `hosting_nodejs_analyse-failed-build` for a diagnosis. +- Build passed, app errors: `hosting_nodejs_runtime-logs` with a `period` such as `1h`; entries before `last_deployed_at` belong to the previous deploy. +- `Access denied for user 'x'@'::1'`: the app used `localhost` from Node.js — set `DB_HOST` to `127.0.0.1`. +- PHP limits (memory, upload size): `hosting_php_get`, then `hosting_php_update-options`. + +## Agency Plan websites (`agency-hosting_*`) + +`agency-hosting_databases_create-website` creates the database and its single user; the user is granted on `localhost`, so the PHP app connects to `localhost`. Deploys are synchronous there — `agency-hosting_deploy-php-application` returns when the site is live. Other jobs (SSL, backups) show up in `agency-hosting_websites_list-processes`. diff --git a/skills/hostinger-headless/references/DEPLOYMENT.md b/skills/hostinger-headless/references/DEPLOYMENT.md new file mode 100644 index 0000000..e3926e3 --- /dev/null +++ b/skills/hostinger-headless/references/DEPLOYMENT.md @@ -0,0 +1,36 @@ +# Deployment — getting the build live + +Match the deploy method to what the project actually is — this is the single most common failure point. + +The deploy operations below read the archive from this machine, so only the local `hostinger-api-mcp` server has them. On the hosted server (`mcp.hostinger.com`) `search` does not find them: upload the files and deploy from the upload as described in the `deploy-to-hosting` skill ("Without the local deploy operations"). Agency Plan sites deploy through the Agency operations listed there as well. + +## Static site → `hosting_deploy-static-website` + +For pre-built files only: plain HTML/CSS/JS, or the **build output** of a framework (run the build locally first). + +- The archive (zip/tar) must have `index.html` at its **root** — not nested inside a folder. +- Name it `name_YYYYMMDD_HHMMSS.zip`; pass `removeArchive: true` to clean up after upload. +- Deployment is effectively immediate — verify right after. + +## Node.js app → `hosting_deploy-js-application` + +For anything that needs a server or a server-side build (Express, Next.js, NestJS, SSR frameworks). + +- Archive the **source**, not the output: exclude `node_modules/`, `dist/`, `.next/`, `build/`, and everything matched by `.gitignore`. The install and build run on Hostinger. +- Hard cap: **50 MB** archive. +- The upload starts a build. Track it with `hosting_list-js-deployments`; on failure pull `hosting_show-js-deployment-logs`, fix, and redeploy. Poll with backoff — builds take minutes, not seconds. + +## WordPress → `hosting_import-wordpress-website` / plugin & theme operations + +Only when the user explicitly wants a WordPress *site* migrated or themed. Site imports take an archive plus a `.sql` dump and can run for several minutes. (WordPress as a headless content backend behind an agent-built frontend is a different flow — that's `WORDPRESS.md`, installed fresh via the API, not imported here.) + +## Verify (every deploy) + +```bash +curl -s -o /dev/null -w "%{http_code}\n" https://YOURDOMAIN/ +curl -s https://YOURDOMAIN/ | grep -o "SOME_REAL_HEADLINE_TEXT" +``` + +Replace the grep target with copy you actually rendered — a 200 alone can be a placeholder page. A freshly created site may serve a default page for a short while; if content doesn't match, clear the cache (`hosting_cache_clear-website`) and retry before assuming the deploy failed. For store runs, also run the checkout verification in `STORE.md`. + +When the site is live, report the URL and remind the user the site is managed from hPanel (https://hpanel.hostinger.com). diff --git a/skills/hostinger-headless/references/SETUP.md b/skills/hostinger-headless/references/SETUP.md new file mode 100644 index 0000000..632ab67 --- /dev/null +++ b/skills/hostinger-headless/references/SETUP.md @@ -0,0 +1,35 @@ +# Setup — plan check and website provisioning + +Everything here uses the **hosting** MCP operations. If they're missing, ask the user to enable the Websites product group in the Hostinger Connector (or use the `hostinger-hosting-mcp` scoped binary). + +## 1. Plan check (gate — run this first) + +A website can only be created on an active hosting plan. + +1. `hosting_websites_list` — if it returns websites, the account has a working plan; note any existing `order_id` and `username` for step 2. +2. Otherwise `hosting_orders_list` — look for an order in a usable state. A fresh order that has never hosted a website still works; note its `order_id`. +3. Agency Plan orders are not in that list: check `agency-hosting_orders_list` too. An active Agency order is a usable plan — create the website with `agency-hosting_website-setups_create` and poll `agency-hosting_website-setups_status` until `completed` (it returns the `website_uid`), then deploy with the Agency operations in the `deploy-to-hosting` skill. +4. If there is no usable order: **stop and tell the user** that an active Hostinger hosting plan is required to deploy, link https://www.hostinger.com/web-hosting, and offer to continue building the site locally in the meantime. When they confirm the purchase, re-run this check. + +Never purchase a plan, domain, or any paid item without the user explicitly approving that specific purchase. + +## 2. Choose the domain + +- **Default: free subdomain.** `hosting_domains_generate-free-subdomain` returns a `*.hostingersite.com` domain. No verification needed. Tell the user a custom domain can be connected later. +- **User-owned domain:** `hosting_domains_verify-ownership` first. If not accessible, relay the TXT record it returns, remind them propagation can take ~10 minutes, and re-verify before continuing. +- **New domain purchase:** only on explicit request — check availability with `domains_availability_check`, state the price, and get an explicit yes before `domains_portfolio_purchase` (needs the domains product group). + +## 3. Create the website and wait for it + +Generating a subdomain does **not** create a website — deploying straight to it fails with `No website found for domain`. The working sequence: + +1. `hosting_websites_create { domain, order_id }` — `datacenter_code` is required only for the first website on a brand-new plan (pick the first entry from `hosting_datacenters_list`). +2. **Poll** `hosting_websites_list-setups` filtered by the domain every 10–15 s until `status` is `completed`. The site shows up in `hosting_websites_list` before its setup finishes, and uploads, deploys and database calls return 404 or 409 until then. Creation takes up to a few minutes — don't fail fast. +3. Note the site's `username` — deployment and database operations are keyed on it. + +If the domain already has a website (an `iterate` run, or the user pointed at an existing site), skip creation entirely. + +## 4. Optional extras (only when the run needs them) + +- **Database:** when the app needs MySQL, follow `DATABASE.md` — creating it, which host each runtime connects to (Node.js must use `127.0.0.1`), and handing the credentials to the app without hard-coding them. +- **DNS records:** the DNS operations (`dns_records_update` etc.) for custom-domain records; take a snapshot (`dns_snapshots_list` context) before destructive changes. diff --git a/skills/hostinger-headless/references/STORE.md b/skills/hostinger-headless/references/STORE.md new file mode 100644 index 0000000..d370006 --- /dev/null +++ b/skills/hostinger-headless/references/STORE.md @@ -0,0 +1,52 @@ +# Store — Hostinger Ecommerce with a custom storefront + +**Primary source:** execute `ecommerce_miscellaneous_custom-storefront-setup-instructions` at the start of every store run — it returns the current, server-maintained integration guide, and it supersedes this file wherever they disagree. This file carries the essentials so the run can be planned before that call, and a fallback when the ecommerce operations aren't enabled. + +## Mental model + +Two API surfaces — don't mix them: + +| Surface | Base URL | Auth | Use for | +| --- | --- | --- | --- | +| Storefront Core V2 | `https://api-ecommerce.hostinger.com/v2` | none (public, open CORS) | read products/variants, checkout — called from the browser | +| Management (MCP tools) | Hostinger API | authenticated | create stores/products/shipping/payments | + +- A **store** (`store_*`) has **sales channels** (`scha_*`). The Storefront API is keyed on the **`sales_channel_id`** of a `custom`-type channel — not the store id. Managed channels (e.g. `quick-link`) cannot be used here, and only `custom` channels are API-creatable. +- **Prices are integers in minor units** (`2900` = €29.00 → divide by `10^decimal_digits`) and live on **variants**, not products. +- **Security boundary:** storefront reads and checkout are public and run client-side — **never embed a Hostinger API token in the storefront**. Only the management/hosting side (MCP tools) is authenticated. + +## Backend setup (management tools) + +1. Resolve the `custom` sales channel: `ecommerce_stores_list` → `ecommerce_sales-channels_list`. If a `custom` channel already exists, confirm with the user that it's the one to use; otherwise add one to the existing store with `ecommerce_sales-channels_create`, or create a store with `ecommerce_stores_create` (with a `custom` sales channel) when no suitable store exists. Set the channel `url` to the storefront's public domain at creation when it's already known. +2. For checkout to work the store needs all three: ≥ 1 product, ≥ 1 payment method, ≥ 1 shipping zone. Payment, shipping, and currency are store-level — check `ecommerce_stores_metadata` (`has_payment_methods` and `has_shipping` must be `true`; the same response carries `default_currency` with `code`, `decimal_digits`, `template` — read it here rather than guessing). Products are **per sales channel** — verify by listing products for the resolved channel on the Storefront API and confirming the list is non-empty. Seed what's missing with `ecommerce_products_create-physical` / `ecommerce_products_create-digital`, `ecommerce_payments_enable-manual-method`, and `ecommerce_shipping_set-store` (price `0` = free shipping) — confirming with the user before writing to a store that already has real data. +3. After deploy, point the channel at the live site: `ecommerce_sales-channels_update { store_id, sales_channel_id, url }`. + +If the ecommerce operations aren't available, ask the user to enable the Ecommerce product group in the Hostinger Connector — or to provide the `sales_channel_id` directly, after which the public endpoints suffice for the frontend work. + +## Frontend contract + +The OpenAPI schema for the Storefront API is at `https://api-ecommerce.hostinger.com/v2/docs.json` — fetch it for exact endpoint shapes. Non-obvious rules the schema won't spell out: + +- **Fetch the catalog at runtime, not build time** — client-side fetch on page load (CORS is open). Baking products into a static build makes the site stale on the first catalog edit. (SSR / Node.js hosting may fetch it server-side per request.) +- Each variant has a **`prices[]` array** (one entry per currency) — read `prices[0].amount` / `prices[0].sale_amount` (minor units) and `prices[0].currency` (which carries `decimal_digits` and the `template` whose `$1` placeholder you replace when formatting). There is **no** top-level `amount` on a variant. +- Product detail resolves by **product id** only; a slug returns 404 (map slug→id from the list endpoint). `limit` max is 100 on list endpoints (else 400). +- Filter variants with `product_ids[]=...`; the unfiltered variant list is eventually-consistent right after catalog edits. +- Cart lives in the site (e.g. `localStorage`): persist only `variant_id` + `quantity`, resolve display data from the live catalog — never a saved copy — then send everything in one checkout call: + +``` +POST /channels/{sales_channel_id}/checkout +{ "items":[{ "variant_id":"variant_01...", "quantity":1 }], + "success_url":"https://YOURDOMAIN/checkout/success/", + "cancel_url":"https://YOURDOMAIN/checkout/cancel/", + "locale":"en" } +``` + +`success_url`/`cancel_url` are required — build them from `window.location.origin` and make sure both pages exist. The response is `{ url, cart_token }`; redirect the browser to `url` (Hostinger's hosted checkout). + +A multi-step cart alternative exists (`POST /channels/{sales_channel_id}/carts`, `PATCH /carts/{cart_id}`, `POST /carts/{cart_id}/line-items`, `PUT /carts/{cart_id}/shipping-method`, `POST /carts/{cart_id}/complete`) — the single checkout call suffices for a simple buy flow. + +## Verify + +- A `POST` to the checkout endpoint returns a `url` — test it directly with curl before calling the run done. +- The `success_url`/`cancel_url` pages return 200 (`curl -s -o /dev/null -w "%{http_code}" https://YOURDOMAIN/checkout/success/`). +- Open the live site, add to cart, and confirm the redirect to `https://checkout.hostinger.com`. diff --git a/skills/hostinger-headless/references/WORDPRESS.md b/skills/hostinger-headless/references/WORDPRESS.md new file mode 100644 index 0000000..9e1a3c0 --- /dev/null +++ b/skills/hostinger-headless/references/WORDPRESS.md @@ -0,0 +1,51 @@ +# WordPress — headless CMS and blog backend + +Use WordPress when the site has **owner-managed content**: a blog, news, articles, or any content the owner must edit without a developer or a redeploy. The frontend stays agent-built and is deployed like any other run; WordPress runs separately as the content backend, and the owner writes in wp-admin. + +**When NOT to use this:** static copy that rarely changes (an about page, a services list, a brochure site) — bake that into the frontend. Installing WordPress for content the owner will never edit adds a moving part for nothing. Any buy/sell intent is `STORE.md`, not this file. + +Everything in Setup uses the **hosting** and **wordpress** MCP operation groups; ask the user to enable them in the Hostinger Connector if operations are missing. + +## Mental model + +Two surfaces, like the store recipe: + +| Surface | Base URL | Auth | Use for | +| --- | --- | --- | --- | +| WP REST API | `https://CMS_DOMAIN/wp-json/wp/v2` | none for published content (open CORS) | frontend reads: posts, pages, media, categories | +| Management (MCP tools + wp-admin) | Hostinger API / wp-admin | authenticated | install WP, plugins, cache; the owner writes content | + +- Published content is publicly readable and the REST API allows cross-origin browser reads — a static frontend on another domain fetches it directly at runtime. +- Drafts, previews, and **writes need authentication** (WP application passwords). Never put credentials of any kind in the frontend; a public site only needs the anonymous read path. + +## Setup (management tools) + +1. **Check for an existing installation first**: `wordpress_installations_list` filtered by the site's username/domain. Reuse a valid install when the user agrees — never overwrite one silently. +2. **Choose where WordPress lives.** Default: a dedicated subdomain of the site, e.g. `cms.` — create it with `hosting_domains_create-website-subdomain` so the main domain stays free for the frontend. A separate free-subdomain website (per `SETUP.md`) also works when the plan allows another website. +3. **Install**: `wordpress_installations_install` on that domain. The call only queues the job — **poll** `wordpress_installations_list` until the installation appears (typically 1–2 minutes). Don't proceed on the queued response alone. +4. **Hand the owner their editor**: mint a one-click wp-admin link with `wordpress_login_create-links` and show it to the user. Content authoring happens in wp-admin — the skill does not seed posts (there is no anonymous write path, by design). The fresh install ships with a sample post, which is enough to build and verify the frontend against. +5. **Caching** (recommended before finishing): enable the object cache with `wordpress_object-cache_toggle-memcached`; after config changes, purge with `wordpress_litespeed-cache_purge-lite-speed`. + +## Frontend contract + +All paths relative to `https://CMS_DOMAIN/wp-json/wp/v2`. Non-obvious rules: + +- **Fetch at runtime, not build time** — content changes whenever the owner publishes; baking it into a static build defeats the purpose. Client-side fetch on page load is fine (CORS is open). +- List posts with `/posts?per_page=10&_embed` — `_embed` inlines featured images (`_embedded['wp:featuredmedia'][0].source_url`), authors, and terms; without it you get IDs that need extra requests. +- Post bodies are **rendered HTML**: use `title.rendered` / `content.rendered` / `excerpt.rendered` and render them as HTML — do not treat them as plain text and do not try to restyle their inner markup beyond CSS. +- Single post by slug: `/posts?slug=my-post` — returns an **array** (take the first element); there is no direct slug path. +- Pagination comes from the `X-WP-Total` / `X-WP-TotalPages` response headers, not the body. +- Only **published** content is returned anonymously. An empty list is a normal state — the frontend must render it gracefully, not error. +- SEO is the frontend's job: page titles, meta tags, and the sitemap come from the frontend build, not from WordPress plugins. + +## Verify + +```bash +curl -s -o /dev/null -w "%{http_code}\n" "https://CMS_DOMAIN/wp-json/wp/v2/posts?per_page=1" +``` + +Expect 200 with a JSON array. Then confirm the deployed frontend renders the sample post (or a clean empty state), and show the user two links: the live site and the wp-admin login for writing content. + +## Record + +Add `"cms_domain"` to `.hostinger/site.json` (see `SKILL.md` §Record) so iterate runs know a WordPress backend exists and reuse it instead of installing again. diff --git a/skills/maintain-wordpress/SKILL.md b/skills/maintain-wordpress/SKILL.md new file mode 100644 index 0000000..cfa18f3 --- /dev/null +++ b/skills/maintain-wordpress/SKILL.md @@ -0,0 +1,74 @@ +--- +name: maintain-wordpress +description: "Keep WordPress sites on Hostinger web hosting updated and secure: checks core, plugin and theme versions, known vulnerabilities and install health on one site or every site in the account, reports what needs doing, applies updates in a safe order, and confirms each site still loads. Also covers cache purges, the Memcached object cache, maintenance mode and one-click wp-admin login links. Triggers: update my WordPress, update plugins, are my WordPress sites secure, WordPress vulnerabilities, outdated plugins or themes, WordPress maintenance, speed up WordPress, log me into wp-admin." +--- + +# Maintain WordPress + +Check first, report, then update only what the user approves — one site at a time, proving each still loads before moving to the next. + +## Calling the operations + +- Read the `inputSchema` that `search` returns before the first call of each operation. If a name below is rejected as unknown, `search` for what the step does (e.g. "wordpress plugins update"). +- Batch reads with `multi-execute` (up to 20 steps a batch). Batches chain operations from one server only — the Hostinger Connector runs `wordpress`, `hosting` and `agency-hosting` as separate servers. +- Updates, activations, uninstalls and core changes are queued jobs: a success response means "queued". Poll the matching read operation every 10–20 s until the change shows; never re-send the write. + +## 1. Find the installs + +- One site: `wordpress_installations_list` with `domain` (substring match — take the exact entry). Every site: `wordpress_installations_list` without filters, adding `ownership: "all"` to include sites the user manages for others. +- Keep `id` (the `software` parameter of every `wordpress_*` call), `username`, `domain`, `directory`, `is_valid` and `validation_error`. +- Agency Plan WordPress sites come from `agency-hosting_websites_list-plan` with `website_types: ["wordpress"]`. When `wordpress_installations_list` does not include them, only `agency-hosting_wordpress_settings` and core version changes (`agency-hosting_wordpress_list-versions`, `agency-hosting_wordpress_change-version`) are available; plugins and themes are updated from wp-admin. + +## 2. Check (read-only) + +Per install: + +- `wordpress_installations_show-core-version` — core version and the known vulnerabilities that affect it. +- `wordpress_installations_list-core-updates` — available core versions. +- `wordpress_plugins_list-installed` — `status`, `update` (the newer version, when there is one) and `vulnerabilities[]` with `fixed_in`. +- `wordpress_themes_list-installed` — the same for themes. + +Four steps per install fit five installs in one batch. For an install with `is_valid: false`, run `wordpress_installations_check-if-are-valid` with `force: true` for a fresh reason and leave it out of updates — a broken install is the `troubleshoot-website` skill's job. + +## 3. Report before changing anything + +``` +## example.com (WordPress 6.8.1) +Vulnerable: contact-form-x 5.2 → fixed in 5.3 (update available) +Vulnerable, inactive: old-slider 1.0 — no fix; uninstall recommended +Updates: core 6.8.1 → 6.8.3 (minor), 4 plugins, 1 theme +``` + +Vulnerable items come first. A vulnerable plugin without a fix, or an inactive one, is better removed with `wordpress_plugins_uninstall` than left installed — inactive code on disk can still be reached. Ask which updates to apply. + +## 4. Back up first + +The API has no backup operation. Before updating, ask the user to create a backup in hPanel or confirm the latest automatic one is recent enough. Say it plainly; the user may choose to go ahead without one. + +## 5. Update, one site at a time + +1. Plugins that fix a vulnerability — `wordpress_plugins_update` with their slugs. +2. The remaining approved plugins, then themes with `wordpress_themes_update`. +3. Core with `wordpress_installations_update-core`: `minor: true` for patch releases; a major `version` only when the user asks for it. + +For a busy site the user may want `wordpress_maintenance_toggle` with `enabled: true` during the run — and it is always turned off again afterwards, even when something failed. + +After each site: + +1. `wordpress_litespeed-cache_purge-lite-speed`. +2. `curl -s -o /dev/null -w "%{http_code}\n" https://DOMAIN/` and the same for `https://DOMAIN/wp-login.php` — both should be `200` with no PHP error in the body. +3. `wordpress_installations_check-if-are-valid` with `force: true`. + +When a site breaks: stop the run, deactivate the plugin updated last with `wordpress_plugins_deactivate`, check again, and report which update caused it before touching any other site. + +## 6. Performance and access + +- Page cache: `wordpress_litespeed-cache_show-lite-speed-status`; purge after design or content changes. +- Object cache: `wordpress_object-cache_show-memcached-status`, then `wordpress_object-cache_toggle-memcached` with `enabled: true` — the usual quick speed-up. +- PHP version: `hosting_php_get` is large (around 25 KB), so read it only when the user asks about PHP. PHP 8.x is markedly faster than 7.x; confirm plugin compatibility before `hosting_php_update-version`. +- wp-admin: `wordpress_login_create-links` returns temporary one-click login links. Give them to the user only; never store or reuse them. +- Hostinger's own plugins update with `wordpress_plugins_update-hostinger` (`slug`). + +## Many sites + +Tell the user how many installs there are before starting. Check in batches, keep one running report, and update site by site so a failure stops the run with the rest untouched. diff --git a/skills/migrate-to-hosting/SKILL.md b/skills/migrate-to-hosting/SKILL.md new file mode 100644 index 0000000..d18f365 --- /dev/null +++ b/skills/migrate-to-hosting/SKILL.md @@ -0,0 +1,80 @@ +--- +name: migrate-to-hosting +description: "Move an existing website from another host to Hostinger web hosting (Shared, Cloud or Agency plans) without downtime: WordPress sites from a files archive and SQL dump, static and PHP sites from an archive, Node.js apps from source. Creates the website on the real domain, imports files and database, tests the copy before any DNS change, then switches the domain and SSL. Triggers: migrate my site to Hostinger, move my website from another host, transfer my WordPress site, import my website, switch hosting to Hostinger." +--- + +# Migrate to hosting + +The old host keeps serving the site until the copy on Hostinger is proven to work. DNS moves last. + +## Calling the operations + +- Read the `inputSchema` that `search` returns before the first call of each operation. If a name below is rejected as unknown, `search` for what the step does (e.g. "import wordpress"). +- Batch reads with `multi-execute`. Batches chain operations from one server only — the Hostinger Connector runs `hosting`, `wordpress`, `agency-hosting`, `domains` and `dns` as separate servers. +- Imports and deploys overwrite the target website's contents; confirm the target before each one. + +## 1. What is being moved + +Establish, asking only for what cannot be inferred: + +- **Site type:** WordPress, static, PHP (with or without MySQL), or Node.js. +- **The export:** + - WordPress — an archive of the whole WordPress root (including `wp-content` and `wp-config.php`) and a `.sql` dump. + - PHP — a files archive, plus a `.sql` dump when the app has a database. + - Static — the files. Node.js — the source or its Git repository. + - Without one, the user exports it from the old host's panel, or over SSH: `tar -czf site.tar.gz -C /path/to/site .` and `mysqldump --single-transaction -u USER -p DBNAME > db.sql`. +- **The exact home URL** (`https`, with or without `www`) — WordPress keeps it in the database, so the new site must answer on the same one. +- **Current DNS**, to preserve what already works: + +```bash +dig +short NS DOMAIN; dig +short A DOMAIN; dig +short MX DOMAIN; dig +short TXT DOMAIN +``` + +- **Cron jobs** on the old host — they do not move with the files. + +## 2. Create the website on the real domain + +Create the Hostinger website on the domain being migrated, not on a free subdomain: step 4 tests it by pointing only this machine at Hostinger, so nothing changes for visitors yet. + +- Shared and Cloud: `hosting_domains_verify-ownership` first. When `is_accessible` is false, the user adds the returned `TXT` record at their current DNS provider, next to the existing ones, and verification is repeated. Then `hosting_websites_create` with `domain` and `order_id` (from `hosting_orders_list`), and poll `hosting_websites_list-setups` with `domain` every 10–15 s until `status: completed`. +- Agency: `agency-hosting_website-setups_create` with the `domain`, `flavor: "php-fpm"`, a `settings.php.version` matching the old host (options in `agency-hosting_php_list-versions-for-order`) and `datacenter_code` from `agency-hosting_datacenters_list`. Poll `agency-hosting_website-setups_status` until `completed` for the `website_uid`. + +## 3. Import + +`hosting_import-wordpress-website`, `hosting_deploy-static-website` and `agency-hosting_deploy-php-application` read files from this machine and exist only in the local `hostinger-api-mcp` server. On the hosted server (`mcp.hostinger.com`), upload the files first as described in the `deploy-to-hosting` skill ("Without the local deploy operations") and use the operation named in brackets below. + +**WordPress, Shared and Cloud:** `hosting_import-wordpress-website` with `domain`, `archivePath` and `databaseDump` uploads both, extracts the files and imports the database; large sites take several minutes. [Upload `site.zip` and `dump.sql`, then `wordpress_installations_import-website` with `archive_path` and `sql_path`.] Then `wordpress_installations_detect` with `username` and poll `wordpress_installations_list` with `domain` until the install appears with `is_valid: true`. + +**Static, or PHP without a database:** `hosting_deploy-static-website` [upload, then `hosting_websites_deploy-static-site-archive`]; Agency: `agency-hosting_deploy-php-application` [upload to `.h5g/`, then `agency-hosting_files_import-website-from-archive`]. + +**PHP with a database, Shared and Cloud:** + +1. `hosting_databases_create` with a strong generated password; read the full name, user and `host` back from `hosting_databases_list`. +2. Import the dump from this machine: allow only its public IP (`curl -s https://api.ipify.org`) with `hosting_databases_create-remote-connection`, run `mysql -h HOST -u USER -p NAME < db.sql`, then remove the rule with `hosting_databases_delete-remote-connection`. Without a MySQL client, use `hosting_databases_phpmyadmin-link` and import there. +3. Put the new name, user and password into the app's config file, with host `localhost`, before archiving; then deploy as above. Never ship the `srvNNNN.hstgr.io` host inside the app. + +**Node.js:** deploy with the `deploy-to-hosting` skill. When a dump must be imported, create the database with `hosting_databases_create` rather than `hosting_databases_setup-website` — the latter never reveals the password needed for the import — and pass the credentials through environment variables. + +**Agency:** files with `agency-hosting_deploy-php-application` [or upload plus `agency-hosting_files_import-website-from-archive`]; the database with `agency-hosting_databases_create-website`, imported through phpMyAdmin in hPanel (no import operation exists). For WordPress, set the new credentials in `wp-config.php` before archiving. + +## 4. Test before DNS moves + +Find the server address: `details.ipv4` for Agency; for Shared and Cloud, the `A` record for `@` in the Hostinger zone (`dns_records_list` on the domain) or the IP hPanel shows for the website. Then point only this machine at it: + +```bash +curl -sSk --resolve DOMAIN:443:IP -o /dev/null -w "%{http_code}\n" https://DOMAIN/ +curl -sSk --resolve DOMAIN:443:IP https://DOMAIN/ | grep -o "TEXT FROM THE LIVE SITE" +curl -sSk --resolve DOMAIN:443:IP -o /dev/null -w "%{http_code}\n" https://DOMAIN/wp-login.php +``` + +`-k` is expected here: the certificate for the domain can only be issued after DNS moves. Check the home page, an inner page and, for WordPress, the login page. For a look in the browser, the user adds `IP DOMAIN www.DOMAIN` to their hosts file and removes it afterwards. Fix anything broken now, while visitors still see the old site. + +## 5. Switch DNS and SSL + +Follow the `connect-domain` skill from its DNS step: keep every `MX` and `TXT` record from step 1, then install SSL once the domain resolves to Hostinger. When the user controls the old DNS, lowering the TTL of the `A` records to 300 a day ahead shortens the switch. + +## 6. After the switch + +- Verify without `--resolve`: `curl -sSI https://DOMAIN/` shows `platform: hostinger`. +- Recreate the old host's cron jobs with `hosting_cron-jobs_create` (Agency: `agency-hosting_cron-jobs_create-website`). +- Keep the old hosting running for a few days — some resolvers still cache the old address, and email hosted there must be moved separately. diff --git a/skills/troubleshoot-website/SKILL.md b/skills/troubleshoot-website/SKILL.md new file mode 100644 index 0000000..2357f0e --- /dev/null +++ b/skills/troubleshoot-website/SKILL.md @@ -0,0 +1,104 @@ +--- +name: troubleshoot-website +description: "Diagnose and fix a website on Hostinger web hosting (Shared, Cloud or Agency plans) that is down, slow, erroring, insecure or failing to build. Checks the site from outside, reads builds, runtime logs, WordPress health, SSL, cache and PHP settings through the Hostinger MCP, names the cause with evidence, and applies the fix once the user agrees. Triggers: my site is down, site not loading, 500 / 502 / 503 error, white screen, error establishing a database connection, site is slow, SSL or certificate warning, not secure, changes not showing, Node.js build failed, app keeps crashing." +--- + +# Troubleshoot a website + +One website and one symptom in; a named cause, the evidence for it, and a fix out. Stay read-only until the cause is stated and the user agrees to the fix. + +## Calling the operations + +- Read the `inputSchema` that `search` returns before the first call of each operation. If a name below is rejected as unknown, `search` for what the step does (e.g. "ssl status"). +- Batch reads with `multi-execute` and pass values between steps with `$steps..`, e.g. `"$steps.0.data.0.username"`. A batch stops at its first failure. +- The Hostinger Connector runs each product as its own MCP server (`hosting`, `wordpress`, `agency-hosting`, `domains`, `dns`), so a batch can only chain operations from one server. When `search` cannot find an operation, that product group is switched off in the Connector — ask the user to enable it. + +## 1. Find the website + +Run both lookups, and keep the result for every later call: + +- `hosting_websites_list` with `domain` — Shared and Cloud plans. The filter is a substring match, so take the entry whose `domain` is exactly the one asked about. Keep `username`, `order_id` and `website_type`; every `hosting_*` and `wordpress_*` call is keyed on `username` + `domain`. +- `agency-hosting_websites_list-plan` with `domain` — Agency Plan. Keep `details.uid` (the `website_uid` of every `agency-hosting_*` call), `details.type`, `details.ipv4` and `details.domains`. + +Neither finds it: the domain is not a website on this account — say so and show where it points (step 2). + +## 2. Look at it from outside + +Run these alongside step 1: + +```bash +curl -sS -o /dev/null -w "%{http_code} ttfb=%{time_starttransfer}s %{redirect_url}\n" https://DOMAIN/ +curl -sSI https://DOMAIN/ +dig +short NS DOMAIN; dig +short A DOMAIN; dig +short CAA DOMAIN +``` + +- Hostinger responses carry `platform: hostinger` and `panel: hpanel`. Without them, or with DNS pointing elsewhere, traffic is not reaching this hosting — hand over to the `connect-domain` skill. +- Certificate or TLS errors → [SSL](#ssl). +- `5xx`, a blank page or an error page → [By website type](#3-by-website-type). +- `200` with old content → cache: `hosting_cache_clear-website` (also purges the Hostinger CDN; pass `directory` for WordPress in a subfolder), plus `wordpress_litespeed-cache_purge-lite-speed` for WordPress; Agency: `agency-hosting_cache_clear-website`. +- Slow first byte → [Slow site](#slow-site). Behind the Hostinger CDN, `x-hcdn-upstream-rt` is the origin's own response time in seconds; a small value there means the server is not the bottleneck. + +## 3. By website type + +`website_type` (Shared/Cloud) or `details.type` (Agency) picks the branch. `builder` and `horizons` sites are not managed by these operations — send the user to hPanel. + +### Node.js (`nodejs`) + +Batch `hosting_nodejs_list-builds` (`per_page: 3`), `hosting_nodejs_runtime-logs` (`period: "1h"`, `levels: ["ERROR", "WARN"]`) and `hosting_nodejs_list-environment-variables` (keys only; values always come back masked). + +- Latest build `failed`: call `hosting_nodejs_analyse-failed-build` once for that build — every call re-runs the analysis and the limit is 5 a minute. When it returns nulls, read `hosting_nodejs_build-logs`. A wrongly detected framework, output directory or missing `entry_file` is the usual cause: compare `hosting_nodejs_build-settings` with the project, rebuild with corrected values through `hosting_nodejs_start-build`, and store the same values with `hosting_nodejs_update-build-settings` so Git pushes build correctly too. +- Build `completed` but the app errors: read the runtime logs; entries older than `last_deployed_at` belong to the previous deploy. A variable the code reads but the key list lacks is fixed with the `deploy-to-hosting` skill's environment step. `Access denied for user '…'@'::1'` means the app connects to `localhost` — `DB_HOST` must be `127.0.0.1`. +- Hung process: `hosting_nodejs_restart-application` (restarts without rebuilding). + +### WordPress (`wordpress`) + +`wordpress_installations_list` with `username` and `domain` gives the install `id` — the `software` parameter of every `wordpress_*` call. Batch `wordpress_installations_check-if-are-valid` (`software_ids: [id]`, `force: true`), `wordpress_plugins_list-installed` and `wordpress_maintenance_show-status`. + +- Invalid install: `validation_error` names the problem. +- Broken after a plugin or theme change: deactivate suspects one at a time with `wordpress_plugins_deactivate` (queued — allow a few seconds), re-run the step 2 check after each, and reactivate with `wordpress_plugins_activate` any that were not the cause. +- Maintenance page stuck: `wordpress_maintenance_toggle` with `enabled: false`. +- "Error establishing a database connection": `hosting_databases_list` with `domain`; corrupted tables are fixed by `hosting_databases_repair` (runs in the background). `wp-config.php` cannot be read through the API because files with secrets are refused — for credential checks hand the user `hosting_databases_phpmyadmin-link`. +- Memory or upload-size errors → [PHP](#php). + +### Static or PHP (`other`) + +- `403` or `404` at `/`: `hosting_files_list-website-and-directories` with `max_depth: 1`. `index.html` or `index.php` must sit at the document root; finding it one folder down means the archive was packed a level too deep — redeploy it flat with the `deploy-to-hosting` skill. +- Read `.htaccess` or other config with `hosting_files_website-content`. +- PHP errors → [PHP](#php). + +### PHP + +`hosting_php_get` returns every extension and option (around 25 KB), so call it only for PHP problems. `hosting_php_update-version` switches versions. `hosting_php_update-options` silently caps values at the plan maximum (`max` in `hosting_php_get`), so read the applied value back. Agency: `agency-hosting_php_list-options-for-website`, then `agency-hosting_php_replace-website-options` — a full replace, so send every custom option that should stay. + +### Agency Plan sites + +`agency-hosting_websites_get` shows state and quotas, `agency-hosting_websites_list-processes` shows failed jobs (SSL setup, backups), and `agency-hosting_wordpress_settings` shows core version, LiteSpeed, object cache and maintenance mode. When `wordpress_installations_list` does not return the site, plugins are managed from wp-admin. + +## SSL + +Shared and Cloud, `hosting_ssl_status`: + +- `not_installed` or `failed` (`last_error` says why): the domain must resolve to Hostinger, and any CAA record must allow `letsencrypt.org`, before `hosting_ssl_install` can succeed. Poll the status until `active` or `failed`. +- `installing` or `waiting_for_retry`: wait — another install request returns 422. +- Free `*.hostingersite.com` subdomains use a platform certificate; installing returns 422 by design. +- Browser still warns while the certificate is `active`: turn on the redirect with `hosting_ssl_toggle-https-redirect` when `is_https_redirect_enabled` is false, otherwise the page loads `http://` assets (mixed content) that the app has to change. + +Agency, `agency-hosting_ssl_website-status` for each domain: every domain allows three certificate setups per seven days and one request a minute. Check `agency-hosting_websites_list-processes` before `agency-hosting_ssl_install-website` or `agency-hosting_ssl_reinstall-website`, and never retry in a loop. + +## Slow site + +- WordPress: `wordpress_litespeed-cache_show-lite-speed-status` and `wordpress_object-cache_show-memcached-status`. Turning on Memcached with `wordpress_object-cache_toggle-memcached` is the usual quick win. +- Other sites: server caching may be off or development mode left on, and neither has a read operation. `hosting_cache_toggle-website` with `enabled: true` does nothing when caching is already on; `hosting_cache_toggle-cacheless` with `enabled: false` turns development mode off. +- PHP 7.x runs markedly slower than 8.x; propose a supported 8.x version from `hosting_php_get` when the app allows it. +- Agency: `agency-hosting_metrics_list-order-resource-usage` with `time_frame_hours: 24` shows CPU, memory and processes per website against the plan quota. +- Shared and Cloud have no CPU or memory metrics in the API. When the evidence points at resource limits, send the user to hPanel's resource usage page. + +## Apply the fix + +State the cause, the evidence and the single change proposed, and make it only after the user agrees. Then re-run the step 2 check, polling any queued job first, to show the symptom is gone. When the fix needs something the API cannot do, say so and name the hPanel page. + +## Not available through the API + +- Website backups and restores — hPanel's Backups page. +- CPU, memory and process usage for Shared and Cloud plans. +- PHP error and access logs.