# AI assistants (MCP)

HostEdge speaks the [Model Context Protocol](https://modelcontextprotocol.io), so the assistant you already code with can ship what it writes. Ask it to "put this landing page live" and it deploys, waits for the build and hands you the URL.

## Connect in one minute

Most assistants connect with only the address: add `https://hostedge.app/api/mcp` as a remote MCP server (for Claude Code, `claude mcp add --transport http hostedge https://hostedge.app/api/mcp`). The assistant opens a HostEdge page where you sign in, pick the workspace it may use and press **Allow access**. It then renews its access on its own; the connection appears in **Settings › API tokens** under the assistant’s name followed by “(MCP)”, where you can revoke it.

### ChatGPT

ChatGPT connects to remote MCP servers as a custom connector. This needs Developer mode, which OpenAI offers on some paid plans and may rename or move, so check [OpenAI's help](https://help.openai.com) if a menu below looks different.

1. In ChatGPT open **Settings** and find **Apps** (earlier called **Connectors**). Under **Advanced settings**, turn on **Developer mode**.
2. Choose **Create** and enter the name `HostEdge` and the server address `https://hostedge.app/api/mcp`.
3. Set authentication to **OAuth** and save. ChatGPT opens the HostEdge page where you sign in, pick the workspace it may use and press **Allow access**.
4. In a new chat, add the HostEdge connector from the tools menu and ask: "Deploy this and check the logs."

Custom connectors are unverified by OpenAI, and ChatGPT asks before it runs a tool that changes something. Revoke the connection any time in **Settings › API tokens**.

### With an API token

For clients without OAuth support, or for scripts:

1. Open **Workspace › Settings › API tokens** and press **Create a token for AI assistants**. The token is shown once.
2. Copy the snippet for your assistant from the same panel.

For Claude Code:

```bash
claude mcp add --transport http hostedge https://hostedge.app/api/mcp \
  --header "Authorization: Bearer hostedge_…"
```

For Cursor, Windsurf and other clients, add this to `mcp.json`:

```json
{
  "mcpServers": {
    "hostedge": {
      "url": "https://hostedge.app/api/mcp",
      "headers": { "Authorization": "Bearer hostedge_…" }
    }
  }
}
```

The endpoint uses the Streamable HTTP transport and needs no local install.

## Teach it how HostEdge works

Connecting gives the assistant the tools; the [Agent kit](https://hostedge.app/docs/agent-kit) gives it the know-how. Run `npx hostedge init --ai` in your project (or copy the files from the same settings panel) to add `AGENTS.md`, `CLAUDE.md`, a Cursor rule and a Claude Code skill that explain frameworks, bindings, environment variables, deploying, logs and rollbacks.

## What the assistant can do

| Tool                            | What it does                                              |
| ------------------------------- | --------------------------------------------------------- |
| `list_projects`                 | Projects with their URL and whether they are live         |
| `deploy_files`                  | Deploys files it wrote; creates the project if needed     |
| `deploy_github_repo`            | Deploys a public GitHub repository into a new project     |
| `get_deployment`                | Status, URL and the last build log lines                  |
| `list_deployments`, `rollback`  | History, and instant rollback to an earlier deploy        |
| `get_logs`, `list_errors`       | Runtime logs and grouped errors, for debugging            |
| `set_env_vars`, `list_env_vars` | Write variables; values are never read back               |
| `create_database`, `run_sql`    | A SQLite database for the project, and queries against it |
| `get_analytics`                 | Visitors, top pages and sources                           |

## What it cannot do

The AI token only carries the scopes listed in the panel: it can read and deploy projects, logs, analytics, variables and storage. It cannot read form submissions, delete projects, change members, domains or billing. Every call is limited to the token's workspace and rate limited like the API. Revoke the token at any time and the assistant loses access immediately.

## Docs for assistants

Everything here is public and needs no token. An assistant that can fetch URLs can learn HostEdge without scraping HTML:

| URL                                                                      | What you get                                                                      |
| ------------------------------------------------------------------------ | --------------------------------------------------------------------------------- |
| [`/llms.txt`](https://hostedge.app/llms.txt)                                                 | A map of HostEdge: every docs page, the MCP endpoint, the API and the files below |
| [`/llms-full.txt`](https://hostedge.app/llms-full.txt)                                       | Every docs page as one Markdown file, in docs order, each with its URL            |
| `/docs/<page>.md`, for example [`/docs/domains.md`](https://hostedge.app/docs/domains.md)    | One docs page as clean Markdown (`text/markdown`), links already absolute         |
| [`/docs.md`](https://hostedge.app/docs.md)                                                   | The docs index as Markdown                                                        |
| [`/api/docs/search?q=custom+domains`](https://hostedge.app/api/docs/search?q=custom+domains) | Search results as JSON, each with the page, section, snippet and its Markdown URL |
| [`/api/v1/openapi.json`](https://hostedge.app/api/v1/openapi.json)                           | The OpenAPI 3.1 description of the REST API (and of the two JSON endpoints here)  |
| [`/api/status.json`](https://hostedge.app/api/status.json)                                   | Platform status as JSON: overall state and each component's state and last check  |

### How an assistant should use them

1. To answer a question about HostEdge, call the search endpoint first, then fetch the `markdownUrl` of the best result. Fetching a page is cheaper and cleaner than parsing its HTML.
2. To read everything at once, fetch `/llms-full.txt`. It is a few tens of thousands of tokens, so prefer a single page when you know which one you need.
3. Every docs page also advertises its Markdown twin in a `link rel="alternate" type="text/markdown"` tag, and the page footer links to it.
4. To act (deploy, read logs, set variables), use the [MCP server](https://hostedge.app/docs/ai-assistants#connect-in-one-minute) or the [API](https://hostedge.app/docs/api), not the docs.
5. Before blaming HostEdge for a failed call, read `/api/status.json`. It answers 200 with `"status": "operational"`, `"degraded"` or `"down"`; each entry in `components` has its own `status` and `updatedAt`.

### Search

```bash
curl "https://hostedge.app/api/docs/search?q=custom+domains&limit=3"
```

The response is `{ "results": [...] }`, best match first. Each result has `title`, `url` (the HTML page, with a `#section` anchor), `markdownUrl`, `section`, `snippet` and `score`. `q` takes 2 to 200 characters and `limit` 1 to 20 (default 5). Matching ignores case and accents, and words in a page title or heading count more than words in the text. The endpoint allows cross-origin `GET` requests and is limited per IP address: a `429` carries a `Retry-After` header.

### Status

```bash
curl https://hostedge.app/api/status.json
```

```json
{
  "status": "operational",
  "updatedAt": "2026-01-01T12:00:00.000Z",
  "components": [
    {
      "id": "routing",
      "name": "Sites (edge routing)",
      "status": "operational",
      "detail": "Requests are being routed.",
      "updatedAt": "2026-01-01T12:00:00.000Z",
      "uptime90d": 0.9998
    }
  ]
}
```

It shows what the [status page](https://hostedge.app/status) shows and is cached for 30 seconds. A component's `status` is `operational`, `degraded`, `paused` or `down`; `uptime90d` is the share of healthy checks over 90 days, or `null` for components without history. For a plain up or down check, use [`/api/health`](https://hostedge.app/api/health), which answers 503 when a dependency is down.
