home_router
Provides tools to control Nokia GPON home routers (e.g., G-2425G-A), enabling listing of connected devices, blocking/unblocking internet access via parental control rules, and managing access policies.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@home_routerCheck if my daughter's iPad is online"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Nokia / Airtel GPON Home Router API
Control and automate your Nokia G-2425G-A GPON Home Gateway (commonly deployed by Airtel Xstream Fiber and other ISPs) via CLI, REST API, and MCP (Model Context Protocol) ā without any browser automation!
š” Why This Project?
The Problem
Most home fiber routers (such as Airtel's Nokia GPON ONT) do not provide an official API or integration for smart home ecosystems. Whenever you want to:
Check which devices are currently connected to your Wi-Fi,
Block internet access for a specific device (e.g., managing children's screen time),
Or automate network rules based on time or smart home states...
...you are forced to manually open a browser, navigate a sluggish web portal, type credentials, and click through multiple nested settings menus.
Worse, because the router's web portal uses a complex client-side hybrid encryption scheme (RSA-1024 + AES-128-CBC via custom SJCL JavaScript), simple curl scripts or standard HTTP requests fail. Most developers resort to heavy, brittle browser automation (like Selenium or Puppeteer).
The Solution
This project fully reverse-engineers the router's RSA + AES cryptographic handshake in pure Python.
It communicates directly with the router's internal endpoints with sub-second response times and zero browser overhead. It then wraps that core engine into three ready-to-use interfaces:
CLI ā Instant terminal commands and bash scripting.
REST API (FastAPI) ā Perfect for Home Assistant, web apps, and webhooks.
MCP Server ā Allows AI Agents (like Antigravity, Claude, Cursor) to control your Wi-Fi through natural language.
šÆ Real-World Use Cases
1. š¤ AI Agent Voice & Chat Control (via MCP)
Connect this project to any MCP-compatible AI assistant (e.g., Claude Desktop, Antigravity IDE, Cursor). You can simply say:
"My child is using too much internet on their phone. Find their device and block it."
"Is the living room TV connected to the Wi-Fi right now?"
"Unblock the iPad."
The AI agent will inspect your connected devices, match the hostname/MAC, and execute the action on your router automatically.
2. š Home Assistant Integration
Integrate your router into Home Assistant using the REST API:
Bedtime Automations: Automatically block children's tablets and gaming consoles at 10:00 PM on school nights.
Presence Detection: Trigger automations when specific phones join or leave the network.
Dashboard Toggles: Create dedicated "Block / Unblock Internet" switch buttons on your Home Assistant Lovelace dashboard.
3. ā” Quick Terminal & Scripting Access (CLI)
Query connected devices or toggle access directly from your terminal or scheduled cron jobs without logging into web portals.
⨠Features
š List Connected Devices ā Hostname, IP address, MAC address, active online status, and connection interface (Ethernet, 2.4GHz 802.11, 5GHz 802.11ac).
š« Block Devices ā Block internet access 24/7 for any device by MAC address via Parental Control rules.
ā Unblock Devices ā Remove blocking rules instantly.
š List Blocked Policies ā View all active access restriction policies and schedules.
š Zero Browser Overhead ā Pure cryptographic authentication via
pycryptodomeandrequests.
šļø Architecture: Three Ways to Interact
Interface | Best For | Entry Point |
CLI | Fast terminal access, cron jobs, shell scripts |
|
REST API | Home Assistant, Node-RED, custom web dashboards |
|
MCP Server | AI agents (Claude, Antigravity, Cursor) |
|
š¦ Installation
# Clone the repository
git clone https://github.com/your-username/routerapi.git
cd routerapi
# Install dependencies
pip install -r requirements.txtDependencies: requests, pycryptodome, python-dotenv, fastapi, uvicorn, mcp
āļø Configuration
Create a .env file in the root directory (or copy from .env.example):
ROUTER_IP=192.168.1.1
ROUTER_USERNAME=admin
ROUTER_PASSWORD=your_router_password
# Optional: REST API Server settings
API_HOST=0.0.0.0
API_PORT=8000š Security Note: The
.envfile is included in.gitignoreso your router credentials will never be committed to source control.
š„ļø 1. CLI Usage
Run commands via the command line interface:
# List all connected/known devices on the network
python -m cli.main list
# List all currently blocked devices
python -m cli.main blocked
# Block a device by MAC address
python -m cli.main block AA:BB:CC:DD:EE:FF
# Block a device with a custom policy name
python -m cli.main block AA:BB:CC:DD:EE:FF --name "Kid_Tablet_Block"
# Unblock a device by MAC address
python -m cli.main unblock AA:BB:CC:DD:EE:FFš 2. REST API Usage (FastAPI)
Start the REST API server:
python -m api.serverThe server runs on http://localhost:8000 (or your configured API_HOST/API_PORT).
Interactive Swagger documentation is available at http://localhost:8000/docs.
Endpoints
Method | Path | Description | Payload |
|
| List all connected devices | ā |
|
| List all blocked devices & policies | ā |
|
| Block a device by MAC |
|
|
| Unblock a device by MAC |
|
|
| Health check & authentication status | ā |
Home Assistant Integration Example
Add the following to your configuration.yaml in Home Assistant to create block/unblock actions:
rest_command:
router_block_device:
url: "http://<ROUTER_API_SERVER_IP>:8000/block"
method: POST
headers:
content-type: "application/json"
payload: '{"mac": "{{ mac }}", "policy_name": "{{ name }}"}'
router_unblock_device:
url: "http://<ROUTER_API_SERVER_IP>:8000/unblock"
method: POST
headers:
content-type: "application/json"
payload: '{"mac": "{{ mac }}"}'
sensor:
- platform: rest
name: "Router Connected Devices"
resource: "http://<ROUTER_API_SERVER_IP>:8000/devices"
value_template: "{{ value_json | length }}"
json_attributes_path: "$"
scan_interval: 60š¤ 3. MCP Server Usage (For AI Agents)
Expose your router tools directly to AI agents using the Model Context Protocol (MCP).
Available MCP Tools
list_devicesā Returns formatted table with all network devices (hostname, IP, MAC, online status).list_blocked_devicesā Returns all active access control policies.block_device(mac_address, policy_name)ā Blocks internet access for a device.unblock_device(mac_address)ā Removes the blocking policy for a device.
MCP Configuration
Add this server to your MCP client config (e.g. claude_desktop_config.json or mcp_config.json):
{
"mcpServers": {
"home_router": {
"command": "python",
"args": ["-m", "mcp_server.server"],
"cwd": "d:/project/routerapi"
}
}
}š 4. Python Library Usage
You can also import and use the client directly in your own Python scripts:
from core import RouterAPI
# Initialize and authenticate
router = RouterAPI(ip_address="192.168.1.1", username="admin", password="admin_password")
if router.login():
# 1. Get all connected devices
devices = router.list_devices()
for d in devices:
print(f"[{'ONLINE' if d['active'] else 'OFFLINE'}] {d['hostname']} ({d['ip']}) - {d['mac']}")
# 2. Block a device
router.block_device("AA:BB:CC:DD:EE:FF", policy_name="StudyTime")
# 3. List blocked devices
blocked = router.list_blocked_devices()
print("Blocked:", blocked)
# 4. Unblock a device
router.unblock_device("AA:BB:CC:DD:EE:FF")
# Clean up session
router.logout()š Project Structure
routerapi/
āāā core/ # Core business logic (the engine)
ā āāā __init__.py # Re-exports RouterAPI and crypto helpers
ā āāā client.py # RouterAPI client class
ā āāā crypto.py # AES-CBC + RSA encryption implementation
ā
āāā cli/ # Terminal interface
ā āāā __init__.py
ā āāā main.py # Argparse CLI entry point
ā
āāā api/ # REST API interface
ā āāā __init__.py
ā āāā server.py # FastAPI server with CORS & Pydantic models
ā
āāā mcp_server/ # Model Context Protocol interface
ā āāā __init__.py
ā āāā server.py # MCP server exposing router tools to AI
ā
āāā .env # Credentials (git-ignored)
āāā .env.example # Template environment configuration
āāā .gitignore
āāā requirements.txt # Project dependencies
āāā Readme.md # Project documentationā ļø Notes & Disclaimer
Session Expiry: Router sessions naturally time out after inactivity. The API and MCP servers automatically manage re-authentication on subsequent calls.
Parental Control: Blocking is performed by enabling Parental Control / Access Control rules that restrict target MAC addresses 24/7 across all days of the week (
00:00-23:59).Compatibility: Tested on Nokia G-2425G-A GPON Home Gateway (Airtel Xstream Fiber). May also work with similar Nokia ONT models with identical firmware interfaces.
š License
This project is licensed under the MIT License - see the LICENSE file for details.
This server cannot be installed
Maintenance
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
Search 200+ UnoRouter models (most free), check pricing, and chat through one key
AI-powered browser automation ā navigate, click, fill forms, and extract data from any website.
Reliable web access for AI agents: smart HTTP, rotating proxies, and full-browser rendering.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/surajnai567/airtel-router-api'
If you have feedback or need assistance with the MCP directory API, please join our Discord server