Betaflight MCP

Betaflight MCP

Enables AI assistants to control Betaflight flight controllers over serial via MSP and CLI, providing real-time sensor reads, full CLI access, and auto-generated variable tools for configuration and tuning.

Category
访问服务器

README

Betaflight MCP

An MCP (Model Context Protocol) server that exposes Betaflight flight controller control to AI assistants such as Claude. It communicates with the FC over a serial connection using the MSP binary protocol and the Betaflight CLI text interface. Use it at your own risk — it can send any command the CLI allows, including ones that may cause crashes, flyaways, or other unsafe conditions if misused. Always review tool actions before approving them in Claude.

Compatibility

  • Betaflight firmware v2025.12 or later

Features

  • Real-time sensor reads — attitude, IMU, GPS, RC channels, motors, battery
  • Full CLI access — feature flags, variable get/set, dump/diff, save, defaults
  • Auto-generated variable tools: ~375 CLI-configurable variables each exposed as a get_<name> / set_<name> tool pair, derived from the Betaflight firmware source
  • Expert PID tuning skill — automatically activates in Claude Code when tuning topics come up

Claude Code Plugin

This repo ships a Claude Code plugin in the plugin/ directory, which bundles:

  • The PID tuning skill — activates automatically when you mention Betaflight, PID tuning, filter tuning, propwash, oscillations, etc.
  • The MCP server config — connects Claude Code to the betaflight-mcp server

Install the plugin

1. Build the server (required before first use):

pnpm install
pnpm build

2. Add the local marketplace:

claude plugin marketplace add /path/to/betaflight-mcp
claude plugin install betaflight-mcp@betaflight-mcp

Replace /path/to/betaflight-mcp with the absolute path to your cloned repository (the repo root, not the plugin/ subdirectory).

3. Configure the server path and whitelist read tools — run the setup script:

pnpm run setup
pnpm whitelist-reads

This replaces the placeholder in the cached plugin's .mcp.json with the absolute path to dist/server.js on your machine. The repo's plugin/.mcp.json is left untouched so the placeholder stays clean for git. Restart Claude Code afterwards. The whitelist script adds all read-only MCP tools to the allowed tools list of Claude, so you don't have to manually approve them all the time. Write access tools are never whitelisted by default for safety.

Updating the plugin

After pulling new changes from the repo, rebuild and reinstall the plugin:

pnpm build
claude plugin uninstall betaflight-mcp@betaflight-mcp
claude plugin install betaflight-mcp@betaflight-mcp

Then re-run the setup and whitelist scripts:

pnpm run setup
pnpm whitelist-reads

Claude Desktop users: The plugin system is a Claude Code (CLI) feature and is not available in Claude Desktop. Claude Desktop users configure the MCP server manually via claude_desktop_config.json (see platform-specific setup below) — this gives full access to all ~1500 tools. The PID tuning skill does not auto-activate in Claude Desktop; as a workaround, create a Claude Project and attach plugin/skills/betaflight-pid-tuning/SKILL.md as project knowledge so it is always in context.

CLI commands and variables as MCP tools

Relevant CLI-configurable variables are exposed as individual get_<name> / set_<name> tool pairs, auto-generated from the Betaflight firmware source (settings.c, ~375 variables), enriched with descriptions from the CLI reference docs.

Run pnpm generate to regenerate src/generated/variables.ts after a Betaflight release.

Development

pnpm generate      # Re-fetch firmware sources + Cli.md, regenerate src/generated/variables.ts
pnpm dev           # Run directly via tsx (no build step)
pnpm build         # pnpm generate (prebuild) → tsc → dist/
pnpm typecheck     # Type-check without emitting
pnpm lint          # ESLint over src/

Architecture

Claude Desktop
    │  stdio (MCP JSON-RPC)
    ▼
betaflight-mcp
    ├── MSP binary protocol  ←→  FC (real-time sensor reads)
    └── CLI text interface   ←→  FC (configuration, variables)

The server maintains a single serial connection shared between the MSP client and the CLI client, serialised via a FIFO mutex so commands never interleave on the wire.

Using with Claude Desktop

The server communicates over stdio — Claude Desktop spawns it as a subprocess and pipes stdin/stdout for MCP JSON-RPC. There is no HTTP port.

Choose the approach that matches your operating system.

Windows — Native (recommended)

Docker Desktop on Windows uses a WSL2 Linux VM. Passing COM ports into a Linux container requires USBIPD-WIN and is non-trivial. Running the server natively with Node.js is the simpler path on Windows.

Prerequisites

1. Install and build

pnpm install
pnpm build

The build command automatically runs pnpm generate to fetch the latest Betaflight firmware sources and generate variable tools.

2. Find your COM port

Open Device ManagerPorts (COM & LPT) and note the port assigned to your flight controller (e.g. COM3).

3. Configure Claude Desktop

Click the Claude menu and select Settings…, then navigate to the Developer tab and click Edit Config.

This opens %APPDATA%\Claude\claude_desktop_config.json. Add the following configuration:

{
  ...,
  "mcpServers": {
    ...,
    "betaflight": {
      "command": "node",
      "args": ["C:\\path\\to\\betaflight-mcp\\dist\\server.js"]
    }
  }
}

Replace C:\\path\\to\\betaflight-mcp with the absolute path to your cloned repository. Use escaped backslashes (\\) or forward slashes (/).

Understanding the Configuration:

  • "betaflight": A friendly name that appears in Claude Desktop
  • "command": "node": Runs the server using Node.js
  • "args": Path to the compiled server JavaScript file

Security Consideration: The server requires access to serial ports to communicate with your flight controller. It runs with your user account permissions. Only connect to flight controllers you trust and always review tool actions before approving them in Claude.

4. Restart Claude Desktop

Completely quit and restart Claude Desktop to load the new configuration.

5. Verify the connection

Upon successful restart, you'll see an MCP server indicator (hammer icon) in the bottom-right corner of the conversation input box. Click it to view available Betaflight tools.

To connect to your flight controller, tell Claude:

Connect to my flight controller on COM3

Claude will use the connect_flight_controller tool with your specified COM port.

Windows — Docker via USBIPD (advanced)

If you prefer Docker on Windows, you'll need to bridge USB devices into WSL2.

Prerequisites

1. Share your USB device with WSL2

In an elevated PowerShell:

# Find your flight controller's BUSID
usbipd list

# Bind and attach the device to WSL2
usbipd bind --busid <BUSID>
usbipd attach --wsl --busid <BUSID>

2. Verify device in WSL2

Open a WSL2 terminal and verify the device appears:

ls /dev/ttyACM*

3. Build the Docker image

From your WSL2 terminal in the project directory:

docker build -t betaflight-mcp .

4. Configure Claude Desktop

Follow the Linux/macOS Docker configuration steps above, using the device path from WSL2 (e.g., /dev/ttyACM0).

Linux / macOS — Docker (recommended)

1. Build the image

docker build -t betaflight-mcp .

The build fetches the latest Betaflight firmware sources and CLI reference from GitHub and compiles TypeScript. An internet connection is required.

2. Find your serial device path

Connect your flight controller via USB, then:

# Linux
ls /dev/tty{USB,ACM}*

# macOS
ls /dev/cu.*

Common values: /dev/ttyUSB0, /dev/ttyACM0 (Linux) · /dev/cu.usbmodem* (macOS).

3. Configure Claude Desktop

Click the Claude menu and select Settings…, then navigate to the Developer tab and click Edit Config.

This opens the configuration file:

Platform Path
macOS ~/Library/Application Support/Claude/claude_desktop_config.json
Linux ~/.config/Claude/claude_desktop_config.json

Add the following configuration, replacing /dev/ttyACM0 with your actual device path:

{
  "mcpServers": {
    ...,
    "betaflight": {
      "command": "docker",
      "args": [
        "run", "--rm", "-i",
        "--device", "/dev/ttyACM0:/dev/ttyACM0",
        "betaflight-mcp"
      ]
    }
  }
}

Understanding the Configuration:

  • "betaflight": A friendly name that appears in Claude Desktop
  • "command": "docker": Runs the server in a Docker container
  • "--rm": Automatically removes the container after exit
  • "-i": Enables interactive mode for stdio communication
  • "--device": Grants the container access to the serial device

Security Consideration: Granting Docker access to a serial device allows the container to communicate with your flight controller. The container runs with limited permissions, but ensure you only connect to flight controllers you trust.

4. Restart Claude Desktop

Completely quit and restart Claude Desktop to load the new configuration.

5. Verify the connection

Upon successful restart, you'll see an MCP server indicator (hammer icon) in the bottom-right corner of the conversation input box. Click it to view available Betaflight tools.

To connect to your flight controller, tell Claude:

Connect to my flight controller on /dev/ttyACM0

Claude will use the connect_flight_controller tool with your specified device path.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选