fly-mcp
About
fly-mcp is an open-source MCP (Model Context Protocol) server for managing Fly.io infrastructure. It enables AI-driven DevOps workflows through natural language interactions, providing tools to list, inspect, restart, and scale Fly.io applications.
Explore
- 🔒 Security: All tools require proper authentication and permissions
- 📝 Audit Logging: All operations are logged for compliance and debugging
- ⚡ Real-time: Status and machine information is fetched in real-time
- 🛡️ Safety: Destructive operations require explicit confirmation
- 📊 Rich Output: Human-readable responses with actionable recommendations
- ✅ Project structure and build system
- ✅ Configuration management (local/production environments)
- ✅ HTTP server with middleware (CORS, rate limiting, logging)
- ✅ MCP protocol handler with full request/response handling
- ✅ Structured logging with audit trails and security events
- ✅ Fly.io API integration (hybrid approach: fly-go + Machines API)
- ✅ Authentication & authorization with permissions and audit logging
- ✅ Core MCP tools:
- ping - Test tool for connectivity
- fly_list_apps - List all applications with filtering
- fly_app_info - Get detailed application information
- fly_status - Real-time application and machine status
- fly_restart - Restart applications with confirmation
- fly_scale - Scaling status and recommendations
- ✅ Health checks and metrics endpoints
- ✅ Comprehensive error handling and validation
- ✅ Security features (rate limiting, CORS, audit logging)
- Go 1.21 or later
- Fly.io account and API token
- Git
1. Clone the repository
git clone https://github.com/brannn/fly-mcp.git
cd fly-mcp
2. Set up environment variables
export FLY_MCP_FLY_API_TOKEN="your_fly_api_token_here"
export FLY_MCP_FLY_ORGANIZATION="your_fly_org_here"
3. Build and run
make build
make run
Or for development with hot reload:
make dev
Deploy using Fly.io's MCP infrastructure:
fly mcp launch \
"github.com/brannn/fly-mcp" \
--claude --cursor --zed \
--server fly-infrastructure \
--secret FLY_API_TOKEN=fo1_your_token \
--secret FLY_ORG=your-org-name
| Variable | Description | Required |
|----------|-------------|----------|
| FLY_MCP_FLY_API_TOKEN | Fly.io API token | Yes |
| FLY_MCP_FLY_ORGANIZATION | Fly.io organization name | Yes |
| FLY_MCP_ENVIRONMENT | Environment (local/production) | No |
| FLY_MCP_LOGGING_LEVEL | Log level (debug/info/warn/error) | No |
```bash
ping
Test connectivity and server response
fly_list_apps
List all applications with filtering
fly_app_info
Get detailed application information
fly_status
Real-time application and machine status
fly_restart
Restart applications with confirmation
fly_scale
Scaling status and recommendations
| Tool | Description | Example Usage |
|------|-------------|---------------|
| ping | Test connectivity and server response | {"name": "ping", "arguments": {"message": "Hello!"}} |
| Tool | Description | Example Usage |
|------|-------------|---------------|
| fly_list_apps | List all applications with filtering | {"name": "fly_list_apps", "arguments": {"status_filter": "running"}} |
| fly_app_info | Get detailed application information | {"name": "fly_app_info", "arguments": {"app_name": "my-app"}} |
| fly_status | Real-time application and machine status | {"name": "fly_status", "arguments": {"app_name": "my-app"}} |
| fly_restart | Restart applications with confirmation | {"name": "fly_restart", "arguments": {"app_name": "my-app", "confirm": true}} |
| fly_scale | Scaling status and recommendations | {"name": "fly_scale", "arguments": {"app_name": "my-app", "action": "status"}} |
- 🔒 Security: All tools require proper authentication and permissions
- 📝 Audit Logging: All operations are logged for compliance and debugging
- ⚡ Real-time: Status and machine information is fetched in real-time
- 🛡️ Safety: Destructive operations require explicit confirmation
- 📊 Rich Output: Human-readable responses with actionable recommendations
An open-source MCP (Model Context Protocol) server for Fly.io infrastructure management, enabling AI-driven DevOps workflows through natural language interactions.
🚀 Quick Start
Prerequisites
- Go 1.21 or later
- Fly.io account and API token
- Git
Local Development Setup
1. Clone the repository
git clone https://github.com/brannn/fly-mcp.git
cd fly-mcp
2. Set up environment variables
export FLY_MCP_FLY_API_TOKEN="your_fly_api_token_here"
export FLY_MCP_FLY_ORGANIZATION="your_fly_org_here"
3. Build and run
make build
make run
Or for development with hot reload:
make dev
Production Deployment on Fly.io
Deploy using Fly.io's MCP infrastructure:
fly mcp launch \
"github.com/brannn/fly-mcp" \
--claude --cursor --zed \
--server fly-infrastructure \
--secret FLY_API_TOKEN=fo1_your_token \
--secret FLY_ORG=your-org-name
🏗️ Architecture
Project Structure
fly-mcp/
├── cmd/fly-mcp/ # Main application entry point
├── pkg/
│ ├── mcp/ # MCP protocol implementation
│ ├── fly/ # Fly.io API client (coming soon)
│ ├── auth/ # Authentication (coming soon)
│ ├── tools/ # MCP tool implementations (coming soon)
│ └── config/ # Configuration management
├── internal/
│ ├── server/ # HTTP server implementation
│ ├── security/ # Security utilities (coming soon)
│ └── logger/ # Structured logging
├── config.local.yaml # Local development configuration
├── config.production.yaml # Production configuration
└── Makefile # Build automation
Configuration
The application supports flexible configuration through:
- YAML files: config.local.yaml for development, config.production.yaml for production
- Environment variables: All config values can be overridden with FLY_MCP_ prefixed env vars
- Command line flags: --config and --log-level flags
Environment Variables
| Variable | Description | Required |
|----------|-------------|----------|
| FLY_MCP_FLY_API_TOKEN | Fly.io API token | Yes |
| FLY_MCP_FLY_ORGANIZATION | Fly.io organization name | Yes |
| FLY_MCP_ENVIRONMENT | Environment (local/production) | No |
| FLY_MCP_LOGGING_LEVEL | Log level (debug/info/warn/error) | No |
🛠️ Development
Available Make Targets
make build # Build the binary
make build-all # Build for all platforms
make test # Run tests
make test-coverage # Run tests with coverage
make lint # Run linters
make fmt # Format code
make clean # Clean build artifacts
make dev # Run in development mode
make validate-config # Validate configuration
make docker-build # Build Docker image
make help # Show all available targets
Running Tests
```bash
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.



