API & MCP
API/MCP tokens let AI agents and your own scripts work with your PikaPods account without your password or second factor.
A token can list your pods with their settings, show live usage and recent events, read logs and, if you allow it, run checked shell commands, while all other changes stay in the PikaPods panel.
The same token works in two ways:
- As an MCP server for coding agents such as Claude Code, which can then diagnose a pod for you.
- As a JSON-RPC API for your own scripts and monitoring.
Creating a Token
Section titled “Creating a Token”Create a token in the PikaPods panel under Account > API/MCP. Give the token a name that identifies where it is used, choose an expiry and its permissions:
- View pods: List your pods with their settings, live usage and recent events. Tools:
list_pods,pod_status. - Read logs: Read your pods’ logs. Tool:
pod_logs. - Run commands: Run checked shell commands in your pods. Tool:
run_command. Only shown when Troubleshooting > Shell is available on your account.
The token is shown only once, so copy it to a safe place before closing the dialog.
Keeping Tokens Safe
Section titled “Keeping Tokens Safe”- Create a separate token for each agent, script or machine, so you can revoke it on its own. You can have up to 10 tokens.
- Only grant the permissions you need and set an expiry where possible.
- Treat tokens like passwords and remove them under Account > API/MCP when they are no longer needed.
- We email you whenever a new token is created. All tokens are revoked when you change or reset your password.
MCP Server
Section titled “MCP Server”Our Model Context Protocol (MCP) server lets a coding agent look at your pods, read their logs and find out why an app is down or slow. It is available at:
https://api.pikapods.com/mcpThe server only supports the latest MCP revision (2026-07-28, stateless Streamable HTTP) and authenticates with an Authorization: Bearer <YOUR TOKEN> header. Older clients that start with an initialize handshake can’t connect. Client support is tracked on Is MCP Good Yet?. At the moment, Claude Code works best.
Connecting an Agent
Section titled “Connecting an Agent”Replace <YOUR TOKEN> with the token from Account > API/MCP.
claude mcp add --transport http --scope user pikapods https://api.pikapods.com/mcp --header "Authorization: Bearer <YOUR TOKEN>"Run claude mcp list to check the connection. Claude Code supports the 2026-07-28 revision by default. MCP skills are in public beta and show up as pikapods:pod-debug.
opencode mcp add pikapods --global --url https://api.pikapods.com/mcp --header 'Authorization=Bearer <YOUR TOKEN>'Run opencode mcp list to check the connection. OpenCode 2.4 and later connect to 2026-07-28 servers by default. MCP skills are off by default. Turn them on with experimental.mcp_skills: true in your config or OPENCODE_FLAGS=mcp_skills. See the OpenCode MCP docs for details.
codex mcp add pikapods --url https://api.pikapods.com/mcp --bearer-token-env-var PIKAPODS_TOKENSet PIKAPODS_TOKEN in the environment Codex runs in, for example in your shell profile:
export PIKAPODS_TOKEN='<YOUR TOKEN>'Codex still defaults to an older MCP revision. Turn on the mcp_2026_07_28 feature to connect. Codex doesn’t load skills from MCP servers, so only the tools are available. See the Codex MCP docs for details.
Most MCP clients accept a JSON config like this one:
{ "mcpServers": { "pikapods": { "type": "http", "url": "https://api.pikapods.com/mcp", "headers": { "Authorization": "Bearer <YOUR TOKEN>" } } }}Key names and the location of the config file vary between clients. The client must support the 2026-07-28 MCP revision. See your client’s documentation for details.
Without an agent, you can call the same tools from scripts using plain JSON-RPC over HTTPS. Each request is a POST to https://api.pikapods.com/mcp and is independent, so there’s no session or handshake.
Available Tools
Section titled “Available Tools”The tools available depend on the token’s permissions:
| Tool | Permission | Arguments | Description |
|---|---|---|---|
list_pods |
View pods | – | All your pods with their settings, update status and help page link. No live data. |
pod_status |
View pods | pod |
One pod’s settings, live usage (state, CPU, memory, storage, uptime) and recent events, newest first. |
pod_logs |
Read logs | pod, num_entries (1–500, default 100), container, since, until, grep, exclude, timestamps |
A pod’s logs, oldest first. since and until take -2h or 2026-10-21 05:00. grep and exclude are regular expressions. |
run_command |
Run commands | pod, command |
Run one shell command in the pod’s main container. Same checks and limits as Troubleshooting > Shell. |
pod takes the pod’s <slug>.pikapod.net hostname, the bare slug or its custom domain. pod_status and pod_logs count toward a limit of 120 reads per hour. run_command shares the hourly command limit with the panel’s shell.
Request Format
Section titled “Request Format”Besides the token, every request needs these headers, matching the JSON-RPC body:
MCP-Protocol-Version: 2026-07-28Mcp-Method: the JSON-RPC method, e.g.tools/callortools/list.Mcp-Name: the tool name, only fortools/call.
The body’s params._meta must repeat the protocol version and list the client’s capabilities, which can be empty. A tool’s result is in result.structuredContent. If the tool failed, for example because a limit was reached, result.isError is true and result.content[0].text has the reason.
Examples
Section titled “Examples”Show the status of one pod:
curl -s https://api.pikapods.com/mcp \ -H "Authorization: Bearer $PIKAPODS_TOKEN" \ -H "Content-Type: application/json" \ -H "MCP-Protocol-Version: 2026-07-28" \ -H "Mcp-Method: tools/call" \ -H "Mcp-Name: pod_status" \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "pod_status", "arguments": {"pod": "my-pod.pikapod.net"}, "_meta": { "io.modelcontextprotocol/protocolVersion": "2026-07-28", "io.modelcontextprotocol/clientCapabilities": {} } } }'To list the tools your token can use, send "method": "tools/list" with Mcp-Method: tools/list, no Mcp-Name header and only _meta in params.
List your pods and the last hour’s errors of one pod, using the requests package:
import requests
MCP_URL = "https://api.pikapods.com/mcp"TOKEN = "<YOUR TOKEN>"VERSION = "2026-07-28"
def call(method, params=None, name=None): headers = { "Authorization": f"Bearer {TOKEN}", "MCP-Protocol-Version": VERSION, "Mcp-Method": method, } if name: headers["Mcp-Name"] = name params = { **(params or {}), "_meta": { "io.modelcontextprotocol/protocolVersion": VERSION, "io.modelcontextprotocol/clientCapabilities": {}, }, } body = {"jsonrpc": "2.0", "id": 1, "method": method, "params": params} response = requests.post(MCP_URL, json=body, headers=headers, timeout=60) response.raise_for_status() result = response.json()["result"] if result.get("isError"): raise RuntimeError(result["content"][0]["text"]) return result
def call_tool(name, **arguments): result = call("tools/call", {"name": name, "arguments": arguments}, name=name) return result["structuredContent"]
for pod in call_tool("list_pods")["pods"]: print(pod["hostname"], pod["app"]["name"], "running" if pod["started"] else "paused")
logs = call_tool("pod_logs", pod="my-pod.pikapod.net", since="-1h", grep="error")print("\n".join(logs["logs"]))