Skip to content

API keys and Claude Code ​

API keys are for scripts, CI and AI agents such as Claude Code. A key can do at most what you can; its role and site list narrow it further.

API keys

Create a key ​

  1. Open API keys (or + New → API key).
  2. Give it a Name, such as "Claude Code on my laptop".
  3. Pick a role (for example Read only for monitoring) and an expiry.
  4. Optionally limit it to some sites. A limited key cannot create sites.
  5. Press Create key. The key (hp_…) is shown once. Only a hash is kept.

Every call is in the activity log under your name with the key's name. Revoke stops a key at once. Keys stop working while Safe Mode is on.

Claude Code (MCP) ​

The panel is an MCP server at https://YOUR-PANEL:8443/mcp. Add it to Claude Code with the command shown after you create a key:

bash
claude mcp add --transport http setserver https://panel.example.com:8443/mcp \
  --header "Authorization: Bearer hp_..."

Then ask Claude in plain words, for example "list my sites and their SSL status" or "create a database called shop_db for shop.example.com". Claude uses the same operations as the API, with the key's rights.

Tools the panel offers (depending on the key's rights):

ToolDoes
whoamiThe user and key, and what it may do
list_sites, get_site, create_siteSites
list_files, read_file, upload_fileA site's files
git_deployDeploy a site from git
issue_ssl, ssl_statusCertificates
site_logsError, access or PHP logs
list_databases, create_databaseDatabases
list_backups, backup_siteBackups
scan_site, scan_reportThe malware scanner
list_apps, php_versions, php_settingsApps and PHP
list_users, audit_logUsers and the activity log

Certificate

If you connect by IP address with the panel's self-signed certificate, Claude Code must trust it. From 1.4.3 the certificate includes the server's public IP. The cleanest way is to give the panel a real certificate on a domain: see SSL → The panel's own certificate.

REST API ​

The same key works with the REST API at /api/v1:

bash
# list sites
curl -s -H "Authorization: Bearer hp_..." https://panel.example.com:8443/api/v1/sites

# create a database
curl -s -X POST -H "Authorization: Bearer hp_..." -H "Content-Type: application/json" \
  -d '{"domain":"shop.example.com","name":"shop_db"}' \
  https://panel.example.com:8443/api/v1/databases

Answers are JSON. Errors come back as {"ok": false, "error": "...", "message": "..."}. Every operation is also available by name from the command line: merp ops lists what your key may run and merp call OP key=value runs one.

SetServer Panel documentation