How juniper/junos-mcp-server works
Junos MCP Server exposes network-device operations as MCP tools: a client request is dispatched to a registered handler, which performs the requested operation against configured Junos devices and returns content to the client. The product also supports configuration templating and changes, operational-command guardrails, device facts, and authenticated HTTP access with token management. Core server and tool behavior is concentrated in jmcp.py; the excerpts do not show every handler’s wiring, so uncertain links are omitted.
Main entry points: jmcp.py SSH connection pool · devices-template.json Device mapping · config.py Device config validation · jmcp_token_manager.py Token manager
Components 16
MCP access
- MCP server
jmcp.py - Tool registry
jmcp.py
Device tools
- CLI and config reads
jmcp.py - Config changes
jmcp.py - Template operations
jmcp.py - Device facts
jmcp.py - Command guardrails
jmcp.py - Other Junos tools
jmcp.py
Device access
- Device mapping
devices-template.json - Device config validation
utils/config.py - SSH connection pool
jmcp.py
Authentication
- HTTP auth middleware
jmcp.py - Token manager
jmcp_token_manager.py - Token store
Other components
- MCP client
- Junos devices
Connections 15
- MCP client → MCP server: sends MCP requests
- MCP server → HTTP auth middleware: checks HTTP requests
- HTTP auth middleware → Token store: validates tokens
- Token manager → Token store: manages tokens
- MCP server → Tool registry: dispatches tools
- MCP server → Device mapping: loads mapping
- Device mapping → Device config validation: provides device settings
- CLI and config reads → SSH connection pool: runs device commands
- Config changes → SSH connection pool: applies configuration
- Template operations → SSH connection pool: uses device connections
- Device facts → SSH connection pool: gathers device facts
- Command guardrails → CLI and config reads: checks commands
- SSH connection pool → Device config validation: prepares connection parameters
- SSH connection pool → Junos devices: opens device sessions
- Other Junos tools → SSH connection pool: uses device sessions