MCP ExplorerExplorer

Generative Ai Cisco Mcp

@mayanknaunion 17 days ago
1 MIT
FreeCommunity
AI Systems
Demo project for managing Cisco routers using Claude MCP and Python.

Overview

What is Generative Ai Cisco Mcp

The generative-ai-cisco-mcp is a project that demonstrates the integration of Claude Desktop with Cisco routers using the Model Context Protocol (MCP) to facilitate natural language management and automation of network devices.

Use cases

Use cases include executing show commands, retrieving configurations, pushing changes to routers, and managing network devices through natural language queries.

How to use

To use generative-ai-cisco-mcp, users need to set up Claude Desktop, configure their Cisco routers, and connect to the MCP server. The project provides detailed instructions on requirements, setup, and testing.

Key features

Key features include natural language network management, Python MCP server integration, secure connections to Cisco routers using Netmiko/SSH, and the ability to scale the solution across an entire IT infrastructure.

Where to use

generative-ai-cisco-mcp can be used in IT infrastructure management, network administration, and automation tasks within organizations that utilize Cisco networking equipment.

Content

Claude MCP Cisco Demo

Welcome to the Claude MCP Cisco Demo!
This project demonstrates how to use Claude Desktop, the Model Context Protocol (MCP), and Python to manage Cisco routers using natural language and automation.


📚 Table of Contents


Overview

This repo shows how to:

  • Connect Claude Desktop to Cisco routers via the Model Context Protocol (MCP)
  • Run show commands, retrieve configs, and push changes—all via natural language
  • Scale the approach to your entire IT infrastructure

All code and instructions are included.
All scripts and diagrams are open source—see LICENSE.


Architecture

MCP Architecture Flow

MCP Architecture Flow

  • Claude Desktop: User interacts with AI
  • MCP Client: Bridges Claude with the MCP server
  • MCP Server: Exposes tools/resources, translates requests
  • Netmiko/SSH: Secure connection to Cisco routers
  • Routers: Managed devices

Lab Topology

GNS3 Lab Topology

GNS3 Topology

  • PC1: Runs Claude Desktop and MCP server
  • R2, R1: Cisco routers (can be real or emulated)
  • Cloud: Simulates WAN/Internet

Features

  • Natural Language Network Management: Use Claude to interact with your routers
  • Python MCP Server: Powered by FastMCP and Netmiko
  • Multi-Device Support: Easily add more routers
  • Secure SSH Automation: All actions over SSH

Getting Started

1. Requirements

  • Python 3.10+
  • Claude Desktop (see Anthropic)
  • Cisco routers (real or GNS3/EVEng)
  • GNS3 (optional, for emulation)
  • SSH enabled on routers

2. Clone & Set Up

git clone https://github.com/mayanknauni/generative-ai-cisco-mcp.git
cd claude-mcp-cisco-demo
python -m venv venv
On Windows:

venv\Scripts\activate
On Mac/Linux:

source venv/bin/activate
pip install -r requirements.txt

text

3. Configure Your Routers

  • Make sure SSH is enabled and reachable from your desktop.
  • Example Cisco config:

conf t
hostname R1
username admin privilege 15 secret Cisco123
ip domain-name lab.local
crypto key generate rsa modulus 2048
ip ssh version 2
line vty 0 4
login local
transport input ssh
end

text

4. MCP Server Setup

  • Edit mcp_server.py and update the router IPs and credentials:

router_manager.add_router(“R1”, RouterConfig(
host=“1.1.1.1”, # Replace with your router’s IP
username=“admin”,
password=“Cisco123”
))
router_manager.add_router(“R2”, RouterConfig(
host=“2.2.2.2”,
username=“admin”,
password=“Cisco123”
))

text

5. Claude Desktop Integration

  • Find your Claude Desktop config file (typically %APPDATA%\Claude\claude_desktop_config.json on Windows).
  • Add/replace with:

{
“mcpServers”: {
“cisco-router-manager”: {
“command”: “C:\Users\youruser\claude-mcp-cisco-demo\venv\Scripts\python.exe”,
“args”: [
“C:\Users\youruser\claude-mcp-cisco-demo\mcp_server.py”
]
}
}
}

text

  • Restart Claude Desktop.

6. Run & Test

  • Start the MCP server manually (for debugging):

python mcp_server.py

text

  • Or let Claude Desktop launch it automatically when you use a tool.

Usage Examples

Show command:

{
“router”: “R2”,
“command”: “show ip interface brief”
}

text

Config command:

{
“router”: “R2”,
“command”: [
“interface GigabitEthernet0/1”,
“description Configured by MCP”,
“no shutdown”
]
}

text

Use built-in tools:

  • get_config to fetch running config
  • configure_interface to set interface IPs

Security Notes

  • Never commit real device credentials to public repositories.
  • For production, use environment variables or a secrets manager.
  • Restrict SSH access to trusted hosts only.

FAQ & Troubleshooting

  • SSH errors?
    Ensure your router supports modern SSH KEX algorithms or set Netmiko’s kex_algorithms as described in issues.
  • Claude Desktop can’t find the server?
    Double-check your Python path in the config and that dependencies are installed in the right venv.

License

MIT License


All code and diagrams are shared for learning and inspiration. Fork, adapt, and build your own AI-powered network automation!


Demo and documentation by Mayank Nauni


Tools

No tools

Comments