Skip to main content
Glama

fritzbox-mcp

An MCP server for a FRITZ!Box router. It talks TR-064 (SOAP over HTTPS on port 49443, with digest auth) and gives a model ten tools: reads for the line, devices, mesh, Wi-Fi and port forwards, and a two-step plan and apply for changes. It runs over stdio for a local client such as Claude Code, or over streamable HTTP behind an MCP gateway.

Tools

Tool

What it returns

fritzbox_status

Model, firmware, uptime, internet connection, public IP, line rate, DHCP range

fritzbox_hosts

Every device the box knows: IP, MAC, name, active, LAN or Wi-Fi, guest, internet blocked

fritzbox_mesh

Mesh nodes and their links

fritzbox_wifi

Wi-Fi interfaces by index: SSID, on or off, channel, security, client count (never the keys)

fritzbox_port_forwards

Port forwards from the internet

fritzbox_services

The box's TR-064 services

fritzbox_actions

One service's actions, which of them are reads, and each input argument with its type, allowed values, range and default

fritzbox_get

Any read action, with arguments

fritzbox_plan, fritzbox_apply

Changes, in two steps

Reads are actions named Get*, X_AVM-DE_Get* or X_Get*. Answer fields that look secret (passwords, Wi-Fi keys, PSKs, PINs) come back as <hidden>, and so does the configured password wherever it appears.

On fiber models, GetCommonLinkProperties reports the line as 1 Mbit/s. fritzbox_status reads the provisioned rate from X_AVM-DE_GetOnlineMonitor instead and falls back to the Layer 1 fields on boxes without it.

Related MCP server: fritz-mesh-mcp

Changes

fritzbox_plan writes nothing. It returns what would change and an expect text such as 1 change, 0 delete. fritzbox_apply(plan_id, expect) makes the change once. Plans are signed with a key that lives only in the running process, expire after 15 minutes, and are refused if what they touch has changed since.

Op

What it does

port-forward

Adds a forward to a LAN address. If the port already forwards somewhere else, the old mapping is removed first, which counts as a removal

port-forward-delete

Removes a forward

wifi

Turns a Wi-Fi interface on or off

block-internet

Cuts one device off the internet; the LAN keeps working

wake

Wake-on-LAN

reconnect

Drops and redials the line

reboot

Restarts the box; the home network is down for about 3 minutes

call

Any other TR-064 action, checked against the service's own action list. Actions named Delete or Remove count as removals

Removals need FRITZ_MCP_DELETE=1. Everything else needs only the apply, which a client like Claude Code asks you to approve. The plan warns when a change can cut the model's own connection (reboot, reconnect, Wi-Fi off) or hits a device listed in FRITZ_MCP_KEY_HOSTS. Every plan and apply goes to an audit log in the state directory.

FRITZ!Box user

Make a separate user in the box (System > FRITZ!Box Users) with the right to change FRITZ!Box settings, and turn on "Allow access for applications" under Home Network > Network > Network Settings. Adding port forwards through TR-064 can also need the box's setting that lets applications change port sharing.

Settings

Variable

Meaning

FRITZ_URL

Default https://fritz.box:49443. The box's certificate is self-signed, so it isn't verified; use this only on your LAN

FRITZ_USER, FRITZ_PASSWORD

The FRITZ!Box user. The password is never printed

FRITZ_MCP_DELETE=1

Allows removals

FRITZ_MCP_TIMEOUT

Seconds, default 30

FRITZ_MCP_NOTES

Optional text added to the server's instructions, for what the model should know about your network ("the NAS at .20 runs the VPN; the repeater in the attic carries the office")

FRITZ_MCP_KEY_HOSTS

Optional ip=name pairs, comma separated. Blocking one of these devices' internet gets a warning in the plan

MCP_STATE_DIR

Where plans and the audit log go

On Windows, a variable set with setx is read from the registry, so a running client picks it up without a restart.

Running it locally

With uv, in Claude Code:

claude mcp add fritzbox --env FRITZ_USER=mcp --env FRITZ_PASSWORD=... -- uvx --from git+https://github.com/androsmeda/fritzbox-mcp fritzbox-mcp

Or in a client's JSON config:

"fritzbox": {
  "command": "uvx",
  "args": ["--from", "git+https://github.com/androsmeda/fritzbox-mcp", "fritzbox-mcp"],
  "env": {"FRITZ_USER": "mcp", "FRITZ_PASSWORD": "..."}
}

Behind a gateway

With MCP_TRANSPORT=http the server listens on MCP_HTTP_HOST:MCP_HTTP_PORT (default 0.0.0.0:8000) at /mcp. It refuses to start unless these are set:

  • MCP_HTTP_TOKEN: at least 32 printable characters. Every request needs exactly one Authorization: Bearer <token> header.

  • MCP_HTTP_ALLOWED_HOSTS: the host names the gateway uses, such as fritzbox-mcp:8000.

MCP_HTTP_TOOLS=read (the default) serves only the read tools and removes plan and apply before the server starts. MCP_HTTP_TOOLS=all serves all ten, and the gateway decides who reaches them. Either way, only initialize, ping, tools/list and tools/call are answered. The server speaks plain HTTP, so keep its port on the gateway's internal network.

The image is ghcr.io/androsmeda/fritzbox-mcp, tagged with the commit SHA:

docker run -d --name fritzbox-mcp --network gateway-net \
  -e FRITZ_URL=https://192.168.178.1:49443 -e FRITZ_USER=mcp -e FRITZ_PASSWORD=... \
  -e MCP_HTTP_TOKEN=... -e MCP_HTTP_ALLOWED_HOSTS=fritzbox-mcp:8000 \
  -v /path/to/state:/state ghcr.io/androsmeda/fritzbox-mcp:<sha>

It runs as uid 99, gid 100, so the state folder must be writable by that user.

Tests

uv run pytest

The tests run against a fake box (tests/fake_fritz.py) that speaks digest auth, the TR-064 description and SCPDs, SOAP, and the host and mesh list files, so they never call a real box.

License

MIT

Available Tools

10 tools
fritzbox_actionsC
Read-only

The actions of one TR-064 service with their in/out arguments, and which ones are reads.

Inputs: service (required).

fritzbox_applyA
Destructive

Apply a plan from fritzbox_plan, once. expect must be its exact text, e.g. '1 change, 0 delete'. Refuses if the plan is old, used or altered, removes things while FRITZ_MCP_DELETE is off, or what it touches changed.

Inputs: expect (required), plan_id (required).

fritzbox_getA
Read-only

Run one read action (Get* or X_AVM-DE_Get*) with NewName arguments, e.g. service 'Hosts', action 'GetGenericHostEntry', args {'NewIndex': 0}. Secret-looking answer fields are masked.

Inputs: action (required), service (required), args.

fritzbox_hostsB
Read-only

Every device the box knows: IP, MAC, name, active, LAN/Wi-Fi, port, speed, guest, internet blocked. active_only, query (matches any field).

Inputs: query, active_only.

fritzbox_meshB
Read-only

Mesh nodes (box, repeaters, clients) with their links and current rates.

Inputs: no named parameters.

fritzbox_planA
Read-only

Plan changes; writes nothing. changes = list of {op:'port-forward', external_port, protocol:'TCP'|'UDP', internal_client, internal_port?, description?, enabled?}, {op:'port-forward-delete', external_port, protocol} (a removal), {op:'wifi', index, enable}, {op:'block-internet', ip, blocked}, {op:'wake', mac}, {op:'reconnect'}, {op:'reboot'}, {op:'call', service, action, args} (any other TR-064 action). Returns a plan_id valid 15 minutes.

Inputs: changes (required).

fritzbox_port_forwardsB
Read-only

Port forwards from the internet to LAN devices (TR-064 port mappings).

Inputs: no named parameters.

fritzbox_servicesA
Read-only

The box's TR-064 services (for fritzbox_actions / fritzbox_get).

Inputs: no named parameters.

fritzbox_statusB
Read-only

Model, firmware, uptime, internet connection and public IP, line rates, DHCP range.

Inputs: no named parameters.

fritzbox_wifiB
Read-only

Wi-Fi interfaces by index: SSID, on/off, channel, standard, security, connected clients. Keys are never shown.

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 10 tools

    Disambiguation4/5

    Each tool targets a distinct FRITZ!Box area or phase of the plan/apply workflow, so most boundaries are clear. The only mild overlap is fritzbox_get, whose generic TR-064 read capability can duplicate specific readers like fritzbox_hosts, though the descriptions give enough guidance to choose.

    Naming Consistency5/5

    All tools share the fritzbox_ prefix and use consistent snake_case, with readable noun names for readers and verb-like names for action tools. There are no mixed conventions or casing inconsistencies.

    Tool Count5/5

    Ten tools is well-scoped for a router management server: a compact set of focused readers, three TR-064 introspection tools, and a safe plan/apply pair for writes. Nothing feels redundant or missing at the count level.

    Completeness5/5

    The surface covers status, hosts, mesh, Wi-Fi, port forwards, raw TR-064 discovery/read, and a broad write path via plans including port forwards, Wi-Fi, internet blocking, wake, reconnect, reboot, and arbitrary actions. This gives both targeted convenience tools and a generic escape hatch for less common operations.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      A Model Context Protocol (MCP) server for interfacing with AVM FRITZ!Box routers. Control smart home devices, monitor network status, and administer your router through any MCP-compatible client.
      10
      MIT
    • A
      license
      B
      quality
      C
      maintenance
      Enables management of a FRITZ!Box mesh over stdio, including band steering, radio and backhaul settings, DHCP IPv4 reservations, router status, guest Wi-Fi, port forwards, Wake-on-LAN, smart home switches, and reboot operations across a master and adopted repeaters.
      22
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI copilots and autonomous agents to inspect, diagnose, and safely manage TP-Link 4G/LTE gateways and broadband routers through typed MCP tools for status, signal, clients, Wi-Fi, DNS, SMS/USSD, and guarded mutations. It provides session leasing and confirmation safeguards to avoid locking out admins or disconnecting active sessions.
      MIT