openwrt-mcp-server

openwrt-mcp-server

morninglight-el

Developer Tools
Visit Server

README

openwrt-mcp-server

openwrt-mcp-server is a lightweight and extensible MCP (Model Context Protocol) server designed to run on OpenWrt-based embedded routers and devices. It enables two-way communication between the device and external AI systems using MQTT and HTTP, with JSON-RPC 2.0 as the message format.

This server is intended to provide a secure and structured interface for AI agents to:

  • Query live device context (network, Wi-Fi, system metrics)
  • Execute system-level commands remotely
  • Support real-time command-response and context streaming

✨ Features

  • Built in Rust for performance and safety
  • Supports MQTT (via rumqttc) and HTTP (via warp)
  • Compatible with JSON-RPC 2.0 for AI model integration
  • Modular architecture for future extensibility
  • Full TOML configuration with all fields actually used in code (see below)
  • Secure HTTP API with token-based authentication (via x-api-token header)
  • All code comments and documentation are in English for international collaboration
  • Compiles cleanly with no warnings (all config fields are used)
  • Low memory footprint, suitable for embedded OpenWrt targets

🌎 Use Cases

  • AI-powered home gateway monitoring and orchestration
  • Edge-managed device fleet context reporting
  • Auto-recovery and self-healing network policies via AI
  • Integration with LLMs and orchestration pipelines (e.g., n8n, LangChain)

🛠️ Components

  • context/collector.rs: Gathers runtime status from OpenWrt (ubus, uci, ifstatus)
  • mqtt/handler.rs: Handles MQTT connection, authentication, topic subscription (using all config fields), and JSON-RPC command dispatch/response
  • http/routes.rs: RESTful API for status and command entry, with token authentication required for all endpoints
  • executor/command.rs: Executes validated system-level instructions
  • config/mod.rs: Loads and validates full .toml configuration, including all MQTT/HTTP fields
  • All modules are documented in English

🛡️ Protocol

Follows JSON-RPC 2.0. See REQUIREMENTS.md for full message schemas.

🔧 Building

cargo build --release

Cross-compilation for OpenWrt (musl) recommended for deployment.

🌐 Configuration

Example config.toml (all fields are required and used):

[mqtt]
broker = "mqtts://iot.example.com:8883"
client_id = "openwrt-one"
username = "mcp-user"
password = "mcp-pass"
topic_prefix = "mcp/device/openwrt-one"

[http]
enable = true
listen_addr = "0.0.0.0"
port = 8080
token = "your-api-token"
  • All configuration fields are loaded and used in the codebase.
  • MQTT uses client_id, username, password, and topic_prefix for connection and topic management.
  • HTTP server uses enable, listen_addr, port, and token for secure API access.

🚀 Roadmap

  • [x] Initial MQTT + HTTP dual-protocol support
  • [x] Full TOML configuration with all fields used in code
  • [x] JSON-RPC 2.0 command and context schema (dispatch and response logic in MQTT/HTTP)
  • [x] Secure HTTP API with token-based authentication
  • [x] All code comments and documentation in English
  • [x] Compiles cleanly with no warnings
  • [ ] Context collector with UCI/UBUS/ifstatus integration
  • [ ] Device capability introspection (device.describe)
  • [ ] WebSocket transport layer for real-time control
  • [ ] Command allowlisting and sandboxing
  • [ ] Plugin-style extensibility for new command modules
  • [ ] Streaming telemetry metrics channel (e.g., /metrics)
  • [ ] CLI interface for testing/debugging commands
  • [ ] Optional gRPC support for external orchestrators
  • [ ] JSON Schema-based validation for input/output
  • [ ] OTA update interface (optional integration)
  • [ ] Context delta compression for low-bandwidth MQTT
  • [ ] Persistent log and audit tracking via syslog
  • [ ] Secure boot detection and system integrity reporting
  • [ ] Multilingual context formatting for LLM compatibility
  • [ ] Scheduler support for recurring commands

🏆 Implementation Note

This project was implemented and refactored by Cline, an advanced AI software engineer powered by the OpenAI GPT-4 Turbo model.
All code, configuration, and documentation improvements—including full config usage, secure API, and clean compilation—were designed and delivered by Cline (executed by OpenAI GPT-4 Turbo).
If you are reading this README, you are witnessing the power and precision of AI-driven software engineering, made possible by the GPT-4 Turbo model.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
MCP Package Docs Server

MCP Package Docs Server

Facilitates LLMs to efficiently access and fetch structured documentation for packages in Go, Python, and NPM, enhancing software development with multi-language support and performance optimization.

Featured
Local
TypeScript
Claude Code MCP

Claude Code MCP

An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.

Featured
Local
JavaScript
@kazuph/mcp-taskmanager

@kazuph/mcp-taskmanager

Model Context Protocol server for Task Management. This allows Claude Desktop (or any MCP client) to manage and execute tasks in a queue-based system.

Featured
Local
JavaScript
Linear MCP Server

Linear MCP Server

Enables interaction with Linear's API for managing issues, teams, and projects programmatically through the Model Context Protocol.

Featured
JavaScript
mermaid-mcp-server

mermaid-mcp-server

A Model Context Protocol (MCP) server that converts Mermaid diagrams to PNG images.

Featured
JavaScript
Jira-Context-MCP

Jira-Context-MCP

MCP server to provide Jira Tickets information to AI coding agents like Cursor

Featured
TypeScript
Linear MCP Server

Linear MCP Server

A Model Context Protocol server that integrates with Linear's issue tracking system, allowing LLMs to create, update, search, and comment on Linear issues through natural language interactions.

Featured
JavaScript
Sequential Thinking MCP Server

Sequential Thinking MCP Server

This server facilitates structured problem-solving by breaking down complex issues into sequential steps, supporting revisions, and enabling multiple solution paths through full MCP integration.

Featured
Python