At a glance
- Availability: Experimental (how to enable).
- Auth: API key.
- Connection: The key comes from
FLY_API_TOKEN. - Docs: https://fly.io/docs/machines/api/working-with-machines-api/
Credentials
Set these per environment. See Connect an integration.| Variable | Required | Description |
|---|---|---|
FLY_API_TOKEN | Yes | Fly.io access token (create with ‘fly tokens create org’ or in the dashboard under Tokens) Docs. |
Setup
- Sign up for Fly.io: Go to https://fly.io and create an account (the pay-as-you-go plan with a small test app is sufficient; new accounts include trial credit).
- Create an access token: Run ‘fly tokens create org -o <org-slug>’ with flyctl, or create a token in the dashboard under Account > Access Tokens (https://fly.io/dashboard/personal/tokens). Org tokens are preferred over personal auth tokens.
- Set the environment variable: Add the token to your .env as FLY_API_TOKEN=…
- Verify access: Run List Apps with your org slug (use ‘personal’ for the default personal organization), then List Machines on one of the apps.
- The public Machines API endpoint is https://api.machines.dev; tokens are sent as ‘Authorization: Bearer <token>’
- org_slug is required when listing apps
- Tokens created with ‘fly tokens create’ may include a ‘FlyV1 ’ prefix in CLI output - store only the token value; the API accepts it after Bearer either way
Tools
| Tool | Access | Description |
|---|---|---|
| List Apps | Read | List apps in a Fly.io organization |
| Get App | Read | Get details about an app, including its organization and status |
| List Machines | Read | List Machines of an app with their states |
| Get Machine | Read | Get a Machine by ID, including its config and state |
| Start Machine | Write | Start a stopped Machine |
| Stop Machine | Write | Stop a running Machine |
Example prompts
- List the Machines of my Fly.io app grouped by state and region.
- Find the started Machines of my Fly.io app and stop the one I specify.