Labsco
flightctl logo

Flight Control MCP

from flightctl

A read-only API for querying and retrieving contextual information about devices and fleets using the Flight Control MCP server.

πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedFreeNeeds API keys

mcp-server

Model Context Protocol (MCP) server for Flight Control


Overview

The MCP server provides a read-only API layer for querying and retrieving contextual information about devices and fleets managed by Flight Control. It is designed for safe external integration, reporting, and automation, exposing a REST API that supports filtering and selector-based queries. The MCP server leverages the flightctl-python-client for backend communication and enforces authentication compatible with Flight Control's authorization model.


Building locally

To build the container image locally using Podman, run:

podman build -t mcp-server:latest .

This will create a local image named mcp-server:latest that you can use to run the server.


Pre-built Container Images

βœ… Ready-to-use images are automatically published to quay.io!

# Pull the latest stable image
docker pull quay.io/flightctl/flightctl-mcp:latest

# Run immediately with streamable-http transport
docker run -p 8000:8000 quay.io/flightctl/flightctl-mcp:latest

Automated Publishing

  • πŸ”„ Automatic builds: Every commit merged to main triggers a new build
  • βœ… Quality assured: Only builds after passing all tests (linting, type checking, unit tests)
  • πŸ”’ Security scanned: All images are scanned for vulnerabilities with Trivy
  • πŸ—οΈ Multi-platform: Available for both linux/amd64 and linux/arm64
  • 🏷️ Smart tagging: Images tagged with latest, branch name, and commit SHA

For maintainers: See CONTAINER-PUBLISHING.md for setup instructions and workflow details.


API Endpoints

The MCP server exposes the following tool endpoints:

Device Management

  • query_devices: Query and filter devices using label and field selectors
  • run_command_on_device: Execute Linux commands on specific devices

Fleet Management

  • query_fleets: Query and filter fleet configurations

Events and Monitoring

  • query_events: Query system events and audit logs

Enrollment

  • query_enrollment_requests: Query device enrollment requests

Configuration Management

  • query_repositories: Query configuration repositories
  • query_resource_syncs: Query resource synchronization status

Testing

Live Instance Testing

To test against your actual Flight Control instance:

# Ensure you have logged in first
flightctl login

# Run the live integration test
python test_live_instance.py

Unit Testing

# Run unit tests
python -m pytest test_flightctl_mcp.py -v

# Run with coverage
python -m pytest test_flightctl_mcp.py --cov=resource_queries --cov=main --cov=cli --cov-report=html

MCP Client Testing

# Test the MCP server with a simple client
python -c "
from fastmcp import Client
import asyncio

async def test():
    client = Client('http://127.0.0.1:8000/mcp')
    async with client:
        tools = await client.list_tools()
        print(f'Available tools: {[t.name for t in tools]}')

asyncio.run(test())
"

Migration from STDIO

If you're migrating from the previous stdio-only version:

  1. Update your client configuration to use HTTP endpoints instead of stdio
  2. Set environment variables for host/port configuration if needed
  3. Update firewall rules if running on a remote server
  4. Test the connection using the provided client examples

The server will still support stdio transport if you set MCP_TRANSPORT=stdio, maintaining backward compatibility.


Features

  • Read-only querying of devices, fleets, events, enrollment requests, repositories, and resource syncs from Flight Control
  • Support for filtering by labels and fields using Kubernetes-style selectors
  • Context-rich JSON responses including metadata and links to related resources
  • Secure OIDC/OAuth2 refresh token–based authentication
  • Remote device console access for executing commands on managed devices
  • Automatic pagination handling for large result sets

Documentation

API endpoints, filtering options, and example requests will be described in the docs/ directory or in the OpenAPI specification.