# Connect an agent

> Let an AI assistant read your monitors and incidents through the upfour MCP server: sign in with your upfour account or create a key with the right scopes, connect Claude Code, Cursor, VS Code, Codex, Gemini CLI, Zed or any other MCP client, the tools, prompts and Agent Skill, and what stays under your control.

Source: https://upfour.io/docs/api/connect-an-agent

The upfour MCP server lets an AI assistant in your editor or terminal read your monitors, incidents and scheduled jobs, run a check after a deploy and write its finding into an incident. You sign in with your upfour account, or use an API key. Either way it follows the same scopes and client limits as the REST API, and it can do nothing there that a key could not do.

## Sign in with your upfour account

Clients that support OAuth sign in with the server URL alone, no key. Claude (a custom connector on claude.ai, Claude Desktop, Claude Code), ChatGPT (a custom MCP server in Business, Enterprise and Edu workspaces) and Codex are such clients. Add `https://app.upfour.io/mcp` as the server, then sign in to upfour when the client asks.

- **The consent page** shows which assistant asks and lets you choose **read only** or **read and write**. Read and write covers the reversible edits the tools offer, such as running a check, creating monitors or adding an assessment to an incident. It never covers deleting monitors or publishing to a status page. In agency mode you also choose which clients the assistant may see.
- **What the token can do, and where.** The access tokens upfour issues (`up4at_…`) work on `/mcp` only, not on the REST API. An access token lasts one hour. The client renews it with a refresh token (`up4rt_…`) that is replaced each time it is used and lasts 30 days. For 30 seconds after its first use a refresh token still works, so several processes of the same assistant can renew at the same moment. Presented again after that, upfour ends the whole connection.
- **Revoke.** Every sign-in is listed under **Settings → Connected AI assistants** with the assistant, the access you granted and when it was last used. Remove one and the assistant loses access with its next request.
- **Company switch.** Owners and admins can turn AI assistant access off for the whole Company on the same page. That blocks every connection and every API key on `/mcp` until it is turned on again. The REST API stays on.

For clients and developers who build their own: the server publishes discovery metadata at `/.well-known/oauth-protected-resource/mcp` and `/.well-known/oauth-authorization-server`, and a server card at `/mcp/server-card`. The flow is the authorization code grant with PKCE (S256, required) and the resource `https://app.upfour.io/mcp`. The scopes are `mcp:read` and `mcp:write`. Redirect URIs must match exactly; a loopback address may use any port. Tokens come from `POST /oauth/token` (`authorization_code` and `refresh_token`) and are revoked with `POST /oauth/revoke`. A client identifies itself with an https URL that serves a Client ID Metadata Document, or is registered by upfour. There is no dynamic client registration.

## Or use an API key

For clients without sign-in, such as Cursor, VS Code, Gemini CLI and Zed, use a key. In the app under **Settings → API tokens**, create a key for the assistant. Give it only what the work needs; [API keys and scopes](https://upfour.io/docs/api/keys-and-scopes.md) explains every scope.

- **Questions only:** a read-only key. The assistant can look at everything the key may see and change nothing.
- **Workflows:** add `monitor.write` to run a check or create monitors, `heartbeat.write` for scheduled jobs, `incident.insight.write` to let it add an assessment to an incident, and `status_page.draft.write` to prepare a status update as a draft.
- **Leave out** `monitor.delete` and `status_page.write`. An assistant that can delete monitors or publish to the public can do damage with one wrong guess, and the MCP server has no tool for either. A key without these scopes makes the limit visible in the key itself.
- In agency mode, limit the key to the clients the assistant should see; upfour enforces that for every tool.

Keep the key out of chats and files you commit: the setups below read it from an environment variable or ask for it.

```bash
export UP4_API_KEY=pls_...
```

### Connect the server with the key

The server is at `https://app.upfour.io/mcp`. It speaks Streamable HTTP and accepts the key as `Authorization: Bearer <key>`. Pick your client. Claude Code can also sign in instead: `claude mcp add --transport http up4 https://app.upfour.io/mcp`, then `/mcp` in a session.

### Claude Code

```
claude mcp add --transport http up4 https://app.upfour.io/mcp \
  --header "Authorization: Bearer $UP4_API_KEY"
```

### Cursor

[Add upfour to Cursor](cursor://anysphere.cursor-deeplink/mcp/install?name=up4&config=eyJ1cmwiOiJodHRwczovL2FwcC51cGZvdXIuaW8vbWNwIiwiaGVhZGVycyI6eyJBdXRob3JpemF0aW9uIjoiQmVhcmVyICR7ZW52OlVQNF9BUElfS0VZfSJ9fQ==) installs the server and reads the key from `UP4_API_KEY` in the environment Cursor starts in. Or add it to `~/.cursor/mcp.json` yourself:

```json
{
  "mcpServers": {
    "up4": {
      "url": "https://app.upfour.io/mcp",
      "headers": {
        "Authorization": "Bearer ${env:UP4_API_KEY}"
      }
    }
  }
}
```

### VS Code

Add it to `.vscode/mcp.json` (workspace) or your user `mcp.json`. VS Code asks for the key when the server starts and stores it for you:

```json
{
  "inputs": [
    {
      "type": "promptString",
      "id": "up4-api-key",
      "description": "upfour API key (pls_...)",
      "password": true
    }
  ],
  "servers": {
    "up4": {
      "type": "http",
      "url": "https://app.upfour.io/mcp",
      "headers": {
        "Authorization": "Bearer ${input:up4-api-key}"
      }
    }
  }
}
```

### Codex

In `~/.codex/config.toml`:

```
[mcp_servers.up4]
url = "https://app.upfour.io/mcp"
bearer_token_env_var = "UP4_API_KEY"
```

Codex can also sign in instead: leave out `bearer_token_env_var` and run `codex mcp login up4`.

### Gemini CLI

In your user settings `~/.gemini/settings.json`, not in a project file. The key is stored in that file, so keep it out of version control.

```json
{
  "mcpServers": {
    "up4": {
      "httpUrl": "https://app.upfour.io/mcp",
      "headers": {
        "Authorization": "Bearer pls_..."
      }
    }
  }
}
```

### Zed

In the Zed settings. Zed does not read environment variables here, so the key is stored in the settings file: keep that file out of version control.

```json
{
  "context_servers": {
    "up4": {
      "url": "https://app.upfour.io/mcp",
      "headers": {
        "Authorization": "Bearer pls_..."
      }
    }
  }
}
```

### Other clients

Any client that connects to remote MCP servers over Streamable HTTP and lets you set a request header works the same way: the URL above and the header `Authorization: Bearer <key>`.

### Clients that only speak stdio

[mcp-remote](https://www.npmjs.com/package/mcp-remote) bridges a stdio client to the server. It needs Node.js. In the client's MCP configuration:

```json
{
  "mcpServers": {
    "up4": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://app.upfour.io/mcp",
        "--header",
        "Authorization:${UP4_AUTH}"
      ],
      "env": {
        "UP4_AUTH": "Bearer pls_..."
      }
    }
  }
}
```

## Tools

The list below is generated from the server's own registry, so it is what the server offers. Each tool calls only the public API routes it declares; a key needs the scopes in the table for a tool to work.

| Tool | What it does |
| --- | --- |
| `acknowledge_incident` Writes · Release 1.1 | Marks an open incident as seen, which stops its alert plan. The incident timeline records that the AI assistant did it. An incident that is already acknowledged or resolved is reported as it is.  Scopes: `incident.write` `incident.read` |
| `add_incident_insight` Writes · Release 1 | Records an AI assistant's assessment on an incident's cockpit: a headline, supporting points and the basis (measured versus assumed). It stays inside the team and notifies nobody.  Scopes: `incident.read` `incident.insight.write` |
| `check_now` Writes · Release 1 | Runs one check from every region of a monitor and compares each region with the incident's first failing measurement. Without confirm it only names the regions and the number of billed check executions.  Scopes: `monitor.read` `monitor.write` |
| `create_monitors` Writes · Release 1.1 | Creates the monitors of a preview_monitors preview, exactly as previewed. Takes only the preview_id; a repeat with the same id returns the same monitors and creates nothing new. Usage costs start with the first check.  Scopes: `monitor.write` |
| `draft_status_update` Writes · Release 1 | Saves a draft of a status page post for an incident: state, title, text and optionally components. The status page follows from the incident. The tool saves a draft only and notifies no one; a person reviews and publishes it in upfour. Calling it again for the same incident and page replaces the open draft.  Scopes: `incident.read` `status_page.draft.write` |
| `explain_alerting` Reads · Release 1.1 | Explains for an incident, or for a monitor and a moment, whether the alert was held back below the notice threshold, never confirmed, queued but not delivered, delivered, or had no channel or nobody on call. Joins the measured failures, the threshold, the downtime ledger and the deliveries into a short timeline; names the gap when the history is gone.  Scopes: `incident.read` `report.read` |
| `get_client_report` Reads · Release 1.1 | Collects the figures for a client's monthly report: availability, measured downtime, incidents with the biggest ones, SLA status and data gaps, from the same reports the app shows. The assistant writes the summary text.  Scopes: `report.read` |
| `get_incident` Reads · Release 1 | Shows one incident as the cockpit does: affected monitors with the first failing and last good check per region, observed changes, certificates, timeline, status pages with their published updates, playbook progress and the existing upfour diagnosis.  Scopes: `incident.read` |
| `get_monitor` Reads · Release 1 | Shows one monitor: its configuration without secrets, the latest measurement per region, the certificate, and the open incident if there is one.  Scopes: `monitor.read` |
| `get_monitor_history` Reads · Release 1.1 | Shows a monitor's availability and response time per day for a period (24h to a year, or a from/to window), from the same reports the app shows, and names days without data.  Scopes: `report.read` |
| `get_scheduled_job` Reads · Release 1.1 | Shows one scheduled job: state, expected interval and grace time, the latest check-ins, availability for the periods upfour keeps, and the open incident if it is late or failed.  Scopes: `heartbeat.read` |
| `get_situation` Reads · Release 1 | Summarises what is going on: open incidents, monitors that are down or slow, late scheduled jobs and who is on call, limited to the sections and clients the key may read.  Scopes: any key |
| `list_clients` Reads · Release 1.1 | Lists the clients (agency mode) the key may see, with their ids, monitor counts and open incidents. Offered only while the Company uses clients.  Scopes: `client.read` |
| `list_incidents` Reads · Release 1 | Lists incidents, open ones by default, with what fails, since when, the client and a link into the app; filter by status and time.  Scopes: `incident.read` |
| `list_monitors` Reads · Release 1 | Lists monitors with state, target, interval, regions and the time of the latest check, filtered by state or text, 50 per call by default.  Scopes: `monitor.read` |
| `list_scheduled_jobs` Reads · Release 1.1 | Lists the Company's scheduled jobs (cron jobs and workers that check in to upfour) with their state (on time, late, failed, paused), the last check-in, the expected interval and grace time, and since when an outage lasts.  Scopes: `heartbeat.read` |
| `pause_monitor` Writes · Release 1.1 | Pauses a monitor until it is resumed. A paused monitor runs no checks, raises no alerts and costs nothing. A monitor that is already paused is reported as it is.  Scopes: `monitor.write` `monitor.read` |
| `preview_monitors` Writes · Release 1.1 | Checks monitors to create or change without changing them: duplicates among existing monitors, regions, interval, plan limits, the extra monthly usage in euros per item and in total, and who is alerted when a new monitor fails. Returns a preview_id for create_monitors and update_monitor. Also answers which of a list of domains are already monitored.  Scopes: `monitor.write` |
| `resolve_incident` Writes · Release 1.1 | Marks an incident as resolved by hand. The incident timeline records that the AI assistant did it. An incident that is already resolved is reported as it is; a monitor that is still down opens a new incident at its next confirmed failure.  Scopes: `incident.write` `incident.read` |
| `resume_monitor` Writes · Release 1.1 | Resumes a paused monitor so it checks again at its interval. Each check execution is billed as usual. A monitor that is already running is reported as it is.  Scopes: `monitor.write` `monitor.read` |
| `update_monitor` Writes · Release 1.1 | Applies the interval and region changes of a preview_monitors preview, exactly as previewed. Takes only the preview_id; a repeat with the same id changes nothing further.  Scopes: `monitor.write` |
| `whoami` Reads · Release 1 | Shows the upfour Company this connection belongs to, whether it can read or also write, its scopes, the clients it may see and the tools it can use.  Scopes: any key |

No tool deletes anything, publishes a status update or sends a notification. Writing tools say what they will do in their description, so your client can show it before you confirm.

## Prompts

The server offers these as prompts, so clients that list MCP prompts show them as commands. They work as plain text too: paste one into any chat that has upfour connected.

### What is happening right now?

Situation across monitors, incidents and scheduled jobs, optionally for one client.

```
Use upfour to tell me what is happening right now. Start with get_situation. Name every open incident with the affected client, what is failing, since when and from which regions, then anything degraded or late. If everything is fine, say so in one sentence with the time of the last check.
```

### Check after the deploy

Run an immediate check from every region after a fix or deploy and compare it with the start of the incident.

```
I just deployed <target>. Use upfour to check that it is up: find the monitor with list_monitors, run check_now for it, then read get_monitor and compare the new result per region with the last failing check. If an incident is open for it, add your finding with add_incident_insight and say clearly what is measured and what is your assumption.
```

### Prepare a customer update

Draft a status page update for an open incident; a person reviews and publishes it in upfour.

```
Prepare a status page update for <incident>. Read the incident with get_incident, including the status pages and the updates already published there. Write a short, factual update in the page's language without internal details, then save it with draft_status_update. It stays a draft until someone publishes it in upfour.
```

## The Agent Skill

upfour also ships an Agent Skill. It teaches an assistant two workflows: “Monitor this project” reads a repository, shows the planned monitors and scheduled-job check-ins with their estimated usage and creates them once you agree; “Check after the deploy” runs a check now and records the finding on the open incident. It also answers questions about your account.

### From the server

The server brings the skill along. Claude Code 2.1.331 or later loads it once the server is connected, with nothing to install: added as `up4` like above, `/skills` lists it as `up4:up4` with the source `mcp`. Skills from MCP servers are in beta in Claude Code. This edition works through the server's tools, so it has the access of your connection or key and needs no key of its own. The server offers it to every connection that may use at least one tool. Where Claude Code does not load skills from servers, for example in `claude -p`, use the plugin or the folder below.

For developers of other clients: the server declares the extension `io.modelcontextprotocol/skills` on protocol version 2026-07-28, answers `skills/list` and `skills/get` with a manifest (`sha256` digest and size per file), and serves the files through `resources/read` under `skill://up4/`.

### With a key

The other edition calls the REST API with a key in `UP4_API_KEY`: read only for questions, `monitor.write` and `heartbeat.write` to monitor a project, `monitor.write` and `incident.insight.write` to check after a deploy.

In Claude Code, the plugin installs the skill, this server and the `/up4:status` command in one step. Then sign in to upfour with `/mcp`:

```
/plugin marketplace add upfour-io/ai-assistants
/plugin install up4@up4
```

Other assistants copy the folder `skills/up4` from [github.com/upfour-io/ai-assistants](https://github.com/upfour-io/ai-assistants) to where they read Agent Skills. The server above works without the skill.

## What it costs

The MCP server costs nothing extra, and upfour calls no AI model: the assistant you connect does the thinking, under its own account. Tools that start checks, such as running a check now or creating monitors, state how many executions they will start before they run. Those executions are billed like any other check, see [rate limits](https://upfour.io/docs/api/rate-limits.md) for the request limits and [what costs money](https://upfour.io/docs/how/what-costs-money.md) for the price of a check.

## Security

- **Monitored data is untrusted.** Page titles, error messages, monitor names, certificate subjects and notes can contain text written by someone else, including text that reads like an instruction to the assistant. Tool results name these fields in `untrusted_fields` so the assistant and your client can treat them as data, and tools return short excerpts, never whole pages. No filter catches every attempt: keep write scopes narrow.
- **Confirm each write in your client.** Do not switch on automatic approval for writing tools on a key or a read-and-write connection that can change production monitors.
- **No deleting, no publishing.** There is no delete tool, and status updates are prepared as drafts that a person publishes in the app.
- **Revoke at any time.** Remove a signed-in assistant under **Settings → Connected AI assistants**, or delete a key under **Settings → API tokens**. Either stops with the next request. Owners and admins can also turn assistant access off for the Company there.
- **Where the data goes.** What a tool returns becomes part of the conversation, so it goes to the provider of the assistant you chose, under your agreement with that provider. upfour sends nothing to an AI provider itself. Connect only assistants you are allowed to show this data, and limit the key or the connection to the clients concerned.

## Next

- [Webhook to agent](https://upfour.io/docs/api/recipes/webhook-to-agent.md): let upfour tell your assistant when a monitor fails.
- [For AI assistants](https://upfour.io/docs/api/for-ai-assistants.md): files that let a coding assistant build an integration from the real contract.
