Model Context Protocol (MCP) server for Juniper PTX chassis via SSH only (no NETCONF/RPC). Commands are executed over SSH and restricted by a regex allowlist.
- SSH-only — All PTX commands run over SSH; no PyEZ/NETCONF.
- Central config — Enable/disable tools and define allowed CLI commands in
config/tools.yml. - Regex allowlist — Only commands in
allowed_ssh_commandsare run (e.g.show .*allows allshowcommands). - Docker — Consistent deployment.
- Copy
.env.exampleto.envand setPTX_HOST,PTX_USER,PTX_PASSWORD(orPTX_SSH_KEY). - Edit
config/tools.ymlto list allowed tools andallowed_ssh_commands(e.g.show .*,request .*). - Run:
docker compose up -d - MCP endpoint:
http://localhost:8001/mcp(HTTP Stream transport)
Cursor / MCP clients — Add to your MCP config:
{
"mcpServers": {
"ptx-mcp": {
"url": "http://localhost:8001/mcp",
"transport": "http"
}
}
}- tools — Enable/disable each tool by name (
run_cli,read_var_log_messages_window). - allowed_ssh_commands — List of regex patterns. Only SSH commands matching one of these (from the start) are executed. Examples:
show .*— allow any command starting withshowrequest .*— allow any command starting withrequest
All tools use the SSH layer (no NETCONF). Enable/disable each in config/tools.yml.
- run_cli — Run a single CLI command; must match
allowed_ssh_commandsin config. - get_facts — Device facts (version, model, serial, etc.) via
show versionandshow system information. - get_configuration — Current config (text or set format) via
show configuration. - edit_configuration — Load and commit configuration (set or merge).
- rollback_configuration — Rollback to a previous config (e.g. rollback 0).
- add_software — Install software package via
request system software add(path or URL). - read_var_log_messages_window — Read local
/var/logfiles (e.g. in the container) within a time window.
├── server.py # MCP server entrypoint
├── config/
│ └── tools.yml # allowed_tools + allowed_ssh_commands (regex)
├── tools/ # MCP tools (run_cli, read_var_log_messages_window, config_loader)
├── docs/ # Documentation
├── docker-compose.yml
├── Dockerfile
└── requirements.txt
| Doc | Description |
|---|---|
| docs/getting-started.md | Services, Open WebUI, env vars, troubleshooting |
| docs/config.md | config/tools.yml: allowed_tools, allowed_ssh_commands |
| docs/remote-access.md | Remote access and MCP session flow |
| docs/architecture.md | Architecture and data flow |
| docs/design.md | Design decisions |
- Docker & Docker Compose
- Juniper PTX reachable via SSH
- Network access to PTX management interface
- Container restarts —
docker compose logs; verify.envand thatconfig/tools.ymlexists and is valid YAML. - Command not allowed — Ensure the command matches one of the
allowed_ssh_commandspatterns inconfig/tools.yml. - Auth failures — Check
PTX_HOST,PTX_USER,PTX_PASSWORD(orPTX_SSH_KEY).
MIT