How to integrate Fly MCP with Claude Code

Connect Claude Code to Fly MCP. Deploy latest image to fly in tokyo, list all running fly apps by region, and more using natural language, with authentication handled for you.

Fly logoFly
Api Key

Fly.io transforms containers into micro-VMs running globally. Instantly deploy apps close to your users for low latency and high availability.

45 Tools

Introduction

Manage your Fly directly from Claude Code with zero worries about OAuth hassles, API-breaking issues, or reliability and security concerns.

You can do this in two different ways:

  1. Via Composio Connect - Direct and easiest approach
  2. Via Composio SDK - Programmatic approach with more control

For exact tool slugs and parameter tables, see the tool catalog in the Composio docs.

Also integrate Fly with

Why use Composio?

  • Only one MCP URL to connect multiple apps with Claude Code with zero auth hassles.
  • Programmatic tool calling allows LLMs to write its code in a remote workbench to handle complex tool chaining. Reduces to-and-fro with LLMs for frequent tool calling.
  • Handling Large tool responses out of LLM context to minimize context rot.
  • Dynamic just-in-time access to 20,000 tools across 1700+ other Apps for cross-app workflows. It loads the tools you need, so LLMs aren't overwhelmed by tools you don't need.

Connecting Fly to Claude Code using Composio

1. Add the Composio MCP to Claude

Terminal

2. Start Claude Code

bash
claude

3. Open your MCP list

bash
/mcp

4. Select Composio and click on Authenticate

Select Composio and click Authenticate

5. This will redirect you to the Composio OAuth page. Complete the flow by authorizing Composio and you're all set.

Composio OAuth authorization page
Composio authorization complete
Ask Claude to connect to your account and authenticate via the link

What is the Fly MCP server, and what's possible with it?

The Fly MCP server is an implementation of the Model Context Protocol that connects your AI agent and assistants like Claude, Cursor, etc directly to your Fly account. It provides structured and secure access to your Fly applications, machines, organizations, regions, and account details, so your agent can inspect applications, list machines, review organizations, compare regions, and check platform information on your behalf.

  • Application visibility: Have your agent list applications in an organization and retrieve details about a specific Fly application.
  • Machine inventory: Let the agent list machines for an application or across an organization, then retrieve details about a specific machine.
  • Region and placement planning: Direct your agent to review available Fly regions and get placement recommendations for running machines.
  • Organization and account review: Instruct your agent to retrieve details about your personal organization, another organization, or the authenticated Fly account.
  • Platform and access checks: Have your agent check available VM sizes, supported regions, platform information, and details about the current authentication token.

Connecting Fly via Composio SDK

Composio SDK is the underlying technology that powers these integrations. It provides a universal gateway with full programmatic control. You can programmatically generate an MCP URL with the app you need (here Fly) for even more tool search precision. It's secure and reliable.

How the Composio SDK works

The Composio SDK follows a three-phase workflow:

  1. Discovery: Searches for tools matching your task and returns relevant toolkits with their details.
  2. Authentication: Checks for active connections. If missing, creates an auth config and returns a connection URL via Auth Link.
  3. Execution: Executes the action using the authenticated connection.

Step-by-step Guide

Step by step10 STEPS
1

Prerequisites

Before starting, make sure you have:
  • Claude Pro, Max, or API billing enabled Anthropic account
  • Composio API Key
  • A Fly account
  • Basic knowledge of Python or TypeScript
2

Install Claude Code

bash
# macOS, Linux, WSL
curl -fsSL https://claude.ai/install.sh | bash

# Windows PowerShell
irm https://claude.ai/install.ps1 | iex

# Windows CMD
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd

To install Claude Code, use one of the following methods based on your operating system:

3

Set up Claude Code

bash
cd your-project-folder
claude

Open a terminal, go to your project folder, and start Claude Code:

  • Claude Code will open in your terminal
  • Follow the prompts to sign in with your Anthropic account
  • Complete the authentication flow
  • Once authenticated, you can start using Claude Code
Claude Code initial setup showing sign-in prompt
Claude Code terminal after successful login
4

Set up environment variables

bash
COMPOSIO_API_KEY=your_composio_api_key_here
USER_ID=your_user_id_here

Create a .env file in your project root with the following variables:

  • COMPOSIO_API_KEY authenticates with Composio (get it from Composio dashboard)
  • USER_ID identifies the user for session management (use any unique identifier)
5

Install Composio library

npm install @composio/core dotenv

Install the Composio TypeScript library to create MCP sessions.

  • @composio/core provides the core Composio functionality
  • dotenv loads environment variables from your .env file
6

Generate Composio MCP URL

import 'dotenv/config';
import { Composio } from '@composio/core';

const { COMPOSIO_API_KEY, USER_ID } = process.env;

if (!COMPOSIO_API_KEY || !USER_ID) {
  throw new Error('COMPOSIO_API_KEY and USER_ID required in .env');
}

const composioClient = new Composio({ apiKey: COMPOSIO_API_KEY });

const composioSession = await composioClient.create(USER_ID, {
  toolkits: ['fly'],
});

const composioMcpUrl = composioSession?.mcp.url;

console.log(`MCP URL: ${composioMcpUrl}`);
console.log(`\nUse this command to add to Claude Code:`);
console.log(`claude mcp add --transport http fly-composio "${composioMcpUrl}" --headers "X-API-Key:${COMPOSIO_API_KEY}"`);

Create a script to generate a Composio MCP URL for Fly. This URL will be used to connect Claude Code to Fly.

What's happening

  • We import the Composio client and load environment variables
  • Create a Composio instance with your API key
  • Call create() to create a Tool Router session for Fly
  • The returned mcp.url is the MCP server URL that Claude Code will use
  • The script prints this URL so you can copy it
7

Run the script and copy the MCP URL

node --loader ts-node/esm generate_mcp_url.ts
# or if using tsx
tsx generate_mcp_url.ts

Run your TypeScript script to generate the MCP URL.

  • The script connects to Composio and creates a Tool Router session
  • It prints the MCP URL and the exact command you need to run
  • Copy the entire claude mcp add command from the output
8

Add Fly MCP to Claude Code

bash
claude mcp add --transport http fly-composio "YOUR_MCP_URL_HERE" --headers "X-API-Key:YOUR_COMPOSIO_API_KEY"

# Then restart Claude Code
exit
claude

In your terminal, add the MCP server using the command from the previous step. The command format is:

  • claude mcp add registers a new MCP server with Claude Code
  • --transport http specifies that this is an HTTP-based MCP server
  • The server name (fly-composio) is how you'll reference it
  • The URL points to your Composio Tool Router session
  • --headers includes your Composio API key for authentication

After running the command, close the current Claude Code session and start a new one for the changes to take effect.

9

Verify the installation

bash
claude mcp list

Check that your Fly MCP server is properly configured.

  • This command lists all MCP servers registered with Claude Code
  • You should see your fly-composio entry in the list
  • This confirms that Claude Code can now access Fly tools

If everything is wired up, you should see your fly-composio entry listed:

Claude Code MCP list showing the toolkit MCP server
10

Authenticate Fly

The first time you try to use Fly tools, you'll be prompted to authenticate.

  • Claude Code will detect that you need to authenticate with Fly
  • It will show you an authentication link
  • Open the link in your browser (or copy/paste it)
  • Complete the Fly authorization flow
  • Return to the terminal and start using Fly through Claude Code

Once authenticated, you can ask Claude Code to perform Fly operations in natural language. For example:

  • "Deploy latest image to Fly in Tokyo"
  • "List all running Fly apps by region"
  • "Scale up my Fly app to 3 instances"

Complete Code

Here's the complete code to get you started with Fly and Claude Code:

import 'dotenv/config';
import { Composio } from '@composio/core';

const { COMPOSIO_API_KEY, USER_ID } = process.env;

if (!COMPOSIO_API_KEY || !USER_ID) {
  throw new Error('COMPOSIO_API_KEY and USER_ID required in .env');
}

const composioClient = new Composio({ apiKey: COMPOSIO_API_KEY });

const composioSession = await composioClient.create(USER_ID, {
  toolkits: ['fly'],
});

const composioMcpUrl = composioSession?.mcp.url;

console.log(`MCP URL: ${composioMcpUrl}`);
console.log(`\nUse this command to add to Claude Code:`);
console.log(`claude mcp add --transport http fly-composio "${composioMcpUrl}" --headers "X-API-Key:${COMPOSIO_API_KEY}"`);

Conclusion

You've successfully integrated Fly with Claude Code using Composio's MCP server. Now you can interact with Fly directly from your terminal using natural language commands.

Key features of this setup:

  • Terminal-native experience without switching contexts
  • Natural language commands for Fly operations
  • Secure authentication through Composio's managed MCP
  • Tool Router for dynamic tool discovery and execution

Next steps:

  • Try asking Claude Code to perform various Fly operations
  • Add more toolkits to your Tool Router session for multi-app workflows
  • Integrate this setup into your development workflow for increased productivity

You can extend this by adding more toolkits, implementing custom workflows, or building automation scripts that leverage Claude Code's capabilities.

TOOLS

Supported Tools

Every Fly action and event your agent gets out of the box.

Add WireGuard Peer

Tool to add a WireGuard peer connection to a Fly.io organization for private network access.

Check App Name Availability

Tool to validate an app name for Fly.io app creation.

Check Jobs

Execute a caller-supplied GraphQL operation against Fly.io, including checkJobs queries for schedules, URLs, configuration, and pagination.

Check User Only Token

Check whether the authentication token only allows user access.

Create Health Check Job

Tool to create a health check job for monitoring application endpoints in Fly.io.

Create Check Job Run

Triggers a run of an existing health check job on Fly.io.

Create Delegated WireGuard Token

Tool to create a delegated WireGuard token for peer management in a Fly.io organization.

Create Third-Party Configuration

Tool to create a third-party service configuration for discharging macaroon caveats.

Delete Delegated WireGuard Token

Tool to delete a delegated WireGuard token from a Fly.io organization.

Delete Organization

Tool to delete a Fly.io organization and all its associated resources using the GraphQL API.

Delete Remote Builder

Tool to delete a remote builder configuration for a Fly.io organization.

Delete Third Party Configuration

Tool to delete a third-party service configuration from Fly.io.

Detach Postgres Cluster

Tool to detach a Postgres cluster from a Fly.io application, revoking access credentials.

Establish SSH Key

Tool to establish an SSH key for a Fly.io organization.

Fetch Nodes by IDs

Fetches a list of node objects from Fly.io given a list of IDs using the GraphQL nodes query.

Get Add-On

Tool to find a Fly.io add-on by ID, name, or provider.

Get Add-On Provider

Tool to query information about a specific Fly.io add-on provider (extension) by name.

Get app details

Retrieve a Fly.io application's ID, name, and certificate details, including hostname, creation date, and client status.

Get Certificate

Tool to retrieve a certificate by its ID from Fly.io.

Get Current Token Info

Tool to get information about the current authentication token.

Get Latest Image Details

Tool to retrieve the latest available tag details for a given image repository from Fly.io's registry.

Get Latest Image Tag

Tool to retrieve the latest available image tag for a Fly.io Docker repository.

Get Machine

Tool to get a single machine by ID from Fly.io.

Get Nearest Region

Retrieve the Fly.io region returned by the nearestRegion query for the request origin.

Get Node by ID

Tool to fetch an object by its globally unique ID using Fly.io's GraphQL node query.

Get Organization

Tool to find a Fly.io organization by slug using the GraphQL API.

Get Personal Organization

Retrieve the user's Fly.io personal organization details, including credit balance, whether a credit card is saved, and counts of logged certificates and WireGuard peers.

Get Placements

Tool to get placement recommendations for Machines in Fly.io regions.

Get Platform Information

Tool to retrieve Fly.io platform information including available regions, VM sizes, and flyctl version.

Get Products and Pricing

Tool to retrieve Fly.io product and price information via GraphQL.

Get Regions

Tool to get the list of available Fly.io regions with optional filtering.

Get Viewer Info

Retrieve the authenticated Fly.io user's account information, including avatar, email, creation date, and feature flags by default.

Issue Certificate

Tool to issue an SSH certificate for accessing Fly.io infrastructure.

List Add-On Plans

Tool to list available add-on service plans from Fly.io.

List Add-Ons

Query Fly.io add-ons for a personal or specified organization using GraphQL.

List Apps

Tool to list all Fly Apps in an organization.

List Apps via GraphQL

List Fly.io applications via GraphQL, with optional volume, service, and VM details.

Check Locations

Retrieve available Fly.io health check locations, including names and geographic details, for selecting monitoring points.

List Machines

Tool to list Fly.io machines using GraphQL API with pagination support.

List Organization Machines

List Machines across apps in a Fly organization, with pagination and filters for region, state, and machines updated after a specified time.

Remove WireGuard Peer

Tool to remove a WireGuard peer connection from a Fly.io organization.

Set Apps V2 Default

Tool to configure whether new apps in an organization use Apps V2 by default on Fly.io.

Update Third-Party Configuration

Tool to update an existing third-party service configuration for discharging macaroon caveats.

Validate Config

Tool to validate a Fly.io app configuration.

Validate WireGuard Peers

Tool to validate WireGuard peer IP addresses in a Fly.io organization.

FAQ

Frequently asked questions

Start with Fly.It takes 30 seconds.

Managed auth, hosted MCP servers, and every Fly tool your agent needs.Free to start.

Start building