Labsco
automateyournetwork logo

pyATS

โ˜… 75

from automateyournetwork

Interact with network devices using Cisco's pyATS and Genie libraries for model-driven automation.

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedFreeNeeds API keys

pyATS MCP Server

Trust Score

Available on CodeGuilds

MCP server that wraps Cisco pyATS and Genie, letting AI agents (Claude, LangGraph, etc.) run show commands, apply configuration, and query network state over STDIO using JSON-RPC 2.0.

All communication is via STDIN/STDOUT โ€” no HTTP ports, no REST endpoints.


Docker

Build

Copy & paste โ€” that's it
docker build -t pyats-mcp-server .

Run (pass .env directly)

Copy & paste โ€” that's it
docker run -i --rm \
  --env-file /absolute/path/to/.env \
  -v /absolute/path/to/testbed.yaml:/app/testbed.yaml \
  pyats-mcp-server

MCP client config (Docker)

Copy & paste โ€” that's it
{
  "mcpServers": {
    "pyats": {
      "command": "docker",
      "args": [
        "run", "-i", "--rm",
        "--env-file", "/absolute/path/to/.env",
        "-v", "/absolute/path/to/testbed.yaml:/app/testbed.yaml",
        "pyats-mcp-server"
      ]
    }
  }
}

MCP client config (local Python)

Copy & paste โ€” that's it
{
  "mcpServers": {
    "pyats": {
      "command": "python3",
      "args": ["-u", "/path/to/pyats_mcp_server.py"],
      "env": {
        "PYATS_TESTBED_PATH": "/absolute/path/to/testbed.yaml"
      }
    }
  }
}

Available Tools

ToolDescription
pyats_list_devicesList all devices in the testbed
pyats_search_devicesFuzzy-search devices by name or alias
pyats_run_show_commandRun a validated show command; returns parsed JSON or raw output
pyats_run_show_command_on_multiple_devicesRun a show command across multiple devices concurrently
pyats_ping_from_network_deviceExecute a ping from a network device
pyats_run_linux_commandRun a command on a Linux host
pyats_configure_deviceApply configuration commands with safety guardrails
pyats_configure_devices_multiApply configuration across multiple devices concurrently
pyats_configure_with_diffApply config and return a before/after diff
pyats_rollback_configRoll back to the last saved configuration snapshot
pyats_device_healthSnapshot CPU, memory, interfaces, and routing state
pyats_get_neighborsRetrieve CDP/LLDP neighbors
pyats_find_interface_by_ipFind which interface owns a given IP address
pyats_run_dynamic_testExecute a sandboxed pyATS test script
pyats_get_operation_logRetrieve the in-memory operation log

Security

  • Show commands are validated โ€” pipes, redirects, and dangerous keywords are blocked
  • Config changes are checked for reload, erase, write erase, delete, format
  • Dynamic test scripts run in a restricted sandbox (banned imports: os, sys, subprocess, etc.)
  • All credentials come from .env โ€” never stored in the testbed file or source code

Project Structure

Copy & paste โ€” that's it
.
โ”œโ”€โ”€ pyats_mcp_server.py      # MCP server
โ”œโ”€โ”€ test_pyats_mcp_server.py # Unit tests (85 tests)
โ”œโ”€โ”€ Dockerfile               # Container definition
โ”œโ”€โ”€ requirements.txt         # Pinned runtime dependencies
โ”œโ”€โ”€ requirements-dev.txt     # Dev/test dependencies
โ”œโ”€โ”€ pyproject.toml           # Tool config (black, isort, pytest, mypy)
โ”œโ”€โ”€ .env.example             # Configuration template โ€” copy to .env
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ LICENSE
โ””โ”€โ”€ CONTRIBUTING.md

Development

Copy & paste โ€” that's it
# Install dev dependencies with uv
uv venv .venv && uv pip install -r requirements-dev.txt

# Run tests
.venv/bin/python -m pytest

# Lint and format
.venv/bin/black .
.venv/bin/isort .
.venv/bin/flake8 . --max-line-length=100