MCP Hub
Back to servers

Junos MCP

MCP server for Juniper Networks device operations via junos-ops

Registry
Updated
Apr 5, 2026

Quick Install

uvx junos-mcp

junos-mcp

English | 日本語

MCP (Model Context Protocol) server for junos-ops.

Exposes Juniper Networks device operations to MCP-compatible AI assistants (Claude Desktop, Claude Code, etc.) via STDIO transport. While junos-ops is the CLI tool for humans, junos-mcp is the AI-facing interface to the same powerful engine.

Features

Device Information

ToolDescriptionConnection
get_device_factsGet basic device information (model, hostname, serial, version)Yes
get_versionGet JUNOS version with upgrade statusYes
get_router_listList all available routers from config.iniNo

CLI Command Execution

ToolDescriptionConnection
run_show_commandRun a single CLI show commandYes
run_show_commandsRun multiple CLI commands in a single sessionYes
run_show_command_batchRun a command on multiple devices in parallelYes

Configuration Management

ToolDescriptionConnection
get_configGet device configuration (text/set/xml format)Yes
get_config_diffShow config diff against a rollback versionYes
push_configPush config with commit confirmed + health checkYes

Upgrade Operations

ToolDescriptionConnection
check_upgrade_readinessCheck if device is ready for upgradeYes
compare_versionCompare two JUNOS version stringsNo
get_package_infoGet model-specific package file and hashNo
list_remote_filesList files on remote device pathYes
copy_packageCopy firmware package via SCP with checksumYes
install_packageInstall firmware with pre-flight checksYes
rollback_packageRollback to previous package versionYes
schedule_rebootSchedule device reboot at specified timeYes

Diagnostics

ToolDescriptionConnection
collect_rsiCollect RSI/SCF with model-specific timeoutsYes
collect_rsi_batchCollect RSI/SCF from multiple devices in parallelYes

Safety by Design

All destructive operations (push_config, copy_package, install_package, rollback_package, schedule_reboot) default to dry-run mode (dry_run=True). The AI assistant must explicitly set dry_run=False to make changes.

push_config provides additional safety features not found in other Junos MCP servers:

  • commit confirmed with configurable timeout (auto-rollback if not confirmed)
  • Fallback health check after commit (ping, NETCONF uptime probe, or any CLI command)
  • Automatic rollback if health check fails (commit is not confirmed, timer expires)

Requirements

Installation

pip install junos-mcp

Or for development:

git clone https://github.com/shigechika/junos-mcp.git
cd junos-mcp
python3 -m venv .venv
. .venv/bin/activate
pip install -e ".[test]"

Configuration

This server uses the same config.ini as junos-ops. See junos-ops README for details.

Each tool accepts an optional config_path parameter. If omitted, the default search order is used:

  1. Environment variable JUNOS_OPS_CONFIG
  2. ./config.ini
  3. ~/.config/junos-ops/config.ini

Usage

Claude Code

Register the MCP server with claude mcp add:

claude mcp add junos-mcp \
  -e JUNOS_OPS_CONFIG=~/.config/junos-ops/config.ini \
  -- python -m junos_mcp

The --scope (-s) option controls where the configuration is stored:

ScopeDescriptionConfig location
local (default)Current project, current user only~/.claude.json
projectCurrent project, shared with team.mcp.json in project root
userAll projects, current user only~/.claude.json

Claude Desktop

Add to Claude Desktop config file:

OSConfig file
macOS~/Library/Application Support/Claude/claude_desktop_config.json
Windows%APPDATA%\Claude\claude_desktop_config.json
Linux~/.config/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "junos-mcp": {
      "command": "python",
      "args": ["-m", "junos_mcp"],
      "env": {
        "JUNOS_OPS_CONFIG": "/path/to/config.ini"
      }
    }
  }
}

Restart Claude Desktop after editing.

Remote Access with OAuth (via mcp-stdio)

junos-mcp supports Streamable HTTP transport, enabling remote access from Claude Desktop or Claude Code through mcp-stdio as an OAuth proxy.

graph TB
    A[junos-mcp<br/>remote server] <-- "OAuth 2.1 + HTTPS" --> B[mcp-stdio<br/>proxy]
    B <-- "STDIO" --> C[Claude Desktop<br/>Claude Code]

Step 1: Start junos-mcp with Streamable HTTP on the remote server

JUNOS_OPS_CONFIG=~/.config/junos-ops/config.ini \
  python -m junos_mcp --transport streamable-http

The server listens on http://localhost:8000/mcp by default.

Step 2: Register mcp-stdio as the MCP server on your local machine

claude mcp add junos-mcp -- mcp-stdio https://your-server:8000/mcp

mcp-stdio handles OAuth 2.1 authentication (RFC 8414 discovery, RFC 7591 dynamic client registration, PKCE) and relays STDIO ↔ Streamable HTTP.

See mcp-stdio README for detailed configuration including OAuth provider setup.

MCP Inspector (development)

mcp dev junos_mcp/server.py

Testing

pytest tests/ -v

71 tests covering all 19 tools, helper functions, and edge cases.

Architecture

stdout Capture

junos-ops functions use print() for output. Since MCP STDIO transport uses stdout for JSON-RPC communication, all print() output is captured via contextlib.redirect_stdout and returned as tool results.

Global State Initialization

junos-ops uses common.args and common.config as global variables. The MCP server initializes these using the same pattern as the test fixtures in junos-ops (conftest.py).

Parallel Execution

Batch tools (run_show_command_batch, collect_rsi_batch) use ThreadPoolExecutor via junos-ops common.run_parallel() with configurable max_workers.

License

Apache License 2.0

Reviews

No reviews yet

Sign in to write a review