Skip to main content
Glama
README.md
# at-mcp

A **native** Python [MCP](https://modelcontextprotocol.io) server for talking
to cellular modems and radio modules via **AT commands** over a serial port
(pyserial). It lets LLM agents enumerate serial ports and run read-only
diagnostics: modem identity, IMEI, signal quality, network registration.

AT commands are publicly standardized in **3GPP TS 27.007** (plus TS 27.005
for SMS), so this project contains no proprietary or GPL code. It is the
serial-port sibling of `sahara-mcp` and follows the same design.

> **ALPHA — NOT TESTED.** This server is **not** tested against real modems.
> The result-code decoders follow the 3GPP spec but have not been validated on
> hardware. Use at your own risk, treat output sceptically, and start with a
> USB dongle you don't mind restarting.

## Features

- `at_list_ports` — enumerate serial COM/ACM ports visible to pyserial
- `at_command` — send any AT command, return raw result lines (guarded to
  `AT` / `AT+` prefixes)
- `at_info` — `ATI` (manufacturer/model/rev) + `AT+CGMR`
- `at_identity` — `AT+CGSN` (IMEI), `AT+CGMI`, `AT+CGMM`
- `at_signal` — `AT+CSQ` (RSSI/BER) decoded; merges `AT+CESQ` if supported
- `at_network` — `AT+COPS?` operator + `AT+CREG?`/`AT+CGREG?` registration
  state (home/roam/searching/denied/unknown/not registered)
- `at_power` — `AT+CFUN=0` / `AT+CFUN=1` to toggle the radio (opt-in; this is
  the only tool that changes device state)

## Finding the modem's COM port

**Windows Device Manager:**

1. Press <kbd>Win</kbd>+<kbd>X</kbd> → **Device Manager**.
2. Expand **Ports (COM & LPT)** — the modem usually appears as
   "USB-SERIAL CH340 (COM3)", "USB-SERIAL CP210x (COM5)", "Standard Serial
   over Bluetooth link (COM7)", or the modem vendor's own name.
3. The COM number in parentheses is the `port` argument (e.g. `COM3`).

**USB dongles / radio modules** (SIM7000/SIM7600, Quectel EC25/BG96, Sierra,
u-blox, etc.): plug the module in, note the new port that appears under
**Ports (COM & LPT)**, and set a matching baud rate (115200 is the typical
factory default). If no port appears, you may need the vendor USB driver or a
USB‑to‑TTL adapter for bare radio modules.

## Install

```bash
pip install -e .
```

This pulls in `mcp` and `pyserial`.

## Usage

Start the MCP server and point an MCP client (e.g. opencode, Claude Desktop)
at it:

```bash
python -m at_mcp_server          # stdio transport
```

Example tool calls:

```
at_list_ports()
at_info(port="COM3")
at_identity(port="COM3")
at_signal(port="COM3")
at_network(port="COM3")
at_power(port="COM3", state="off")   # drops calls/data!
at_power(port="COM3", state="on")
```

## Reference

- [3GPP TS 27.007](https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=1515) — AT command set for User Equipment (RTTI / `AT+CSQ`, `AT+COPS?`, `AT+CREG?`, `AT+CGSN`, `AT+CFUN`, …)
- [3GPP TS 27.005](https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=1516) — SMS AT commands

## License

[GPL-3.0](LICENSE). Copyright (c) 2026 libertyrights. All code here is
original; AT command semantics come from the public 3GPP specifications.