Skip to content

Repository files navigation

hier-config-mcp

An MCP (Model Context Protocol) server that exposes hier_config's network configuration comparison and remediation capabilities to AI assistants like Claude.

Features

  • Configuration Parsing: Parse network device configurations into hierarchical structures
  • Configuration Comparison: Compare running vs intended configurations
  • Remediation Generation: Generate commands to bring devices into compliance
  • Rollback Generation: Generate commands to revert changes
  • Future State Prediction: Predict configuration state after applying changes
  • Unified Diff: Generate diffs between configurations

Supported Platforms

  • CISCO_IOS - Cisco IOS (classic IOS for routers and switches)
  • CISCO_NXOS - Cisco NX-OS (Nexus switches)
  • CISCO_XR - Cisco IOS-XR (carrier-grade routers)
  • ARISTA_EOS - Arista EOS (data center switches)
  • ARUBA_AOSCX - Aruba AOS-CX
  • HP_COMWARE5 - HP Comware 5
  • HP_PROCURVE - HP ProCurve
  • HUAWEI_VRP - Huawei VRP
  • JUNIPER_JUNOS - Juniper Junos
  • NOKIA_SRL - Nokia SR Linux
  • VYOS - VyOS
  • FORTINET_FORTIOS - Fortinet FortiOS
  • GENERIC - Platform-agnostic parsing

Installation

# Clone the repository
git clone https://github.com/jtdub/hier-config-mcp.git
cd hier-config-mcp

# Install dependencies with Poetry
poetry install

Usage

Running the Server

# Run the MCP server
poetry run hier-config-mcp

# Or use the MCP development server with inspector
poetry run mcp dev hier_config_mcp/server.py

Claude Desktop Configuration

Add to your Claude Desktop configuration file (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "hier-config": {
      "command": "poetry",
      "args": [
        "-C",
        "/path/to/hier-config-mcp",
        "run",
        "hier-config-mcp"
      ]
    }
  }
}

Available Tools

list_platforms

List all supported network platforms.

parse_config

Parse network device configuration text into a hierarchical format.

Parameters:

  • platform: Network platform name (e.g., "CISCO_IOS")
  • config: Configuration text to parse

compare_configs

Compare running configuration against intended configuration and generate both remediation and rollback commands.

Parameters:

  • platform: Network platform name
  • running_config: Current device configuration
  • intended_config: Desired configuration

Returns: Object with remediation and rollback commands

generate_remediation

Generate commands to transform running config to intended config.

Parameters:

  • platform: Network platform name
  • running_config: Current configuration
  • intended_config: Target configuration

generate_rollback

Generate commands to revert from intended config back to running config.

Parameters:

  • platform: Network platform name
  • running_config: Original configuration
  • intended_config: Configuration to rollback from

predict_config

Predict the configuration state after applying changes.

Parameters:

  • platform: Network platform name
  • current_config: Current configuration
  • change_config: Changes to apply

unified_diff_configs

Generate a unified diff between two configurations.

Parameters:

  • platform: Network platform name
  • config_a: First configuration
  • config_b: Second configuration
  • label_a: Label for first config (optional)
  • label_b: Label for second config (optional)

Documentation

Full documentation — user, administrator, developer, and maintainer guides — lives in docs/ and is built with mkdocs:

poetry run mkdocs serve

Development

This repo follows the same development standards as hier_config: ruff (select = ["ALL"], preview, line length 88), mypy strict, pyright strict, pylint, yamllint, and flynt, with a 95% test coverage floor. All checks run in parallel via scripts/build.py.

Docker Development Environment

A Docker-based workflow modeled on Nautobot app development is available via invoke — see docs/dev/docker-development.md:

invoke build     # build the dev image
invoke start     # start the dev container
invoke tests     # run everything CI runs, inside the container
invoke destroy   # tear down

Lint and Test

# Full lint + test suite (what CI runs)
poetry run python scripts/build.py lint-and-test

# Lint only
poetry run python scripts/build.py lint

# Auto-fix formatting and fixable lint findings
poetry run python scripts/build.py lint --fix

# Tests with coverage (95% required)
poetry run python scripts/build.py pytest --coverage

# Tests directly
poetry run pytest

Pre-commit Hook

# One-time setup; the hook runs the full lint suite before each commit
poetry run pre-commit install

Releasing

Releases are driven by two GitHub Actions workflows (admin permission required):

  1. Run the prepare release workflow (Actionsprepare releaseRun workflow), picking the branch to release from in the branch dropdown and the version bump type (major, minor, patch, or prerelease). It bumps the version with poetry version, opens a chore(release): prepare X.Y.Z PR against the chosen branch, and creates a draft GitHub release tagged vX.Y.Z.
  2. Merge the release PR.
  3. Publish the draft release. Publishing triggers the release workflow, which builds and publishes the package to PyPI automatically (poetry publish --build).

Project Structure

hier-config-mcp/
├── pyproject.toml
├── README.md
├── mkdocs.yml
├── docs/
│   ├── index.md
│   ├── user/
│   ├── admin/
│   └── dev/
├── hier_config_mcp/
│   ├── __init__.py
│   ├── py.typed
│   └── server.py
└── tests/
    ├── __init__.py
    └── test_server.py

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages