huawei-cpe-mcp
Provides read-only tools for Huawei HiLink 4G/5G CPE routers, exposing signal quality, carrier aggregation, neighbour cells, traffic counters, connected devices, operator info, firmware and masked device identity without changing configuration.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@huawei-cpe-mcp What's my signal quality and which bands are being aggregated right now?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
huawei-cpe-mcp
A read-only Model Context Protocol server for Huawei HiLink 4G/5G CPE routers (H155-383 and the H168/H165 family).
Read-only. 10 tools: signal, carrier aggregation, neighbours, traffic, devices, operator, firmware — no configuration changes.
Zero runtime dependencies. Python 3.12+, standard library only.
SCRAM-SHA256 login. Works with firmware that rejects the old base64 HiLink clients (
huawei-lte-api, most "Huawei MCP" projects).Session-aware. The modem allows one admin session and rejects rapid re-logins; the server leases a session, yields to the web UI, and never retries a failed password.
Persian documentation: README.fa.md
Choose your path
You are… | Start at |
New to modems / CPEs | |
A developer | |
Building an AI agent |
Related MCP server: UISP MCP Server
Start here (no experience needed)
You need the modem's address and its admin password.
1. Find the modem address. Huawei CPEs usually answer on
http://192.168.8.1. Carrier-branded units sometimes use 192.168.0.1 or
192.168.1.1. That address is HUAWEI_CPE_HOST.
2. Pick how to store the password. Choose one:
# A) environment variable (simple, but visible to the process)
export HUAWEI_CPE_PASSWORD='your-admin-password'
# B) a 0600 file (recommended for daily use)
install -m 700 ~/.config/huawei-cpe-mcp
install -m 600 /dev/null ~/.config/huawei-cpe-mcp/password
printf '%s' 'your-admin-password' > ~/.config/huawei-cpe-mcp/password
# C) macOS Keychain
security add-generic-password -U -a admin -s huawei-cpe-mcp.admin -w
# D) Linux secret-tool
secret-tool store --label='huawei-cpe-mcp' service huawei-cpe-mcp.admin account admin3. Self-test:
./bin/huawei-cpe-mcp --checkExpected: OK: authenticated read-only session, logged out plus the model and
firmware version.
4. Add it to your AI client:
{
"mcpServers": {
"huawei": {
"command": "/absolute/path/to/huawei-cpe-mcp/bin/huawei-cpe-mcp",
"args": [],
"env": { "HUAWEI_CPE_HOST": "192.168.8.1" }
}
}
}Then ask:
"What is my signal quality and which bands are aggregated?"
"How much traffic did I use today and this month?"
"Which operator am I on, and is the SIM roaming?"
"How many devices are connected to the modem?"
None of these change anything.
Install (developers)
git clone https://github.com/mortezabahmani/huawei-cpe-mcp.git
cd huawei-cpe-mcp
python3 -m unittest discover -s tests # 29 offline tests
./bin/huawei-cpe-mcp --check --simulate # no modem needed
./bin/huawei-cpe-mcp # stdio MCP serverOptional installed entry point:
python3 -m venv .venv && . .venv/bin/activate
pip install -e .
huawei-cpe-mcp --checkConfiguration
Variable | Default | Meaning |
|
| Modem address |
|
| Override the full base URL |
|
| HTTP timeout (s) |
| — | Password via environment |
|
| 0600 file |
|
| Keychain/secret-tool service |
|
| Reuse a login for this many idle seconds |
|
| Minimum gap between two sessions |
| OS-specific | Session-gate timestamp only |
|
|
|
Tools
Full schemas: docs/TOOLS.md.
Tool | Returns |
| signal + status + traffic + operator in one snapshot |
| band, PCI, EARFCN, RSRP/RSRQ/SINR, MCS, NR fields |
| aggregated LTE/NR secondary cells |
| neighbouring LTE cells |
| current mode + advertised bands |
| LTE mask decoded to band numbers |
| session and monthly counters |
| LAN clients (MACs masked) |
| registered operator and RAT |
| model, firmware, identity (masked) |
What it will not do
Change bands, cells, APN, Wi-Fi, firewall or firmware.
Reboot or reconnect the modem.
Read or send SMS.
Return IMEI/IMSI/ICCID/serial/MAC values unless they are masked.
Band lock and cell lock are deliberately out of scope for 0.2. Cell lock is not
supported by H155-383 firmware anyway (/api/ntwk/celllock returns 100002).
Modem behaviour you should know
Code | Meaning | Server behaviour |
| wrong username/password | one attempt, then a 5-minute circuit breaker |
| account locked | stop, human must unlock |
| another admin session | yield; do not retry |
| token/session invalid | refresh once, then fail |
| endpoint unsupported | report, do not retry |
The firmware also rejects a login that follows another session too closely with
108006. To avoid mistaking that for a wrong password, the client:
reuses one session for
HUAWEI_CPE_SESSION_TTLseconds;refuses a new login within
HUAWEI_CPE_MIN_INTERVALseconds;logs out at idle and at process exit.
If the modem's web UI is open, the server yields instead of kicking you out.
Compatibility
Device / firmware | Status |
Huawei H155-383, | verified |
Huawei H168-383 / H165-383 family | expected (same SCRAM flow) |
Older HiLink (base64 login) | not supported by this client |
| do not work on this firmware |
The SCRAM implementation was compared line by line with the device's own
JavaScript (emui-crypto.js) and pinned with regression vectors.
Test without a modem
python3 -m unittest discover -s tests # fake transport + pinned vectors
./bin/huawei-cpe-mcp --check --simulate # full stdio, synthetic modemThe simulator (src/huawei_cpe_mcp/sim.py) performs a real SCRAM handshake
against a fake transport. The local check script uses it; tests never touch a device.
Or run everything at once (lint is skipped if ruff is not installed):
./scripts/check.shContinuous integration (optional)
Hosted CI is not required. docs/ci-github-actions.yml is a ready workflow;
copy it to .github/workflows/ci.yml if your GitHub account can run Actions.
The same steps run locally in scripts/check.sh.
Troubleshooting
Symptom | Cause | Fix |
| no secret configured | set env/file/keychain (see above) |
| wrong password or two logins too close | confirm the password in the web UI, wait, retry once |
| web UI open | close it or wait |
| endpoint absent | expected for cell lock |
| unexpected device response | the session is aborted; check the network path |
| wrong host/port | set |
Security
Secrets come from env, a
0600file, or the OS keychain — never from the repo.The password is never placed in a command-line argument.
Output is masked (IMEI/IMSI/ICCID/serial/MAC) and capped at 12,000 characters.
Audit log:
~/Library/Logs/huawei-cpe-mcp/on macOS, XDG state on Linux.
See SECURITY.md.
License
MIT — see LICENSE.
Available Tools
10 toolsband_lock_statusA
Read-only: current network mode and the LTE band lock mask decoded to band numbers.
Inputs: no named parameters.
carrier_aggregationA
Read-only: aggregated LTE/NR secondary cells (band, bandwidth, PCI, signal).
Inputs: no named parameters.
device_infoB
Read-only: model, firmware and identity (masked).
Inputs: no named parameters.
devicesA
Read-only: LAN clients known to the modem. MAC addresses masked.
Inputs: no named parameters.
neighbor_cellsB
Read-only: neighbouring LTE cells reported by the modem.
Inputs: no named parameters.
network_modeB
Read-only: network mode plus the bands the modem advertises as supported.
Inputs: no named parameters.
plmnB
Read-only: registered operator and radio access type.
Inputs: no named parameters.
signalB
Read-only: serving cell signal and radio parameters.
Inputs: no named parameters.
telemetryB
Read-only: one snapshot of signal, status, traffic and operator.
Inputs: no named parameters.
trafficB
Read-only: current session and monthly traffic counters.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
Most tools target distinct data (traffic counters, neighbor cells, PLMN), but several overlap: telemetry bundles signal, status, traffic and operator, duplicating signal/traffic/plmn; band_lock_status and network_mode both report bands; device_info (the CPE itself) vs devices (LAN clients) invites confusion. Descriptions do help disambiguate, so an attentive agent can pick correctly, but boundaries are not crisp.
All names follow a consistent noun/read-only-attribute style (signal, traffic, plmn, neighbor_cells), with no mixed verb conventions. Minor deviation: device_info uses an '_info' suffix while its sibling 'devices' does not, and band_lock_status mixes a state concept into a name that could imply an action.
Ten read-only tools is a well-scoped count for a CPE monitoring surface, and each exposes a distinct telemetry facet. The only redundancy is the composite telemetry tool that re-bundles data available from other tools.
Read-only coverage of the modem's status domain is reasonably thorough (identity, signal, CA, neighbors, bands, traffic, clients, operator). However, the surface is entirely observational: there is no way to set band lock, change network mode, reboot, or configure anything, and band_lock_status implies a setter that does not exist.
Maintenance
Related MCP Connectors
Read-only access to your MetaTrader 4 and 5 accounts for AI agents: balances, open positions, trade history with win rate, live quotes, symbol specs and candles. It cannot place, modify or close orders.
Read-only Linux server and Docker monitoring for AI assistants: CPU, memory, disk, network.
Read-only local AI advice, shared reports and website audits. No PC scan or local actions.
Router default logins, compliance index, MAC/OUI lookup. Reads free; submit_correction is Pro.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI assistants to read-only monitor iStoreOS/OpenWRT routers via SSH or HTTP/ubus API, providing 31 tools for system status, network info, logs, and plugin status (OpenClash, Passwall, AdGuardHome, etc.).31MIT
- AlicenseAqualityBmaintenanceEnables AI assistants to monitor Ubiquiti UISP network infrastructure through read-only REST API access to sites, devices, outages, logs, data links, gateways, background tasks, firmware, and speed tests.27Apache 2.0
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to interact with Xiaomi/Redmi routers, providing read-only queries and management capabilities such as device listing, port forwarding, DHCP reservations, and reboot control.MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to safely inspect fleets of MikroTik RouterOS devices and SNMP v2c endpoints through deny-by-default read-only tools, batch queries, and one-call diagnosis recipes for NOC work. Returns redacted, auditable results so routers can be observed without any risk of configuration changes.22 npmApache 2.0