loading…
Search for a command to run...
loading…
Enables interaction with Ubiquiti UISP API for managing network devices, sites, and monitoring through dynamically generated read-only tools.
Enables interaction with Ubiquiti UISP API for managing network devices, sites, and monitoring through dynamically generated read-only tools.
A Model Context Protocol (MCP) server for interacting with UISP (Ubiquiti Internet Service Provider) API. This server dynamically loads all available endpoints from the UISP swagger specification and provides configurable access control through blacklisting.
cd uisp_api_mcp
uv sync
cd uisp_api_mcp
pip install -e .
Create a .env file in the project root:
# Required
UISP_BASE_URL=https://your-uisp-instance.com
UISP_API_TOKEN=your-api-token
# Optional (with defaults)
UISP_API_TIMEOUT=30.0
UISP_API_RETRY_ATTEMPTS=3
UISP_API_RETRY_DELAY=1.0
UISP_DEFAULT_PAGE_SIZE=25
UISP_LOG_LEVEL=INFO
The server uses etc/blacklist.yaml to control which endpoints are exposed. By default, all modifying operations (POST, PUT, DELETE, PATCH) and sensitive endpoints are blacklisted.
# Methods to exclude (blocks all endpoints using these HTTP methods)
methods:
- POST # Create operations
- PUT # Update operations
- DELETE # Delete operations
- PATCH # Partial update operations
# Tags to exclude (blocks all endpoints with these tags)
tags:
- Authorization
- Users
- Server
# ... etc
# Path patterns to exclude (regex patterns)
paths:
- .*login.*
- .*password.*
- .*auth.*
# ... etc
With the default configuration, only GET (read-only) operations are exposed.
Add to your Claude Desktop configuration:
{
"mcpServers": {
"uisp": {
"command": "uv",
"args": ["--directory", "/path/to/uisp_api_mcp", "run", "uisp-api-mcp"],
"env": {
"UISP_BASE_URL": "https://your-uisp-instance.com",
"UISP_API_TOKEN": "your-api-token"
}
}
}
}
# With UV
uv run uisp-api-mcp
# With Python
python -m uisp_api_mcp
The server dynamically generates tools from the UISP swagger specification. With the default blacklist (blocking all POST, PUT, DELETE, PATCH methods), approximately 120+ read-only tools are available, including:
sites, sites_id, sites_search, sites_trafficdevices, devices_id, devices_id_detail, devices_id_statisticslogs, outages, nms_statistics, nms_summarydatalinks, datalinks_id, devices_id_interfacesnms_info, nms_version, nms_enumsTools are named based on the API endpoint path and HTTP method:
/sites → sites/sites/{id} → sites_id/devices/{id}/detail → devices_id_detail/sites → sites_post (if not blacklisted)/sites/{id} → sites_id_put (if not blacklisted)/sites/{id} → sites_id_delete (if not blacklisted)All tools preserve the original API parameter types:
{id}) are automatically handledTool: sites
Parameters:
- type_: "site" # Available values: site, endpoint, client, subscriber
- ucrm: true # Only sites bound with CRM
Tool: sites_id
Parameters:
- id_: "9ef86767-fd8d-487c-8c97-77f763c5a99a"
- ucrmDetails: true
Tool: devices
Parameters:
- siteId: "site-uuid"
- type_: ["erouter", "eswitch"] # Device types
- role: ["router", "switch"] # Device roles
Tool: devices_id_statistics
Parameters:
- id_: "device-uuid"
- interval: "hour"
- start: "2024-01-01T00:00:00Z"
- period: "86400000" # 24 hours in milliseconds
The server includes comprehensive error handling:
uisp_api_mcp/
├── pyproject.toml
├── README.md
├── .env
├── etc/
│ ├── swagger.json # UISP API specification
│ └── blacklist.yaml # Endpoint blacklist configuration
└── src/
└── uisp_api_mcp/
├── __init__.py
├── __main__.py
├── client.py # HTTP client with retry logic
├── exceptions.py # Custom exception types
├── server.py # Dynamic MCP server
├── settings.py # Configuration management
└── swagger_tools.py # Swagger parsing and tool generation
etc/swagger.json at startupetc/blacklist.yaml (methods, tags, paths)To modify which endpoints are exposed:
etc/blacklist.yamlTo update with a newer UISP API version:
etc/swagger.json with the latest versionMIT License - see LICENSE file for details.
For UISP API documentation, visit: https://help.ui.com/hc/en-us/articles/115002943188-UISP-API
For issues with this MCP server, please open an issue on GitHub.
Выполни в терминале:
claude mcp add uisp-api-mcp-server -- npx Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории development