elv2mcp
by AMPVIP
README.md
# elv2mcp
> Universal MCP adapter for Extra Low Voltage (ELV) systems β connect Hikvision, Dahua, and other security devices to AI agents via the Model Context Protocol.
[](https://www.python.org/downloads/)
[](https://opensource.org/licenses/MIT)
[](https://modelcontextprotocol.io/)
---
## π― What is elv2mcp?
`elv2mcp` is a **Model Context Protocol (MCP) server** that bridges the gap between AI agents (Claude, GPT, Cursor, etc.) and physical security systems.
Today, thousands of ELV systems β cameras, NVRs, access control, alarms β sit isolated from modern AI workflows. They speak proprietary protocols (ISAPI, CGI, SDK) that LLMs cannot understand. `elv2mcp` translates these into **typed, safe, auditable MCP tools** that any AI agent can call.
**Think of it as a "USB-C for physical security"** β one adapter, many vendors, safe by default.
---
## β¨ Features
- **Multi-vendor support** β Hikvision (ISAPI), Dahua (CGI API), with a pluggable architecture for adding more (Bosch, Bolid, Axis, etc.)
- **Read-only by default** β snapshots, device info, and channel lists work out of the box. Write operations (PTZ, reboot) require explicit opt-in.
- **Typed tools** β AI agents call `elv_get_snapshot(device_name, channel)` instead of guessing raw HTTP requests.
- **Digest authentication** β native support for Hikvision and Dahua auth schemes.
- **Secure credentials** β never hardcoded. Loaded from environment variables or a `.env` file.
- **FastMCP-powered** β built on [FastMCP](https://github.com/jlowin/fastmcp), with automatic schema validation and stdio transport.
---
## π Quick Start
### 1. Install
```bash
pip install fastmcp httpx
```
Or clone and install locally:
```bash
git clone https://github.com/AMPVIP/elv2mcp.git
cd elv2mcp
pip install -e .
```
### 2. Configure your devices
Set the `ELV2MCP_DEVICES` environment variable with a JSON map:
```bash
export ELV2MCP_DEVICES='{
"cam1": {
"ip": "192.168.1.100",
"username": "admin",
"password": "yourpass",
"vendor": "hikvision",
"port": 80
},
"cam2": {
"ip": "192.168.1.101",
"username": "admin",
"password": "yourpass",
"vendor": "dahua"
}
}'
```
### 3. Run the server
```bash
python server.py
```
The server runs on **stdio** and waits for MCP client connections.
---
## π Connect to Claude Desktop
Add this to your `claude_desktop_config.json`:
```json
{
"mcpServers": {
"elv2mcp": {
"command": "/path/to/python",
"args": ["/path/to/elv2mcp/server.py"],
"env": {
"ELV2MCP_DEVICES": "{\"cam1\": {\"ip\": \"192.168.1.100\", \"username\": \"admin\", \"password\": \"yourpass\", \"vendor\": \"hikvision\"}}"
}
}
}
}
```
Restart Claude Desktop β the `elv_*` tools will appear in the interface.
---
## π οΈ Available Tools
| Tool | Description | Hikvision | Dahua |
|------|-------------|-----------|-------|
| `elv_list_devices` | List all configured devices | β
| β
|
| `elv_get_device_info` | Get model, serial, firmware | β
| β
|
| `elv_get_snapshot` | Capture JPEG from a channel | β
| β
|
| `elv_list_channels` | Enumerate video channels | β
| β οΈ MVP stub |
### Example prompts for AI agents
Once connected, you can ask Claude:
- *"List all my cameras and tell me which ones are online."*
- *"Take a snapshot from cam1 and describe what you see."*
- *"What firmware version is running on cam2?"*
---
## π Security
`elv2mcp` is designed with a **paranoid-by-default** philosophy:
- **Read-only by default** β all write operations (PTZ, reboot, config changes) are disabled unless `allow_write: true` is set per device.
- **No hardcoded credentials** β use environment variables or a `.env` file (never commit it).
- **Digest auth** β supports the auth schemes used by Hikvision and Dahua.
- **Audit-ready** β every tool call can be logged (coming soon).
- **Network isolation** β the server only talks to devices you explicitly configure.
> β οΈ **Never expose this server to the public internet.** Run it on a trusted LAN or VPN.
---
## π§© Architecture
```text
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β AI Agent ββββββββΊβ elv2mcp ββββββββΊβ Hikvision β
β (Claude, GPT) β MCP β FastMCP β HTTP β Dahua β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β
βββ HikvisionProvider (ISAPI)
βββ DahuaProvider (CGI API)
βββ [Future: Bosch, Bolid, Axis]
```
The provider pattern makes it trivial to add new vendors β implement `get_device_info`, `get_snapshot`, and `list_channels` for the new protocol.
---
## πΊοΈ Roadmap
- [x] Hikvision ISAPI support (device info, snapshot, channels)
- [x] Dahua CGI API support (device info, snapshot)
- [ ] PTZ control (Hikvision + Dahua) β behind `allow_write` flag
- [ ] Event stream / motion detection (Hikvision `alertStream`)
- [ ] Bosch BVMS provider
- [ ] Bolid provider
- [ ] Mock server for testing without real hardware
- [ ] Audit logging (JSON lines)
- [ ] MCP Registry publication
---
## π€ Contributing
Contributions are welcome β especially new vendor providers. To add a vendor:
1. Create `providers/your_vendor.py` with a class implementing `get_device_info`, `get_snapshot`, `list_channels`.
2. Register it in `server.py`'s dispatch logic.
3. Add tests and documentation.
---
## π License
MIT License β see [LICENSE](LICENSE) for details.
---
## π Related Projects
- [Model Context Protocol](https://modelcontextprotocol.io/) β the standard this project implements
- [FastMCP](https://github.com/jlowin/fastmcp) β Python framework for building MCP servers
- [legacy2mcp](https://github.com/legacy2mcp) β MCP adapter for SOAP/WSDL systems
- [plctap](https://github.com/plctap) β MCP adapter for industrial PLCs
---
## π€ Author
**Andrey Pavlushov** β Low Current Engineer with 20+ years of experience in ELV systems, networking, and security.
- GitHub: [@AMPVIP](https://github.com/AMPVIP)
- Portfolio: [ampvip.github.io](https://ampvip.github.io)
---
*Built with the belief that the physical world deserves first-class AI tooling.*
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo issues