MCP server for Hamlib rigctl radio control
Project description
Rigctl MCP Server
A Model Context Protocol (MCP) server for controlling Software Defined Radio (SDR) applications via the Hamlib rigctl protocol.
Overview
This MCP server provides AI assistants with the ability to control radio receivers and SDR software like SDR++, GQRX, and other Hamlib-compatible applications. It implements the rigctl network protocol, allowing frequency tuning, mode selection, and recording control.
Features
- Frequency Control: Set and query radio frequency in Hz
- Mode Control: Select demodulation mode (FM, WFM, AM, USB, LSB, CW, DSB, RAW)
- Recording Control: Start/stop audio recording
- Quick FM Tuning: Convenience tool for tuning FM broadcast stations (88-108 MHz)
- Timed Recording: Record audio for a specified duration with automatic start/stop
Supported Applications
Any application that supports the Hamlib rigctl network protocol:
- SDR++ - Popular cross-platform SDR application
- GQRX - Linux SDR receiver
- CubicSDR - Cross-platform SDR application
- rigctld - Hamlib network daemon for hardware radios
Installation
Using uvx (recommended)
uvx rigctl-mcp
Using pip
pip install rigctl-mcp
From source (development)
git clone https://github.com/Zappatta/rigctlmcp.git
cd rigctlmcp
pip install -e .
Setup
SDR++ Configuration
- Open SDR++
- Enable the Rigctl Server module in Module Manager
- Configure rigctl settings:
- Port: 4532 (default Hamlib port)
- Bind Address:
0.0.0.0if using from Docker127.0.0.1if running locally
- Connect to your SDR device
Docker Note
If running the MCP server in Docker, the rigctl server must bind to 0.0.0.0 to be accessible from the container. Use host.docker.internal:4532 to connect from inside Docker.
Usage
Running the MCP Server
# Using uvx
uvx rigctl-mcp
# With options
uvx rigctl-mcp --host 192.168.1.50 --port 4532 --auto-connect
# If installed via pip
rigctl-mcp
CLI Options
| Option | Default | Description |
|---|---|---|
--host |
localhost |
Rigctl server host |
--port |
4532 |
Rigctl server port |
--auto-connect |
false |
Automatically connect on startup |
The server communicates over stdio and can be integrated with MCP-compatible clients.
Desktop Client Configuration
Add to your MCP client configuration:
{
"mcpServers": {
"rigctl": {
"command": "uvx",
"args": ["rigctl-mcp", "--auto-connect"]
}
}
}
Available Tools
Connection Management
connect
Connect to a rigctl server.
Parameters:
host(optional): Server address (default: "localhost")port(optional): Server port (default: 4532)
Example:
{
"host": "localhost",
"port": 4532
}
disconnect
Disconnect from the rigctl server.
get_status
Get current connection status.
Frequency Control
set_frequency
Set the radio frequency in Hz.
Parameters:
frequency_hz(required): Frequency in Hz
Example:
{
"frequency_hz": 100000000
}
Sets frequency to 100 MHz.
get_frequency
Get the current radio frequency.
Returns: Frequency in Hz and MHz.
tune_fm_station
Quick tune to an FM broadcast station (88-108 MHz).
Parameters:
frequency_mhz(required): FM frequency in MHz (e.g., 88.5, 101.1)set_wfm_mode(optional): Auto-set WFM mode (default: true)
Example:
{
"frequency_mhz": 88.0,
"set_wfm_mode": true
}
Mode Control
set_mode
Set the demodulation mode and bandwidth.
Parameters:
mode(required): FM, WFM, AM, USB, LSB, CW, DSB, or RAWbandwidth(optional): Bandwidth in Hz (0 for automatic)
Example:
{
"mode": "WFM",
"bandwidth": 200000
}
get_mode
Get the current demodulation mode and bandwidth.
Recording Control
start_recording
Start recording audio. The file is saved to the application's recording directory.
stop_recording
Stop recording audio.
record_audio
Convenience tool that tunes, sets mode, and records for a specified duration.
Parameters:
frequency_hz(required): Frequency in Hzmode(optional): Demodulation modeduration_seconds(required): Recording duration (1-3600 seconds)
Example:
{
"frequency_hz": 88000000,
"mode": "WFM",
"duration_seconds": 30
}
Records 30 seconds of 88 MHz in WFM mode.
Usage Examples
Tune to FM Station
# Connect to rigctl
connect("host.docker.internal", 4532)
# Tune to 88.5 FM
tune_fm_station(88.5)
# Or manually:
set_frequency(88500000)
set_mode("WFM", 200000)
Record Audio
# Quick recording (automatic tuning and timing)
record_audio(
frequency_hz=101100000,
mode="WFM",
duration_seconds=60
)
# Manual recording control
set_frequency(88000000)
set_mode("WFM", 200000)
start_recording()
# ... wait ...
stop_recording()
Query Current Settings
# Get current frequency
get_frequency()
# Returns: "Current frequency: 88000000 Hz (88.000 MHz)"
# Get current mode
get_mode()
# Returns: "Current mode: WFM, bandwidth: 200000 Hz"
Rigctl Protocol
This server implements the Hamlib rigctl network protocol. Key commands:
F <freq>- Set frequency in Hzf- Get frequencyM <mode> <bw>- Set mode and bandwidthm- Get modeAOS/\recorder_start- Start recordingLOS/\recorder_stop- Stop recording
Testing (Development)
Test scripts are included for development:
# Clone and install for development
git clone https://github.com/Zappatta/rigctlmcp.git
cd rigctlmcp
pip install -e .
# Test connection and basic commands
python scripts/tests/test_rigctl.py
# Test FM tuning
python scripts/tests/test_fm.py
# Test recording
python scripts/tests/test_recording.py
Troubleshooting
Connection Refused
Problem: Cannot connect to rigctl server
Solutions:
- Verify SDR++ (or other application) is running
- Check rigctl server module is enabled
- Verify correct port (default: 4532)
- For Docker: ensure bind address is
0.0.0.0 - Try:
ss -tln | grep 4532to check if port is listening
Commands Not Working
Problem: Commands return errors or don't work
Solutions:
- Check application logs for errors
- Verify SDR is connected and working in the application
- Some commands may not be supported by all applications
- Try the command manually using
telnet localhost 4532
Recording Directory
Audio recordings are saved to the application's configured recording directory:
- SDR++: Check Settings → Recording
- GQRX: Check File → Save options
- Default locations vary by platform
Technical Details
Protocol
Uses Hamlib rigctl protocol over TCP socket. Commands are ASCII text, responses are newline-terminated.
Threading
Socket operations are synchronous but the MCP server runs in an async context. Long-running operations (like timed recordings) use asyncio.sleep().
Error Handling
- Connection errors return user-friendly messages
- Invalid frequencies/modes are validated by the radio application
- Recording errors are reported but don't disconnect the client
References
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rigctl_mcp-1.1.0.tar.gz.
File metadata
- Download URL: rigctl_mcp-1.1.0.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
297baa65a8780b7dde8f9d42efe1b9b0d30b785425dd02d15afe6ab0ad771336
|
|
| MD5 |
e23b5cf08f7961d23e263b12be73deaf
|
|
| BLAKE2b-256 |
d2673e0cf69c6b8e12a699bccaf22115dd63e1104e5ccf298bf8dc04bd39b7b8
|
File details
Details for the file rigctl_mcp-1.1.0-py3-none-any.whl.
File metadata
- Download URL: rigctl_mcp-1.1.0-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34d76cf06494bedfacc86f5483202388227a8a316918d3207645a598331a561f
|
|
| MD5 |
567bf1d91e581d0aef2e26b6fa5ea228
|
|
| BLAKE2b-256 |
602f430877ffc3f6f761704822543123b87eca7bd809d723f5614878b3bbeb30
|