Skip to main content
Glama
dbshadow

OpenWrt MCP Controller

by dbshadow

OpenWrt MCP Controller

This project provides a Model Context Protocol (MCP) server for managing OpenWrt devices. It allows you to interact with and control an OpenWrt router through a simple API.

The server utilizes fastmcp to expose OpenWrt functionalities as tools that can be called remotely.

1. Prerequisites

For the server to have full functionality, a custom LuCI RPC script must be placed on the target OpenWrt device.

Install sys.lua on OpenWrt

The sys.lua file in this repository extends the capabilities of the LuCI JSON-RPC interface. You must copy this file to your OpenWrt router for tools like system_status, network_status, and set_led_state to work.

  1. Copy the file to your OpenWrt device: Use scp or any other file transfer method to copy sys.lua to your router.

    scp sys.lua root@<your_openwrt_ip>:/usr/lib/lua/luci/sys.lua
  2. Verify Permissions: Ensure the file has the correct permissions.

    ssh root@<your_openwrt_ip> "chmod 644 /usr/lib/lua/luci/sys.lua"

Related MCP server: openwrt-mcp

2. Installation

You can install this package directly from PyPI.

pip install openwrt-mcp

3. Configuration

The server is configured through environment variables. You must set the following before running the server:

  • OPENWRT_HOST: The full URL of your OpenWrt device (e.g., http://192.168.1.1).

  • OPENWRT_PASSWORD: The login password for your OpenWrt device.

  • OPENWRT_USERNAME: (Optional) The login username. Defaults to root.

Example:

export OPENWRT_HOST="http://192.168.1.1"
export OPENWRT_PASSWORD="your_secret_password"

4. Usage

Once installed and configured, you can start the MCP server with the following configuration:

{
    "mcpServers":{
        "openwrt-mcp":{
            "command":"uvx",
            "args": [
                "openwrt-mcp"
            ],
            "env":{
                "OPENWRT_HOST":"192.168.0.1",
                "OPENWRT_PASSWORD":"root",
                "OPENWRT_USERNAME":"12345678"
            }
        }
    }
}

The server will start and listen for incoming connections via standard I/O.

Available Tools

The following tools are exposed by the MCP server:

  • reboot(): Reboots the OpenWrt device.

  • system_status(): Retrieves system and board information.

  • network_status(): Gets the status of all network interfaces.

  • read_log(): Reads the system log (logread).

  • set_led_state(state: str): Sets the state of the "Green" LED. state can be 'on' or 'off'.

  • summary_log(): Provides a structured prompt template for an AI to summarize the output of read_log().

Available Tools

5 tools
network_statusA

取得OpenWRT所有網路介面的狀態。 會自動先登入取得Token再執行。

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses the automatic login and token retrieval, adding valuable context about the tool's operational behavior beyond just the status retrieval.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description consists of two concise sentences: the first states the main purpose, and the second adds the important automation detail. No wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given zero parameters and an existing output schema, the description covers the core functionality comprehensively. It specifies that all network interfaces are included and explains the authentication step, leaving no obvious gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has no parameters, so schema coverage is trivially 100%. The description does not need to add parameter details, and it implicitly confirms no parameters are required, which is clear and sufficient.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool retrieves the status of all network interfaces on OpenWRT, which is a specific verb+resource combination. It differentiates from sibling tools like 'reboot' or 'read_log' that target different functionalities.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly mentions automatic login before execution, providing clear context. While it does not state exclusions or alternatives, the distinct purpose from siblings makes when-to-use self-evident.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

read_logA

讀取OpenWRT的系統日誌 (logread)。 會自動先登入取得Token再執行。

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.9/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, but description adds behavioral context about automatic login and token acquisition, which goes beyond the name. However, fails to disclose failure behaviors.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two short, efficient sentences that front-load purpose. No redundant information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool has an output schema, so return values are covered. Description includes important behavioral detail (auto-login). Complete for a simple, parameterless tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Zero parameters, baseline 4. Description adds no parameter info, but schema coverage is 100% and no params need explanation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states it reads OpenWRT system logs, with specific verb and resource. Differentiated from siblings which are for network, reboot, LED, and system status.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use vs alternatives. Only mentions automatic login, but lacks explicit context for selection among sibling tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

rebootA

Reboot OpenWRT. 會自動先登入取得Token再執行重開機。

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided. The description reveals that the tool automatically logs in to obtain a token before rebooting, which is a valuable behavioral detail beyond a simple reboot.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, one in English and one in Chinese, provide the essential information. Could be slightly more concise by merging, but it is well-structured and front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple reboot tool, the description communicates the core action and the automatic login behavior. However, it lacks details on the reboot's impact (e.g., immediate, duration, caution) that an agent might need.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

There are no parameters, and the input schema coverage is 100% (trivially). According to guidelines, 0 parameters yields a baseline of 4, and no additional parameter description is needed.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Reboot OpenWRT', which is a specific verb-resource pairing. It is distinct from sibling tools (network_status, read_log, set_led_state, system_status) that deal with monitoring or configuration.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when a reboot is needed, and mentions automatic login, but does not provide explicit when-not-to-use scenarios or alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

set_led_stateA

控制 Green LED 燈亮起或熄滅。 state: 'on' 或 'off'

ParametersJSON Schema
NameRequiredDescriptionDefault
stateYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description must disclose behavior. It only states it controls on/off, lacking details on side effects, prerequisites, or persistence. However, for a simple LED control, this is minimally adequate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, no wasted words. First sentence gives purpose, second explains parameter. Perfectly concise and front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple tool with one parameter and an output schema (assumed present), the description covers the core purpose and parameter. Could mention persistence, but overall complete enough.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 0% coverage for parameter descriptions, but the description explicitly defines the allowed values 'on' and 'off', adding essential meaning beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool controls the Green LED to turn on or off, specifying the exact resource and action. Sibling tools have different purposes (network_status, read_log, reboot, system_status), so no confusion.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool versus alternatives, but the simple nature of the tool makes it self-evident. Users can infer its use for LED control, but not stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

system_statusA

取得OpenWRT的系統狀態。 會自動先登入取得Token再執行。

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.5/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description discloses the automatic login and token retrieval process, which is a key behavioral trait. However, it does not mention error handling or what happens if authentication fails.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise, using two short sentences with no unnecessary words. It is front-loaded with the purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the presence of an output schema (not shown but indicated), the description does not need to explain return values. However, it could briefly mention the type of status info (e.g., CPU, memory) to improve completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With zero parameters, the schema provides full coverage. The description adds no parameter information, which is acceptable given the lack of parameters. Baseline score of 4 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it retrieves OpenWRT system status, which is distinct from sibling tools like network_status or read_log. However, it does not elaborate on what specific aspects of system status are included.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives is provided. For example, it does not mention that network_status should be used for network-specific information.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

A3.9/5.0
Disambiguation5/5

Each tool targets a distinct function: network interfaces, system logs, reboot, LED control, and system status. No overlapping purposes.

Naming Consistency3/5

Names use snake_case but mix patterns: two are noun_noun (network_status, system_status), one verb_noun (read_log), one single verb (reboot), and one verb_noun_noun (set_led_state). Inconsistent verb/noun ordering.

Tool Count5/5

Five tools is a well-scoped set for a basic OpenWrt controller covering monitoring and simple control actions. Each tool serves a clear purpose.

Completeness3/5

The set covers essential monitoring and reboot, but lacks common management operations like package updates, firewall configuration, or network settings modifications. LED control is niche.

Maintenance

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dbshadow/openwrt-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server