Skip to main content

MCP server to manage NAT / port forwarding on ZTE ZXHN F680 routers

Project description

zte-f680-mcp

zte-f680-mcp banner

MCP Server (Model Context Protocol) to manage NAT / port forwarding on a ZTE ZXHN F680 GPON router from any MCP-compatible client (Claude Desktop, Claude Code, Cursor, Windsurf, OpenAI Agents SDK, Cline, Continue, etc.).

Control your router port forwarding rules conversationally, without opening the web UI.

Features

Tool Description
zte_get_port_forwards List all NAT rules
zte_add_port_forward Add a new port forwarding rule
zte_modify_port_forward Modify an existing rule by index
zte_delete_port_forward Delete a rule by index
zte_run_page Fetch and parse any page from the router (generic)

Requirements

  • Python 3.10+
  • A ZTE ZXHN F680 router reachable on the local network
  • The admin credentials of the router's web panel

Install & configure

The easiest way is with uv (or pipx). No cloning, no venv.

Claude Desktop

Edit claude_desktop_config.json:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "zte": {
      "command": "uvx",
      "args": ["zte-f680-mcp"],
      "env": {
        "ZTE_HOST": "192.168.1.1",
        "ZTE_USER": "1234",
        "ZTE_PASSWORD": "your_password_here"
      }
    }
  }
}

Claude Code (CLI)

claude mcp add zte \
  --env ZTE_HOST=192.168.1.1 \
  --env ZTE_USER=1234 \
  --env ZTE_PASSWORD=your_password_here \
  -- uvx zte-f680-mcp

Cursor / Windsurf / Cline / Continue

Add the same block as Claude Desktop in the corresponding MCP settings file of each client.

OpenAI Agents SDK (Python)

from agents.mcp import MCPServerStdio

zte = MCPServerStdio(
    params={
        "command": "uvx",
        "args": ["zte-f680-mcp"],
        "env": {
            "ZTE_HOST": "192.168.1.1",
            "ZTE_USER": "1234",
            "ZTE_PASSWORD": "your_password_here",
        },
    }
)

Alternative: classic pip install

pip install zte-f680-mcp

Then point your MCP client at the installed script:

{
  "mcpServers": {
    "zte": {
      "command": "zte-f680-mcp",
      "env": {
        "ZTE_HOST": "192.168.1.1",
        "ZTE_USER": "1234",
        "ZTE_PASSWORD": "your_password_here"
      }
    }
  }
}

Configuration

The server reads three environment variables (or a local .env file):

Variable Default Description
ZTE_HOST 192.168.1.1 Router IP
ZTE_USER 1234 Admin username
ZTE_PASSWORD (none) Admin password (required)

Example prompts

Once the MCP is registered you can ask your assistant things like:

List the NAT rules on my ZTE router
Open TCP port 8080 forwarded to 192.168.1.100
Delete port forwarding rule number 2
Show the DHCP leases from my router

How it works

  • Auth: SHA256(password + random) with dynamic tokens (Frm_Logintoken, Frm_Loginchecktoken) extracted from the login page.
  • Session: Expires ~60 s idle. The server re-authenticates automatically every 45 s.
  • Anti-CSRF: Each write operation requires a fresh _SESSION_TOKEN fetched from the page.
  • Protocol codes: 0 = TCP+UDP, 1 = UDP, 2 = TCP.
  • Transport: MCP over stdio.

Stack

Development

git clone https://github.com/Picaresco/MCP-ZTE-F680.git
cd MCP-ZTE-F680
python -m venv venv && . venv/Scripts/activate   # Windows
# source venv/bin/activate                         # Linux / macOS
pip install -e .
cp .env.example .env   # fill in your credentials
python -m zte_f680_mcp.server

License

MIT © Alberto Diaz

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zte_f680_mcp-0.2.0.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zte_f680_mcp-0.2.0-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file zte_f680_mcp-0.2.0.tar.gz.

File metadata

  • Download URL: zte_f680_mcp-0.2.0.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for zte_f680_mcp-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7b837008e00c2a8d6d9d776ad5535016739b7c80ac625c07ad066bbbfd852a5a
MD5 a52fc76da386dbfa91d0cc60b62aa98f
BLAKE2b-256 21ad35ea364f64ebb0a3e838e511f5ef2b1389cfe5de51410b86ff395ac98847

See more details on using hashes here.

File details

Details for the file zte_f680_mcp-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: zte_f680_mcp-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for zte_f680_mcp-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7fc11ee91af47f9e71528c7197a454fe0e938fa1d8aedce1b4f24061feee7705
MD5 20e10928cde6b6cea178644cf53c4115
BLAKE2b-256 a567242e5baaca8de5d82ee30c160231ab99b92517be3c0db8c2e1e81ce7fd6f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page