Skip to main content
Glama
README.md
# ptero-mcp

A local [MCP](https://modelcontextprotocol.io) server that lets Claude Code help maintain Minecraft servers on a
[Pterodactyl](https://pterodactyl.io) panel, through the panel's **Client API** only (`ptlc_` keys). It reads
status, logs and configs, finds plugin updates from boot messages, installs addons from Modrinth, Hangar and
SpigotMC, and makes guarded, audited changes. See [CLAUDE.md](CLAUDE.md) for every guardrail.

## Setup

Needs Node 22.18 or newer.

```bash
git clone https://github.com/toxiicxmonster/ptero-mcp
cd ptero-mcp
npm install        # also builds dist/
```

**API key:** in the panel, open *Account → API Credentials* and create a key. Best practice is a key for a
**subuser** that has only the permissions you want Claude to have, not your admin account.

**Settings** come from environment variables, or from a settings file
(`%APPDATA%\ptero-mcp\config.json` on Windows, `~/.config/ptero-mcp/config.json` elsewhere, or `$PTERO_MCP_CONFIG`).
Environment variables win. See [.env.example](.env.example) for all of them:

| Variable | Meaning |
|---|---|
| `PTERO_URL` | Panel URL (https) |
| `PTERO_CLIENT_KEY` | The `ptlc_` key |
| `LIVE_SERVER_ID` | Short ID of the live server (from its panel URL) |
| `STAGING_SERVER_ID` | Optional, recommended: a copy to try changes on first |
| `READ_ONLY` | `true` (default) registers read-only tools only |
| `ALLOW_READ_SERVER_PROPERTIES`, `ALLOW_EDIT_SERVER_PROPERTIES` | Owner switches for `server.properties` |

## Add it to Claude Code

Read-only (safe default):

```bash
claude mcp add ptero -s user -e PTERO_URL=https://panel.example.com -e PTERO_CLIENT_KEY=ptlc_... -e LIVE_SERVER_ID=abcd1234 -- node /path/to/ptero-mcp/dist/src/index.js
```

Maintenance (write tools; every live change still needs `confirm: true`):

```bash
claude mcp add ptero-maint -s user -e PTERO_URL=https://panel.example.com -e PTERO_CLIENT_KEY=ptlc_... -e LIVE_SERVER_ID=abcd1234 -e READ_ONLY=false -- node /path/to/ptero-mcp/dist/src/index.js
```

On Windows use the full path, e.g. `node C:\Users\you\ptero-mcp\dist\src\index.js`.

## Tools

Read-only: `server_status`, `detect_platform`, `tail_logs`, `diagnose_errors`, `list_addons`, `read_file`,
`check_updates`, `diff_staging_vs_live` (with staging).

Write (only with `READ_ONLY=false`): `send_command`, `write_file`, `set_server_property`, `install_addon`,
`update_addons`, `remove_addon`, `backup_then_restart`, `promote_file` (with staging).

Every attempted, previewed, refused, completed and failed change is logged to `audit.jsonl`.

## Development

```bash
npm test           # mock panel only: tests never reach a real panel or marketplace
npm run typecheck
npm run probe      # read-only API discovery against staging (see docs/pterodactyl-api.md)
```