HT802 V2 MCP Server
# HT802 V2 MCP Server
MCP server for managing Grandstream HT802 V2 analog telephone adapters.
## Usage
### With Claude Code
Add to your `.claude/settings.json`:
```json
{
"mcpServers": {
"ht802": {
"command": "uv",
"args": ["run", "--directory", "/path/to/ht802v2-mcp", "ht802v2-mcp"],
"env": {
"HT802_HOST": "192.168.1.1",
"HT802_PASSWORD": "your-password"
}
}
}
}
```
### Standalone
```sh
HT802_HOST=192.168.1.1 HT802_PASSWORD=secret uv run ht802v2-mcp
```
### Environment Variables
| Variable | Default | Description |
|----------|---------|-------------|
| `HT802_HOST` | `192.168.1.1` | Device IP address |
| `HT802_PORT` | `80` | HTTP port |
| `HT802_USERNAME` | `admin` | Login username (`admin`, `user`, or `viewer`) |
| `HT802_PASSWORD` | *(empty)* | Login password |
| `HT802_USE_SSL` | `false` | Use HTTPS |
| `HT802_VERIFY_SSL` | `false` | Verify TLS certificate |
## Available Tools
### Device Status
| Tool | Description |
|------|-------------|
| `get_system_info` | Model, serial, MAC, firmware versions, uptime, CPU load |
| `get_base_info` | Product model and vendor name |
| `get_network_status` | IP addresses, cable status, NAT, PPPoE, VPN, certificate |
| `get_port_status` | FXS port 1 & 2: hook state, SIP user, registration |
| `get_device_time` | Current device clock |
| `get_apply_status` | Whether a reboot/apply is pending |
| `get_system_process_info` | ATA process memory, provisioning status, core dump |
### Port Settings
Each tool takes a `port` argument (1 or 2).
| Tool | Description |
|------|-------------|
| `get_port_general` | SIP server, user ID, auth, NAT, DNS, outbound proxy |
| `get_port_sip` | Registration, transport, timers, session, keep-alive |
| `get_port_codec` | Vocoder priority, DTMF, RTP, jitter buffer, SRTP, fax |
| `get_port_analog_line` | Impedance, caller ID, loop current, hook flash, ring |
| `get_port_call_settings` | Dial plan, auto-dial, call waiting, caller ID, timeouts |
| `get_port_advanced` | Special feature, SIP security, certificate auth |
| `get_port_call_features` | DND, call forwarding, call waiting, transfer star-codes |
| `get_port_ring_tone` | Custom ring tones, ring cadences, call waiting tones |
### Utilities
| Tool | Description |
|------|-------------|
| `get_values` | Read arbitrary P-parameters by name |
| `reboot` | Reboot the device (~60s downtime) |
## Device API Overview
The HT802 V2 web UI is a Vue.js SPA backed by a JSON HTTP API under `/cgi-bin/`.
### Authentication
Login via `POST /cgi-bin/dologin` with the password base64-encoded in the `P2` field.
Returns a session token (MD5 hex string) and a `session_id` cookie — both must be
included in all subsequent requests. Sessions time out after ~15 minutes of inactivity;
the MCP client re-authenticates automatically on expiry.
### P-Parameters
All device configuration is stored as numbered P-parameters (e.g. `P47` = Primary SIP
Server, `P35` = SIP User ID). The two FXS ports share the same settings structure but
use different P-numbers:
| Setting | Port 1 | Port 2 |
|---------|--------|--------|
| Account Active | P271 | P401 |
| SIP Server | P47 | P747 |
| SIP User ID | P35 | P735 |
| Auth Password | P3 | P703 |
| Local SIP Port | P40 | P740 |
The primary read endpoint is `POST /cgi-bin/api.values.get` with a colon-separated
list of parameter names. All values are returned as strings. Virtual fields like
`mac_display`, `serial_number`, and `cpu_load` use the same endpoint.
Full endpoint and field documentation is in [`api-docs.md`](api-docs.md).
## Development
Requires Python 3.13+ and [uv](https://docs.astral.sh/uv/).
```sh
uv sync # install dependencies
tox -e lint # run ruff linter
tox -e format # check formatting
```
## License
MIT
TDQS
Scored across 17 tools
The get_port_* tools are cleanly partitioned by settings domain (SIP, codec, analog line, call features, ring tone), so an agent can pick by topic. Minor overlap exists: get_base_info and get_system_info both return model information, and get_values is a generic catch-all that overlaps with every dedicated getter.
Reads consistently follow the get_<subject> pattern, with a clean get_port_* namespace for the eight per-port getters. The only deviation is the bare verb 'reboot', which is conventional for an action and easy to read.
With 17 tools the server is slightly heavy, but the count is driven by a genuine 8-category settings split repeated across two FXS ports. Each getter maps to a coherent slice of device state, so no tool feels redundant filler.
The surface is almost entirely read-only: there is no set_values or per-port setter, no factory reset, no firmware or provisioning configuration tool, and reboot is the sole action. For a device-management server, an agent can inspect everything but cannot change anything beyond rebooting, a significant capability gap.