Content
# Netmiko MCP Server
An MCP (Model Context Protocol) server for managing network devices via SSH using [Netmiko](https://github.com/ktbyers/netmiko). Features connection pooling, multi-vendor support, and concurrent operations.
## Features
- **Command Execution**: Run CLI commands on single or multiple devices
- **Configuration Management**: Push configuration changes with optional save/rollback
- **Device Inventory**: YAML-based device inventory with groups and tags
- **Connection Pooling**: Efficient connection reuse with health checks
- **Multi-Vendor Support**: Works with any device type supported by Netmiko
- **Concurrent Operations**: Execute commands on multiple devices in parallel
- **TextFSM Parsing**: Optional structured output parsing
## Installation
### From Source
```bash
git clone https://github.com/ntunes/netmiko-mcp-server.git
cd netmiko-mcp-server
pip install -e .
```
### With Docker
```bash
docker build -t netmiko-mcp .
```
## Configuration
### Device Inventory
Create a `config/devices.yaml` file with your device inventory:
```yaml
defaults:
timeout: 30
fast_cli: true
credentials:
production:
username: "${NETMIKO_USERNAME}"
password: "${NETMIKO_PASSWORD}"
secret: "${NETMIKO_SECRET}"
groups:
core_routers:
- core-rtr-01
- core-rtr-02
devices:
core-rtr-01:
host: "192.168.1.1"
device_type: "cisco_ios"
credential_profile: "production"
tags:
- core
- production
core-rtr-02:
host: "192.168.1.2"
device_type: "cisco_ios"
credential_profile: "production"
tags:
- core
- production
pool_settings:
max_connections_per_device: 3
connection_timeout: 300
health_check_interval: 60
```
### Environment Variables
Set credentials via environment variables:
```bash
export NETMIKO_USERNAME="admin"
export NETMIKO_PASSWORD="your_password"
export NETMIKO_SECRET="enable_secret"
```
Optionally set config file location:
```bash
export NETMIKO_MCP_CONFIG="/path/to/devices.yaml"
```
## Usage
### Running the Server
**Stdio transport (for Claude Desktop):**
```bash
python -m netmiko_mcp
```
**Streamable HTTP transport:**
```bash
python -m netmiko_mcp --transport streamable-http --port 8339
```
**With Docker:**
```bash
docker run -p 8339:8339 \
-e NETMIKO_USERNAME=admin \
-e NETMIKO_PASSWORD=secret \
-v ./config/devices.yaml:/app/config/devices.yaml:ro \
netmiko-mcp
```
**With Docker Compose:**
```bash
# Set credentials in .env or environment
export NETMIKO_USERNAME=admin
export NETMIKO_PASSWORD=secret
docker-compose up -d
```
### Claude Desktop Configuration
Add to your Claude Desktop configuration:
**For stdio transport:**
```json
{
"mcpServers": {
"netmiko": {
"command": "python",
"args": ["-m", "netmiko_mcp", "--config", "/path/to/devices.yaml"]
}
}
}
```
**For HTTP transport:**
```json
{
"mcpServers": {
"netmiko": {
"url": "http://localhost:8339/mcp"
}
}
}
```
## MCP Tools
### Command Execution
| Tool | Description |
|------|-------------|
| `send_command` | Execute a single command on one device |
| `send_command_parallel` | Execute the same command on multiple devices concurrently |
| `send_commands_sequence` | Execute multiple commands sequentially on one device |
### Configuration
| Tool | Description |
|------|-------------|
| `send_config` | Push configuration commands to one device |
| `send_config_parallel` | Push configuration to multiple devices concurrently |
### Inventory & Discovery
| Tool | Description |
|------|-------------|
| `list_devices` | List all devices with optional tag/type filtering |
| `get_device_info` | Get detailed device information and connection status |
| `list_groups` | List all device groups and their members |
| `test_connection` | Test connectivity to a device |
| `get_pool_status` | Get connection pool statistics |
| `get_device_types` | List all device types in inventory |
| `get_tags` | List all tags used across devices |
### Examples
**Execute a command:**
```
Use send_command on device "core-rtr-01" with command "show version"
```
**Execute on multiple devices:**
```
Use send_command_parallel on devices ["@core_routers"] with command "show ip interface brief"
```
**Push configuration:**
```
Use send_config on device "core-rtr-01" with config_commands ["interface Loopback0", "description Test"] and save_config true
```
## Supported Device Types
Any device type supported by Netmiko, including:
- `cisco_ios` - Cisco IOS
- `cisco_xe` - Cisco IOS-XE
- `cisco_xr` - Cisco IOS-XR
- `cisco_nxos` - Cisco NX-OS
- `arista_eos` - Arista EOS
- `juniper_junos` - Juniper JunOS
- `paloalto_panos` - Palo Alto PAN-OS
- `hp_procurve` - HP ProCurve
- `linux` - Linux SSH
See [Netmiko supported platforms](https://github.com/ktbyers/netmiko#supports) for the full list.
## Development
### Install Development Dependencies
```bash
pip install -e ".[dev]"
```
### Run Tests
```bash
pytest
```
### Run Linting
```bash
ruff check src/ tests/
mypy src/
```
## License
MIT
MCP Config
Below is the configuration for this MCP Server. You can copy it directly to Cursor or other MCP clients.
mcp.json
Connection Info
You Might Also Like
everything-claude-code
Complete Claude Code configuration collection - agents, skills, hooks,...
markitdown
MarkItDown-MCP is a lightweight server for converting URIs to Markdown.
servers
Model Context Protocol Servers
servers
Model Context Protocol Servers
Time
A Model Context Protocol server for time and timezone conversions.
Filesystem
Node.js MCP Server for filesystem operations with dynamic access control.