# Open Fly agent guide

Open Fly can search published flights, list ACMI aircraft, pilot jobs and crew brokers, and read a traveler's saved searches with permission. All agent actions are read-only.

Base URL: https://openfly.fun (production) or https://dev.openfly.fun (development). Resolve relative links against the host serving this document.

## Quick start

Use the deployment's origin as `base`. Send the input object directly as JSON.

```sh
base=https://openfly.fun
curl -fsS "$base/api/v1/agent/actions/search_flights" \
  -H 'Content-Type: application/json' -d '{"origin":"LIS","limit":3}'
```

MCP uses stateless Streamable HTTP with JSON responses. This example uses the initialize handshake. Set `version` to the protocol version returned by initialize.

```sh
curl -fsS "$base/api/v1/mcp" \
  -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"curl","version":"1.0.0"}}}'
version=2025-11-25
curl -fsS "$base/api/v1/mcp" \
  -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' \
  -H "MCP-Protocol-Version: $version" \
  -d '{"jsonrpc":"2.0","method":"notifications/initialized"}'
curl -fsS "$base/api/v1/mcp" \
  -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' \
  -H "MCP-Protocol-Version: $version" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'
curl -fsS "$base/api/v1/mcp" \
  -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' \
  -H "MCP-Protocol-Version: $version" \
  -d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"search_flights","arguments":{"origin":"LIS","limit":3}}}'
```

## Discovery

- [Agent guide](/AGENTS.md)
- [Site overview](/llms.txt)
- [Full action schemas](/llms-full.txt)
- [OpenAPI](/openapi.json)
- [API docs](/api/v1/docs)
- [MCP](/api/v1/mcp)
- [Agent connections](/agents)
- [Action registry](/api/v1/agent/actions)
- [API and database health](/api/v1/health)
- [Release revision](/api/revision)

## Authorization

Public actions work anonymously. For saved searches, sign in at [Agents](/agents). Under **Connections**, name a token, choose the traveler scope and a lifetime of 1 to 365 days (default 90), then create it. Copy the secret when it appears. Pass it as `Authorization: Bearer mcp_…` in REST or MCP requests. Revoke access from the same page.

| Scope | Grants |
| --- | --- |
| `public:read` | Public tools |
| `traveler:read` | List saved searches for the token owner |

An invalid, expired or revoked token returns HTTP 401 `invalid_token`. For a scoped action, missing credentials return REST 401 `auth_required` and a token without the required scope returns REST 403 `insufficient_scope`. MCP returns those two scope errors as tool results with `isError: true`.

## Actions

| Action | Scope | Backing route | Description |
| --- | --- | --- | --- |
| `search_flights` | public | `GET /api/v1/flights` | Search published passenger flights by route, date window and price. |
| `list_acmi_aircraft` | public | `GET /api/v1/acmi/aircraft` | List active ACMI aircraft with pricing terms and maintenance status. |
| `list_jobs` | public | `GET /api/v1/jobs` | List published pilot jobs by keyword, rank and page size. |
| `list_brokers` | public | `GET /api/v1/brokers` | List published crew brokers in the public directory. |
| `list_saved_searches` | traveler:read | `GET /api/v1/saved-searches` | List the signed-in traveler's saved flight searches. |

REST returns each action's result directly. MCP returns the same result as `structuredContent` and JSON text. An empty list is a successful read.

## Limits and verification

REST executions allow 60 requests per minute per IP. MCP allows 120 per minute per IP for anonymous requests, or per token for authenticated requests. Check `ok` in the result and inspect the returned records. Verify the release with `GET /api/revision` and `GET /api/v1/health` on the same host.
