# MCP Server

Pocket Alert speaks the [Model Context Protocol](https://modelcontextprotocol.io), so an AI agent can send you push notifications, read your message history and check delivery stats as ordinary tool calls.

The practical version: an agent starts a long job, finishes at some unpredictable point, and pings your phone instead of waiting for you to check the terminal.

```
https://mcp.pocketalert.app/mcp
```

## Connecting

Authentication is a bearer token — your API key from [API Keys](https://pocketalert.app/account/apikeys), sent as `Authorization: Bearer <token>`.

**Claude Desktop / Claude Code**

```json
{
  "mcpServers": {
    "pocketalert": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://mcp.pocketalert.app/mcp",
        "--header",
        "Authorization: Bearer ${POCKETALERT_API_TOKEN}"
      ],
      "env": {
        "POCKETALERT_API_TOKEN": "your-api-key"
      }
    }
  }
}
```

**Native HTTP transport**

```json
{
  "mcpServers": {
    "pocketalert": {
      "type": "http",
      "url": "https://mcp.pocketalert.app/mcp",
      "headers": {
        "Authorization": "Bearer your-api-key"
      }
    }
  }
}
```

Restart the client afterwards, then ask it to list its tools — `pocketalert` should be there.

## Available tools

| Tool | What it does |
|------|--------------|
| `list_applications` | List your applications |
| `get_application` | Fetch one application by TID |
| `list_devices` | List registered devices |
| `get_device` | Fetch one device by TID |
| `list_messages` | Read message history |
| `get_message` | Fetch a single message by TID |
| `create_message` | Send a push notification |
| `create_message_with_attachment` | Send a push with an image attached |
| `delete_message` | Delete a message |
| `get_message_stats` | Delivery statistics |

`create_message` accepts the same `level` and `actions` parameters as the REST API, so an agent can raise a [critical alert](https://info.pocketalert.app/features/priority-levels.md) or attach [approval buttons](https://info.pocketalert.app/features/action-buttons.md) to what it sends.

## Worth setting up

**Long-running jobs.** Migration, training run, batch import — the agent notifies you when it lands rather than you polling a terminal.

**Human-in-the-loop approvals.** Give the agent `create_message` and have it send two `http` action buttons before it does anything irreversible. You approve from the lock screen; the agent proceeds.

**Reading its own history.** An agent that can call `list_messages` can answer "what broke overnight?" without you forwarding anything.

> **Warning: Scope the key**
>
> An MCP server is a capability you hand to a model. Issue a dedicated API key for it rather than reusing the one your production scripts hold — then revoking the agent's access costs you nothing else.

## Related

- [Priority levels](https://info.pocketalert.app/features/priority-levels.md) — what `level` does to the delivered alert
- [Action buttons](https://info.pocketalert.app/features/action-buttons.md) — approval workflows from a notification
- [Create Message](https://info.pocketalert.app/api/messages/create.md) — the REST equivalent of `create_message`
