# deepak61296/mavlink-mcp architecture

> Architecture diagram of the GitHub repository deepak61296/mavlink-mcp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/deepak61296/mavlink-mcp
- Repository: https://github.com/deepak61296/mavlink-mcp

## Overview

mavlink-mcp exposes drone telemetry, camera imagery, and guarded flight actions as MCP tools for an LLM client. The main workflow is client request → server tool handling → telemetry-confirmed flight operation → live-state result; optional camera capture supports a fly–look–decide loop. The server resolves settings and selects a vehicle backend, while flight logic uses safety limits and shared geographic helpers. The pi extension is an alternate MCP client bridge. Source excerpts are partial, so unshown relationships are omitted.

Main entry points: [`mavlink_mcp/server.py`](https://github.com/deepak61296/mavlink-mcp/blob/main/mavlink_mcp/server.py) (MCP server), [`mavlink_mcp/flight.py`](https://github.com/deepak61296/mavlink-mcp/blob/main/mavlink_mcp/flight.py) (Flight tools), [`mavlink_mcp/backends/ardupilot.py`](https://github.com/deepak61296/mavlink-mcp/blob/main/mavlink_mcp/backends/ardupilot.py) (ArduPilot backend), [`mavlink_mcp/interfaces.py`](https://github.com/deepak61296/mavlink-mcp/blob/main/mavlink_mcp/interfaces.py) (Backend contract)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["MCP entry"]
  node_server["MCP server<br/>[server.py]"]
  node_pi_bridge["pi bridge<br/>[mavlink-mcp.ts]"]
end

subgraph group_flight["Flight operations"]
  node_flight_tools["Flight tools<br/>[flight.py]"]
  node_safety["Safety limits<br/>[safety.py]"]
end

subgraph group_vehicle["Vehicle backends"]
  node_backend_select["Backend selection<br/>[__init__.py]"]
  node_ardupilot["ArduPilot backend<br/>[ardupilot.py]"]
  node_fake["In-memory backend<br/>[fake.py]"]
end

subgraph group_vision["Camera and geography"]
  node_geo["Geographic helpers<br/>[geo.py]"]
  node_camera["Camera capture<br/>[camera.py]"]
end

subgraph group_support["Configuration and contracts"]
  node_settings["Settings resolution<br/>[config.py]"]
  node_contract["Backend contract<br/>[interfaces.py]"]
end

node_agent(("LLM / MCP client"))

node_agent -->|"calls tools"| node_server
node_pi_bridge -->|"spawns over stdio"| node_server
node_server -->|"loads settings"| node_settings
node_server -->|"builds tools"| node_flight_tools
node_server -->|"creates frame source"| node_camera
node_server -->|"selects backend"| node_backend_select
node_server -->|"supports live vehicle"| node_ardupilot
node_server -->|"supports fake mode"| node_fake
node_flight_tools -->|"checks limits"| node_safety
node_flight_tools -->|"uses calculations"| node_geo
node_flight_tools -->|"uses backend types"| node_contract
node_ardupilot -->|"implements contract"| node_contract
node_fake -->|"implements contract"| node_contract
node_ardupilot -->|"uses calculations"| node_geo
node_fake -->|"uses calculations"| node_geo
node_camera -->|"uses result type"| node_contract
node_server -->|"reads telemetry"| node_ardupilot
node_server -->|"captures images"| node_camera

click node_server "https://github.com/deepak61296/mavlink-mcp/blob/main/mavlink_mcp/server.py"
click node_pi_bridge "https://github.com/deepak61296/mavlink-mcp/blob/main/integrations/pi/mavlink-mcp.ts"
click node_settings "https://github.com/deepak61296/mavlink-mcp/blob/main/mavlink_mcp/config.py"
click node_flight_tools "https://github.com/deepak61296/mavlink-mcp/blob/main/mavlink_mcp/flight.py"
click node_safety "https://github.com/deepak61296/mavlink-mcp/blob/main/mavlink_mcp/safety.py"
click node_geo "https://github.com/deepak61296/mavlink-mcp/blob/main/mavlink_mcp/geo.py"
click node_contract "https://github.com/deepak61296/mavlink-mcp/blob/main/mavlink_mcp/interfaces.py"
click node_backend_select "https://github.com/deepak61296/mavlink-mcp/blob/main/mavlink_mcp/backends/__init__.py"
click node_ardupilot "https://github.com/deepak61296/mavlink-mcp/blob/main/mavlink_mcp/backends/ardupilot.py"
click node_fake "https://github.com/deepak61296/mavlink-mcp/blob/main/mavlink_mcp/backends/fake.py"
click node_camera "https://github.com/deepak61296/mavlink-mcp/blob/main/mavlink_mcp/camera.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_server,node_pi_bridge,node_agent toneBlue
class node_flight_tools,node_safety toneAmber
class node_backend_select,node_ardupilot,node_fake toneMint
class node_geo,node_camera toneRose
class node_settings,node_contract toneIndigo
```

## Components

### MCP entry

- [MCP server](https://github.com/deepak61296/mavlink-mcp/blob/main/mavlink_mcp/server.py): `mavlink_mcp/server.py`
- [pi bridge](https://github.com/deepak61296/mavlink-mcp/blob/main/integrations/pi/mavlink-mcp.ts): `integrations/pi/mavlink-mcp.ts`

### Flight operations

- [Flight tools](https://github.com/deepak61296/mavlink-mcp/blob/main/mavlink_mcp/flight.py): `mavlink_mcp/flight.py`
- [Safety limits](https://github.com/deepak61296/mavlink-mcp/blob/main/mavlink_mcp/safety.py): `mavlink_mcp/safety.py`

### Vehicle backends

- [Backend selection](https://github.com/deepak61296/mavlink-mcp/blob/main/mavlink_mcp/backends/__init__.py): `mavlink_mcp/backends/__init__.py`
- [ArduPilot backend](https://github.com/deepak61296/mavlink-mcp/blob/main/mavlink_mcp/backends/ardupilot.py): `mavlink_mcp/backends/ardupilot.py`
- [In-memory backend](https://github.com/deepak61296/mavlink-mcp/blob/main/mavlink_mcp/backends/fake.py): `mavlink_mcp/backends/fake.py`

### Camera and geography

- [Geographic helpers](https://github.com/deepak61296/mavlink-mcp/blob/main/mavlink_mcp/geo.py): `mavlink_mcp/geo.py`
- [Camera capture](https://github.com/deepak61296/mavlink-mcp/blob/main/mavlink_mcp/camera.py): `mavlink_mcp/camera.py`

### Configuration and contracts

- [Settings resolution](https://github.com/deepak61296/mavlink-mcp/blob/main/mavlink_mcp/config.py): `mavlink_mcp/config.py`
- [Backend contract](https://github.com/deepak61296/mavlink-mcp/blob/main/mavlink_mcp/interfaces.py): `mavlink_mcp/interfaces.py`

### Other components

- **LLM / MCP client**

## Connections

- LLM / MCP client → MCP server: calls tools (evidence: `README.md`)
- pi bridge → MCP server: spawns over stdio (evidence: `integrations/pi/mavlink-mcp.ts`)
- MCP server → Settings resolution: loads settings (evidence: `mavlink_mcp/server.py`)
- MCP server → Flight tools: builds tools (evidence: `mavlink_mcp/server.py`)
- MCP server → Camera capture: creates frame source (evidence: `mavlink_mcp/server.py`)
- MCP server → Backend selection: selects backend (evidence: `mavlink_mcp/server.py`)
- MCP server → ArduPilot backend: supports live vehicle (evidence: `README.md`)
- MCP server → In-memory backend: supports fake mode (evidence: `README.md`)
- Flight tools → Safety limits: checks limits (evidence: `mavlink_mcp/flight.py`)
- Flight tools → Geographic helpers: uses calculations (evidence: `mavlink_mcp/flight.py`)
- Flight tools → Backend contract: uses backend types (evidence: `mavlink_mcp/flight.py`)
- ArduPilot backend → Backend contract: implements contract (evidence: `mavlink_mcp/backends/ardupilot.py`)
- In-memory backend → Backend contract: implements contract (evidence: `mavlink_mcp/backends/fake.py`)
- ArduPilot backend → Geographic helpers: uses calculations (evidence: `mavlink_mcp/backends/ardupilot.py`)
- In-memory backend → Geographic helpers: uses calculations (evidence: `mavlink_mcp/backends/fake.py`)
- Camera capture → Backend contract: uses result type (evidence: `mavlink_mcp/camera.py`)
- MCP server → ArduPilot backend: reads telemetry (evidence: `mavlink_mcp/server.py`)
- MCP server → Camera capture: captures images (evidence: `README.md`)
