dbshadow/dhm-mcp
If you are the rightful owner of dhm-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
The M95 Management and Control Platform provides a comprehensive suite of tools for managing and interacting with an M95 network device, offering interfaces for scripting, manual administration, and automated agent control.
D-Link Router Management and Control Platform
This project provides a comprehensive suite of tools for managing and interacting with D-Link network devices that support the DHM API. It offers multiple interfaces to control the device's functions, catering to different use cases from direct scripting to manual administration and automated agent control.
Supported Models (include but are not limited to):
- AQUILA PRO AI Series: M95, M60, M30
- EAGLE PRO AI Series: R15, M15, E15, G415, G416
Features
- Device Administration: Reboot the device and control the status of its LED lights.
- Client Management: List all connected clients and their information (MAC Address, IP, etc.).
- Access Control: Block or unblock specific clients from network access based on their MAC address.
- System Log: View the device's system log.
- Secure Communication: Implements a robust authentication and session management system with challenge-response and AES-encrypted API calls.
Configuration
Before using the tools, you need to provide the credentials for your D-Link device. This is done by creating a .env file in the project's root directory.
- Rename the
.env.examplefile to.env. - Open the
.envfile and fill in your device's IP address and password.
# .env
ROUTER_IP=192.168.1.1
USERNAME=admin
PASSWORD=your_password
Components
The project is divided into three main components:
1. dlink_api.py (Core Library)
This is the core Python library that directly interfaces with the D-Link device's API. It handles the complex authentication handshake, session management, and encrypted communication. All other components in this project are built on top of this library.
2. dlink_cli.py (Command-Line Interface)
A command-line tool for administrators to manually manage the D-Link device from a terminal.
Prerequisites:
- Python 3
- Required packages listed in
requirements.txt - A configured
.envfile (see Configuration section)
Installation:
pip install -r requirements.txt
Usage:
All commands are now run without passing host or password arguments.
python dlink_cli.py <COMMAND> [OPTIONS]
Commands:
-
Test Login:
python dlink_cli.py login -
Get Client List:
python dlink_cli.py get-client-info -
Get Parental Control Profiles:
python dlink_cli.py get-profiles -
Turn LED On/Off:
# Turn LED off python dlink_cli.py set-led-state off # Turn LED on python dlink_cli.py set-led-state on -
Block a Client:
python dlink_cli.py set-client-info AA:BB:CC:DD:EE:FF block -
Unblock a Client:
python dlink_cli.py set-client-info AA:BB:CC:DD:EE:FF unblock -
Assign a Profile to a Client:
python dlink_cli.py set-client-info AA:BB:CC:DD:EE:FF <PROFILE_UUID> -
Reboot Device:
python dlink_cli.py reboot -
Get System Log:
python dlink_cli.py get-syslog
3. dlink_mcp.py (MCP Server)
This script launches a FastMCP server, exposing the device's functionality as a set of tools that can be called by an automated agent (e.g., an AI assistant).
Usage:
The server no longer requires command-line arguments; it reads its configuration from the .env file.
python dlink_mcp.py
The server will start on 0.0.0.0:8444 by default, making the following tools available for remote execution:
login()reboot()get_client_info()get_parental_control_profiles()block_client(mac_address: str)unblock_client(mac_address: str)assign_client_to_profile(mac_address: str, profile_uuid: str)set_led_state(state: str)get_syslog()- A readable resource
resource://syslogwhich provides the full system log. - A prompt
summary_logto guide the AI in summarizing the system log.