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-ba
Add this skill
npx mdskills install automateyournetwork/pyats-mcpWell-documented MCP server wrapping pyATS for safe network device automation with strong security validation
1# pyATS MCP Server2[](https://archestra.ai/mcp-catalog/automateyournetwork__pyats_mcp)34This 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.56π¨ 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.78π§ What It Does910Connects to Cisco IOS/NX-OS devices defined in a pyATS testbed1112Supports safe execution of validated CLI commands (show, ping)1314Allows controlled configuration changes1516Returns structured (parsed) or raw output1718Exposes a set of well-defined tools via tools/discover and tools/call1920Operates entirely via STDIO for minimal surface area and maximum portability2122π Usage23241. Set your testbed path2526```bash2728export PYATS_TESTBED_PATH=/absolute/path/to/testbed.yaml2930```31322. Run the server3334Continuous STDIO Mode (default)3536```bash3738python3 pyats_mcp_server.py3940```4142Launches a long-running process that reads JSON-RPC requests from stdin and writes responses to stdout.4344One-Shot Mode4546``` bash4748echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/discover"}' | python3 pyats_mcp_server.py --oneshot4950```51Processes a single JSON-RPC request and exits.5253π¦ Docker Support5455Build the container5657```bash5859docker build -t pyats-mcp-server .6061```6263Run the container (STDIO Mode)64```bash65docker run -i --rm \66 -e PYATS_TESTBED_PATH=/app/testbed.yaml \67 -v /your/testbed/folder:/app \68 pyats-mcp-server69```7071π§ Available MCP Tools7273Tool Description7475run_show_command Executes show commands safely with optional parsing7677run_ping_command Executes ping tests and returns parsed or raw results7879apply_configuration Applies safe configuration commands (multi-line supported)8081learn_config Fetches running config (show run brief)8283learn_logging Fetches system logs (show logging last 250)8485All inputs are validated using Pydantic schemas for safety and consistency.8687π€ LangGraph Integration8889Add the MCP server as a tool node in your LangGraph pipeline like so:9091```python9293("pyats-mcp", ["python3", "pyats_mcp_server.py", "--oneshot"], "tools/discover", "tools/call")9495```9697Name: pyats-mcp9899Command: python3 pyats_mcp_server.py --oneshot100101Discover Method: tools/discover102103Call Method: tools/call104105STDIO-based communication ensures tight integration with LangGraphβs tool invocation model without opening HTTP ports or exposing REST endpoints.106107π Example Requests108109Discover Tools110111```json112113{114 "jsonrpc": "2.0",115 "id": 1,116 "method": "tools/discover"117}118119```120121Run Show Command122123``` json124125{126 "jsonrpc": "2.0",127 "id": 2,128 "method": "tools/call",129 "params": {130 "name": "run_show_command",131 "arguments": {132 "device_name": "router1",133 "command": "show ip interface brief"134 }135 }136}137```138π Security Features139140Input validation using Pydantic141142Blocks unsafe commands like erase, reload, write143144Prevents pipe/redirect abuse (e.g., | include, >, copy, etc.)145146Gracefully handles parsing fallbacks and errors147148π Project Structure149150```graphql151152.153βββ pyats_mcp_server.py # MCP server with JSON-RPC and pyATS integration154βββ Dockerfile # Docker container definition155βββ testbed.yaml # pyATS testbed (user-provided)156βββ README.md # This file157158```159160π₯ MCP Server Config Example (pyATS MCP via Docker)161162To run the pyATS MCP Server as a container with STDIO integration, configure your mcpServers like this:163164``` json165{166 "mcpServers": {167 "pyats": {168 "command": "docker",169 "args": [170 "run",171 "-i",172 "--rm",173 "-e",174 "PYATS_TESTBED_PATH",175 "-v",176 "/absolute/path/to/testbed/folder:/app",177 "pyats-mcp-server"178 ],179 "env": {180 "PYATS_TESTBED_PATH": "/app/testbed.yaml"181 }182 }183 }184}185186```187188```json189{190 "servers": {191 "pyats": {192 "type": "stdio",193 "command": "python3",194 "args": [195 "-u",196 "/Users/johncapobianco/pyATS_MCP/pyats_mcp_server.py"197 ],198 "env": {199 "PYATS_TESTBED_PATH": "/Users/johncapobianco/pyATS_MCP/testbed.yaml"200 }201 }202}203```204π§Ύ Explanation:205command: Uses Docker to launch the containerized pyATS MCP server206207args:208209-i: Keeps STDIN open for communication210211--rm: Automatically removes the container after execution212213-e: Injects the environment variable PYATS_TESTBED_PATH214215-v: Mounts your local testbed directory into the container216217pyats-mcp-server: Name of the Docker image218219env:220221Sets the path to the testbed file inside the container (/app/testbed.yaml)222223224βοΈ Author225226John Capobianco227228Product Marketing Evangelist, Selector AI229230Author, Automate Your Network231232Let me know if youβd like to add:233234A sample LangGraph graph config235236Companion client script237238CI/CD integration (e.g., GitHub Actions)239240Happy to help!241242# The testbed.yaml file works with the Cisco DevNet Cisco Modeling Labs (CML) Sandbox!243
Full transparency β inspect the skill content before installing.