Bluetooth MCP Server for Discovery, Pairing, Audio Control
Control Bluetooth devices with an MCP server via natural language for discovery, pairing, and audio control.
npx -y @Hypijump31/bluetooth-mcp-serverOverview
This Bluetooth MCP (Model Context Protocol) Server provides a programmatic bridge between natural-language agents (LLMs) and Bluetooth-capable devices. It exposes a small set of HTTP endpoints that implement discovery, pairing, and audio control workflows so a model or application can request Bluetooth operations using plain text instructions. The server is useful for building voice assistants, robotics controllers, or desktop automations that need to find and manage Bluetooth peripherals without embedding low-level Bluetooth logic in the agent itself.
The server is designed to be run close to the Bluetooth adapter (for example on a Linux machine with BlueZ or on a Raspberry Pi). It can be integrated as an MCP tool in an LLM orchestration environment, or used directly via REST calls. Because Bluetooth operations require platform-specific permissions and adapters, this server centralizes the platform interactions and exposes a stable, model-friendly API.
Features
- Discover nearby Bluetooth devices (scan, RSSI, device type)
- Initiate and complete pairing/bonding flows
- Control audio routing (connect/disconnect A2DP/HFP devices, mute/unmute)
- Natural-language-friendly endpoints for MCP-style usage
- Simple REST API suitable for LLM tool wrappers or direct usage
- Configurable adapter and authentication options
- Optional Docker support for easy deployment
Installation / Configuration
Prerequisites:
- A machine with a Bluetooth adapter (Linux/BlueZ recommended)
- Python 3.9+ and pip, or Docker
Clone the repository:
Install with pip:
Run with Docker:
Environment variables (common):
# HTTP port to listen on
MCP_PORT=8080
# Bluetooth adapter to use, e.g. "hci0"
BLUETOOTH_ADAPTER=hci0
# Simple bearer token for API calls
AUTH_TOKEN=changeme
# Optional: enable debug logs
LOG_LEVEL=debug
Permissions:
- On Linux you may need to run under a user in the bluetooth group or use sudo for adapter control.
- BlueZ daemon must be running (systemd service: bluetooth).
Available Resources
API endpoints (HTTP) — summary table:
| Endpoint | Method | Description |
|---|---|---|
| /discover | POST | Start a scan, return discovered devices and metadata |
| /pair | POST | Begin and complete pairing with a specified device |
| /connect | POST | Connect to a paired device (audio or profile) |
| /disconnect | POST | Disconnect an active device |
| /audio/control | POST | Control audio actions: set output, mute, unmute, volume |
| /status | GET | Retrieve current adapter and device status |
Example: start discovery (curl)
Example: pair with device
MCP integration note: When used as a tool for an LLM, wrap the above endpoints in the tool definition so the model can call them as part of a conversation. The server returns structured JSON responses suitable for model consumption.
Use Cases
- Smart home assistant: “Find nearby Bluetooth speakers and pair the living room speaker, then set it as the default audio output.” The model can call /discover, choose the correct device from results, call /pair, and then /audio/control to route audio.
- Conference room setup: Automate connecting a presenter’s headset to the room audio system via a short natural-language command issued by a management UI.
- Robotics: A robot can be instructed to “connect to the operator’s controller” where the server handles scanning and pairing while the robot focuses on higher-level tasks.
- Testing automation: CI systems can run device discovery and exercise pairing flows to validate Bluetooth device firmware, using the API programmatically.
Security & Troubleshooting
- Authentication: Use a strong AUTH_TOKEN or integrate with a reverse proxy and OAuth for production.
- Adapter issues: Ensure the adapter name (BLUETOOTH_ADAPTER) matches the host system (hci0 is common). Verify with
hciconfigorbluetoothctl show. - Permissions: If pairing fails, run the server with elevated privileges or set correct group permissions for Bluetooth device nodes.
- Logs: Increase LOG_LEVEL to debug to capture interaction details when diagnosing pairing failures or profile connection errors.
Additional Resources
- Repository: https://github.com/Hypijump31/bluetooth-mcp-server
- System tools to know: bluetoothctl, hciconfig, BlueZ documentation
- Recommended: Run the server on the same network segment and physical host as the Bluetooth adapter for reliable results.