pyATS MCP Server

pyATS MCP Server

Model-driven STDIO server for safe, structured network automation with Cisco devices.

50
Stars
15
Forks
50
Watchers
0
Issues
Implements a Model Context Protocol (MCP) server that wraps Cisco pyATS and Genie for secure, structured interaction with network devices. Provides JSON-RPC 2.0 communication over standard input/output, enabling integrated control through model-driven tools for discovery, command execution, configuration, and logging. Built for containerized environments and workflow tools like LangGraph, it emphasizes safety through input validation and command restrictions.

Key Features

MCP implementation over STDIO (stdin/stdout)
Structured interaction with Cisco IOS and NX-OS devices
JSON-RPC 2.0 protocol support
Safe execution of validated show, ping, and configuration commands
Pydantic-based input validation
Parsed or raw output from device commands
Container-ready (Docker) deployment
Integration with LangGraph pipelines
Prevention of unsafe command execution
Well-defined tools for discovery and controlled device management

Use Cases

Secure automation of Cisco network devices in embedded systems
Integration with AI agent workflows through process I/O
Containerized network operations in cloud or edge deployments
LangGraph-based orchestration of network management tasks
Safe remote execution of validated network CLI commands
Automated device discovery and configuration in CI/CD pipelines
Fetching and parsing network logs for monitoring and analytics
Minimizing attack surface by avoiding REST or HTTP interfaces
Portable tool deployment in secure, restricted environments
Model-driven interaction for auditing or compliance scenarios

README

pyATS MCP Server

Trust Score

This project implements a Model Context Protocol (MCP) Server that wraps Cisco pyATS and Genie functionality. It enables structured, model-driven interaction with network devices over STDIO using the JSON-RPC 2.0 protocol.

🚨 This server does not use HTTP or SSE. All communication is done via STDIN/STDOUT (standard input/output), making it ideal for secure, embedded, containerized, or LangGraph-based tool integrations.

πŸ”§ What It Does

Connects to Cisco IOS/NX-OS devices defined in a pyATS testbed

Supports safe execution of validated CLI commands (show, ping)

Allows controlled configuration changes

Returns structured (parsed) or raw output

Exposes a set of well-defined tools via tools/discover and tools/call

Operates entirely via STDIO for minimal surface area and maximum portability

πŸš€ Usage

  1. Set your testbed path
bash

export PYATS_TESTBED_PATH=/absolute/path/to/testbed.yaml

  1. Run the server

Continuous STDIO Mode (default)

bash

python3 pyats_mcp_server.py

Launches a long-running process that reads JSON-RPC requests from stdin and writes responses to stdout.

One-Shot Mode

bash

echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/discover"}' | python3 pyats_mcp_server.py --oneshot

Processes a single JSON-RPC request and exits.

πŸ“¦ Docker Support

Build the container

bash

docker build -t pyats-mcp-server .

Run the container (STDIO Mode)

bash
docker run -i --rm \
  -e PYATS_TESTBED_PATH=/app/testbed.yaml \
  -v /your/testbed/folder:/app \
  pyats-mcp-server

🧠 Available MCP Tools

Tool Description

run_show_command Executes show commands safely with optional parsing

run_ping_command Executes ping tests and returns parsed or raw results

apply_configuration Applies safe configuration commands (multi-line supported)

learn_config Fetches running config (show run brief)

learn_logging Fetches system logs (show logging last 250)

All inputs are validated using Pydantic schemas for safety and consistency.

πŸ€– LangGraph Integration

Add the MCP server as a tool node in your LangGraph pipeline like so:

python

("pyats-mcp", ["python3", "pyats_mcp_server.py", "--oneshot"], "tools/discover", "tools/call")

Name: pyats-mcp

Command: python3 pyats_mcp_server.py --oneshot

Discover Method: tools/discover

Call Method: tools/call

STDIO-based communication ensures tight integration with LangGraph’s tool invocation model without opening HTTP ports or exposing REST endpoints.

πŸ“œ Example Requests

Discover Tools

json

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/discover"
}

Run Show Command

json

{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/call",
  "params": {
    "name": "run_show_command",
    "arguments": {
      "device_name": "router1",
      "command": "show ip interface brief"
    }
  }
}

πŸ”’ Security Features

Input validation using Pydantic

Blocks unsafe commands like erase, reload, write

Prevents pipe/redirect abuse (e.g., | include, >, copy, etc.)

Gracefully handles parsing fallbacks and errors

πŸ“ Project Structure

graphql

.
β”œβ”€β”€ pyats_mcp_server.py     # MCP server with JSON-RPC and pyATS integration
β”œβ”€β”€ Dockerfile              # Docker container definition
β”œβ”€β”€ testbed.yaml            # pyATS testbed (user-provided)
└── README.md               # This file

πŸ“₯ MCP Server Config Example (pyATS MCP via Docker)

To run the pyATS MCP Server as a container with STDIO integration, configure your mcpServers like this:

json
{
  "mcpServers": {
    "pyats": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "PYATS_TESTBED_PATH",
        "-v",
        "/absolute/path/to/testbed/folder:/app",
        "pyats-mcp-server"
      ],
      "env": {
        "PYATS_TESTBED_PATH": "/app/testbed.yaml"
      }
    }
  }
}

json
{
  "servers": { 
    "pyats": {
      "type": "stdio",
      "command": "python3",
      "args": [
        "-u",
        "/Users/johncapobianco/pyATS_MCP/pyats_mcp_server.py"
      ],
      "env": {
        "PYATS_TESTBED_PATH": "/Users/johncapobianco/pyATS_MCP/testbed.yaml"
      }
  }
}

🧾 Explanation: command: Uses Docker to launch the containerized pyATS MCP server

args:

-i: Keeps STDIN open for communication

--rm: Automatically removes the container after execution

-e: Injects the environment variable PYATS_TESTBED_PATH

-v: Mounts your local testbed directory into the container

pyats-mcp-server: Name of the Docker image

env:

Sets the path to the testbed file inside the container (/app/testbed.yaml)

✍️ Author

John Capobianco

Product Marketing Evangelist, Selector AI

Author, Automate Your Network

Let me know if you’d like to add:

A sample LangGraph graph config

Companion client script

CI/CD integration (e.g., GitHub Actions)

Happy to help!

The testbed.yaml file works with the Cisco DevNet Cisco Modeling Labs (CML) Sandbox!

Star History

Star History Chart

Repository Owner

Repository Details

Language Python
Default Branch main
Size 50 KB
Contributors 2
MCP Verified Nov 11, 2025

Programming Languages

Python
90.3%
Dockerfile
9.7%

Tags

Join Our Newsletter

Stay updated with the latest AI tools, news, and offers by subscribing to our weekly newsletter.

We respect your privacy. Unsubscribe at any time.

Related MCPs

Discover similar Model Context Protocol servers

  • MCP Shell Server

    MCP Shell Server

    A secure, configurable shell command execution server implementing the Model Context Protocol.

    MCP Shell Server provides secure remote execution of whitelisted shell commands via the Model Context Protocol (MCP). It supports standard input, command output retrieval, and enforces strict safety checks on command operations. The tool allows configuration of allowed commands and execution timeouts, and can be integrated with platforms such as Claude.app and Smithery. With robust security assessments and flexible deployment methods, it facilitates controlled shell access for AI agents.

    • ⭐ 153
    • MCP
    • tumf/mcp-shell-server
  • POX MCP Server

    POX MCP Server

    Model Context Protocol server for SDN management via the POX controller.

    Implements a Model Context Protocol (MCP) server for network control and management using the POX SDN controller. Provides dynamic resources for network configuration and topology, interactive management prompts, and a suite of tools for switch and flow administration. Supports Python-based SDN programming and automated analysis in educational and research settings.

    • ⭐ 1
    • MCP
    • davidlin2k/pox-mcp-server
  • HarmonyOS MCP Server

    HarmonyOS MCP Server

    Enables HarmonyOS device manipulation via the Model Context Protocol.

    HarmonyOS MCP Server provides an MCP-compatible server that allows programmatic control of HarmonyOS devices. It integrates with tools and frameworks such as OpenAI's openai-agents SDK and LangGraph to facilitate LLM-powered automation workflows. The server supports execution through standard interfaces and can be used with agent platforms to process natural language instructions for device actions. Its design allows for seamless interaction with HarmonyOS systems using the Model Context Protocol.

    • ⭐ 25
    • MCP
    • XixianLiang/HarmonyOS-mcp-server
  • CLI MCP Server

    CLI MCP Server

    A secure MCP server for controlled command-line operations.

    CLI MCP Server provides a secure implementation of the Model Context Protocol (MCP) for executing command-line operations with robust security features. It enables controlled CLI access by enforcing command and flag whitelisting, path validation, and shell operator restrictions, making it suitable for integration with large language model applications. Designed for configurable deployment, it supports detailed error reporting, execution timeouts, and strict working directory controls.

    • ⭐ 155
    • MCP
    • MladenSU/cli-mcp-server
  • OPNsense MCP Server

    OPNsense MCP Server

    AI-powered firewall and network management for OPNsense

    OPNsense MCP Server provides a comprehensive Model Context Protocol server for automating and managing OPNsense firewall configurations. It enables AI assistants, such as Claude, to directly interact with and control networking features including firewall rules, NAT, VLANs, diagnostics, and advanced system operations via API and SSH. The tool supports batch operations, direct command execution, and advanced troubleshooting, enhancing network management automation. It also supports integration for infrastructure as code and toolchains supporting MCP environments.

    • ⭐ 26
    • MCP
    • vespo92/OPNSenseMCP
  • Higress OPS MCP Server

    Higress OPS MCP Server

    Model Context Protocol server and client for fully managed Higress configuration.

    Higress OPS MCP Server delivers a Model Context Protocol-compliant server and client for centralized configuration and management of Higress. It leverages a flexible tool-based architecture and offers seamless integration with LangGraph and LangChain MCP Adapters, streamlining agent-driven workflows for system operations. The package allows developers to define, extend, and register custom tools, supporting secure interaction with the Higress Console API. Sensitive actions can be flagged for human confirmation to enhance operational safety.

    • ⭐ 22
    • MCP
    • higress-group/higress-ops-mcp-server
  • Didn't find tool you were looking for?

    Be as detailed as possible for better results