convez.ai
MCP ServerDevOps & InfraestruturaIntermediário
x86taka

Arista EOS MCP Server

x86taka/arista-eos-mcp

Consulte switches Arista EOS via MCP com proteção contra mudanças

Ver no GitHub
InicialPluginScore · de 0 a 100

Servidor Model Context Protocol (MCP) somente leitura para dispositivos Arista EOS, escrito em Go. Permite que clientes MCP como Claude Desktop consultem switches EOS via eAPI e gNMI com segurança garantida contra comandos de alteração de estado.

Instalação

$npx convez-ai x86taka/arista-eos-mcp

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
2
Forks
2
Acompanhando
0
Saúde
42%
Último commit
há 3 meses
Versão
v1.0.0
Issues abertas
2
Contribuidores
3

Casos de uso

  • Monitoramento e auditoria de configuração em switches Arista
  • Consultas de estado de rede e vizinhança LLDP via Claude
  • Integração de dispositivos EOS em pipelines de automação de rede

Veredito

Solução bem arquitetada para expor switches Arista EOS ao Claude via MCP com segurança por padrão (read-only). Útil para times de infraestrutura que precisam consultar estado de rede, mas demanda familiaridade com Arista EOS e eAPI.

README

A tradução para o português deste README ainda está na fila.

Arista EOS MCP Server

A read-only Model Context Protocol (MCP) server for Arista EOS devices, written in Go. It lets MCP clients such as Claude Desktop / Claude Code query EOS switches over eAPI and gNMI.

The server is read-only by default: any command that would change the configuration or device state is rejected before it reaches the device.

Features

  • eAPI tools: run_show_command, get_version, get_interfaces, get_running_config, get_lldp_neighbors, get_bgp_summary
  • gNMI tools: gnmi_get, gnmi_capabilities
  • Safety guard that rejects configure, write, copy, reload, clear, no ..., bash, and other state-changing commands in read-only mode

Requirements

  • Go 1.24+ (built with 1.26)
  • An Arista EOS device with eAPI enabled (management api http-commands) and, optionally, gNMI (management api gnmi)

Install

Prebuilt binaries (linux/darwin/windows, amd64/arm64) are attached to each GitHub Release — download the archive for your platform and extract the arista-eos-mcp binary.

Or install from source with Go:

go install github.com/x86taka/arista-eos-mcp/cmd/arista-eos-mcp@latest

This produces an arista-eos-mcp binary on your PATH. Pin a specific version by replacing @latest with a tag, e.g. @v0.1.0.

Build from source

git clone https://github.com/x86taka/arista-eos-mcp.git
cd arista-eos-mcp
go build -o arista-eos-mcp ./cmd/arista-eos-mcp

Configuration

The server supports one or more devices. There are two ways to configure it; EOS_CONFIG takes precedence when set.

Option A: multi-device JSON inventory (recommended)

Point EOS_CONFIG at a JSON file describing the devices. Each tool then takes an optional device argument to select the target; when only one device is configured the argument may be omitted. Use the list_devices tool to see the configured names.

{
  "read_only": true,
  "timeout_seconds": 30,
  "devices": [
    {
      "name": "leaf1",
      "host": "192.0.2.10",
      "username": "admin",
      "password": "secret",
      "enable_password": "",
      "eapi_transport": "https",
      "eapi_port": 443,
      "gnmi_port": 6030,
      "gnmi_insecure": true,
      "tls_skip_verify": true
    },
    {
      "name": "spine1",
      "host": "192.0.2.20",
      "username": "readonly",
      "password": "ro-pass"
    }
  ]
}

See devices.example.json. Per-device fields default to: eapi_transport = https, eapi_port = 443, gnmi_port = 6030, and gnmi_insecure / tls_skip_verify = true (omit them for a lab; set to false to enforce TLS).

EOS_CONFIG=/path/to/devices.json ./arista-eos-mcp

Option B: single-device environment variables

When EOS_CONFIG is unset, the server builds a single device (named default, override with EOS_DEVICE_NAME) from these variables.

VariableRequiredDefaultDescription
EOS_HOSTno*—IP/hostname of a predefined device (optional if defaults set)
EOS_USERNAMEno*—eAPI / gNMI username (also the default credential)
EOS_PASSWORDno*—password (also the default credential)
EOS_ENABLE_PASSWORDno—enable (privileged exec) password, if needed
EOS_DEFAULT_USERNAMEno=EOS_USERNAMEshared username for ad-hoc hosts
EOS_DEFAULT_PASSWORDno=EOS_PASSWORDshared password for ad-hoc hosts
EOS_DEFAULT_ENABLE_PASSWORDno=EOS_ENABLE_PASSWORDshared enable password for ad-hoc hosts
EOS_ALLOW_DYNAMIC_HOSTSnoautoforce-enable/disable ad-hoc hosts (auto = on if default creds set)
EOS_EAPI_TRANSPORTnohttpshttps, http, http_local, or socket
EOS_EAPI_PORTno0eAPI port (0 = transport default: https 443/http 80)
EOS_GNMI_PORTno6030gNMI gRPC port
EOS_GNMI_INSECUREnotrueuse plaintext gRPC (no TLS)
EOS_GNMI_TLS_CAno—path to a CA certificate for gNMI TLS
EOS_TLS_SKIP_VERIFYnotrueskip TLS certificate verification (lab/self-signed)
EOS_DEVICE_NAMEnodefaultname reported for the single env-configured device
EOS_TIMEOUT_SECONDSno30per-request timeout
EOS_READ_ONLYnotruereject write/state-changing commands

* At least one of these is required: either set EOS_HOST (with credentials) for a predefined device, or provide credentials alone to run with ad-hoc hosts only. See Ad-hoc hosts.

Transport (both config modes):

VariableDefaultDescription
MCP_TRANSPORTstdiostdio (client-spawned) or http (long-running)
MCP_HTTP_ADDR:8080listen address when MCP_TRANSPORT=http

Lab note: vEOS/cEOS often use self-signed certs. Set EOS_TLS_SKIP_VERIFY=true for eAPI over HTTPS, and EOS_GNMI_INSECURE=true (or provide EOS_GNMI_TLS_CA) for gNMI.

Ad-hoc hosts (shared credentials)

You don't have to predefine every device. If shared default credentials are configured, any tool's device argument also accepts a hostname or IP that is not in the inventory — the server connects to it on demand using those credentials. Predefined devices and ad-hoc hosts can be mixed freely.

Ad-hoc access is enabled automatically when default credentials are present:

  • Env mode: EOS_DEFAULT_USERNAME / EOS_DEFAULT_PASSWORD (EOS_DEFAULT_ENABLE_PASSWORD optional). These fall back to EOS_USERNAME / EOS_PASSWORD, so simply setting those — even without EOS_HOST — is enough to run with no predefined devices at all.

  • JSON mode: a top-level "defaults" object:

    {
      "defaults": {
        "username": "admin",
        "password": "secret",
        "gnmi_insecure": true,
        "tls_skip_verify": true
      },
      "devices": [ { "name": "leaf1", "host": "192.0.2.10", "username": "admin", "password": "secret" } ]
    }
    

The device value is used verbatim as the connection host, so pass a resolvable hostname or IP (e.g. device: "192.0.2.50" or device: "leaf9.lab"). Ad-hoc hosts inherit the default transport/port/TLS settings. Connections are cached for reuse. Set EOS_ALLOW_DYNAMIC_HOSTS=false (or "allow_dynamic_hosts": false) to disable the behavior even when default credentials exist.

list_devices reports whether ad-hoc access is enabled.

Run

EOS_HOST=192.0.2.10 EOS_USERNAME=admin EOS_PASSWORD=secret \
  EOS_TLS_SKIP_VERIFY=true ./arista-eos-mcp

The server speaks MCP over stdio.

Run with Docker / Docker Compose

The server supports two MCP transports, selected with MCP_TRANSPORT:

  • stdio (default) — the MCP client spawns the process and talks over stdin/stdout. Use docker run -i.
  • http — Streamable HTTP, suitable for a long-lived service. Use docker compose up. Listens on MCP_HTTP_ADDR (default :8080).

Docker Compose (HTTP transport, long-running service)

  1. Create your inventory at ./devices.json (copy devices.example.json).

  2. Start it:

    docker compose up -d --build
    

    This runs the server with MCP_TRANSPORT=http on http://localhost:8080. Point an HTTP-capable MCP client at that URL. For Claude Code:

    claude mcp add --transport http arista-eos http://localhost:8080
    

Docker (stdio transport, client-spawned)

Build once, then have the MCP client launch a container per session:

docker build -t arista-eos-mcp:latest .
{
  "mcpServers": {
    "arista-eos": {
      "command": "docker",
      "args": [
        "run", "-i", "--rm",
        "-e", "EOS_CONFIG=/config/devices.json",
        "-v", "/absolute/path/to/devices.json:/config/devices.json:ro",
        "arista-eos-mcp:latest"
      ]
    }
  }
}

The -i flag is required for the stdio transport. MCP_TRANSPORT defaults to stdio, so no transport env var is needed for this mode.

Register with Claude Desktop / Claude Code

Add to your MCP client config (e.g. claude_desktop_config.json, or via claude mcp add). Use an absolute path for both the binary and the config file.

Multi-device (recommended):

{
  "mcpServers": {
    "arista-eos": {
      "command": "/absolute/path/to/arista-eos-mcp",
      "env": {
        "EOS_CONFIG": "/absolute/path/to/devices.json"
      }
    }
  }
}

Single device:

{
  "mcpServers": {
    "arista-eos": {
      "command": "/absolute/path/to/arista-eos-mcp",
      "env": {
        "EOS_HOST": "192.0.2.10",
        "EOS_USERNAME": "admin",
        "EOS_PASSWORD": "secret"
      }
    }
  }
}

For Claude Code:

# multi-device
claude mcp add arista-eos \
  -e EOS_CONFIG=/absolute/path/to/devices.json \
  -- /absolute/path/to/arista-eos-mcp

# single device
claude mcp add arista-eos \
  -e EOS_HOST=192.0.2.10 -e EOS_USERNAME=admin -e EOS_PASSWORD=secret \
  -- /absolute/path/to/arista-eos-mcp

Once connected, ask Claude things like "list the devices", or "show the BGP summary on leaf1". Every tool accepts a device argument; it is optional only when a single device is configured.

Enabling APIs on EOS

! eAPI
management api http-commands
   no shutdown
   protocol https

! gNMI
management api gnmi
   transport grpc default

Tools

All tools except list_devices accept an optional device argument selecting the target by name (required when more than one device is configured).

Inventory & generic

ToolDescription
list_devicesList configured device names
run_show_commandRun any read-only command (json or text output)

Curated read-only show tools (eAPI)

ToolCommand
get_versionshow version
get_running_configrunning configuration as text
get_interfacesshow interfaces (opt. filter)
get_interfaces_statusshow interfaces status
get_interface_countersshow interfaces counters
get_mac_address_tableshow mac address-table
get_arp_tableshow ip arp
get_ip_routeshow ip route (opt. prefix/VRF)
get_vlansshow vlan
get_lldp_neighborsshow lldp neighbors
get_port_channelsshow port-channel summary
get_mlagshow mlag
get_spanning_treeshow spanning-tree
get_bgp_summaryshow ip bgp summary
get_bgp_neighborsshow ip bgp neighbors
get_ospf_neighborsshow ip ospf neighbor
get_transceiversshow interfaces transceiver
get_environmentshow environment all
get_ntp_statusshow ntp status
get_loggingshow logging last 100
get_processesshow processes top once

Aggregation & diagnostics

ToolDescription
get_device_healthCombined report: version, environment, interfaces, LAG, MLAG, BGP
compare_configDiff the running-config of two devices (device_a, device_b)
compare_commandRun one command on two devices and diff the output

Active diagnostics (read-only, still within the safety allow-list)

ToolDescription
ping_hostPing from a device (destination, opt. count/vrf/source)
traceroute_hostTraceroute from a device (destination, opt. vrf)
get_bgp_advertised_routesRoutes advertised to a neighbor
get_bgp_received_routesRoutes received from a neighbor

Fleet (multi-device)

ToolDescription
fleet_run_commandRun one command across many devices in parallel (devices opt.)
fleet_get_versionCollect show version across many devices

gNMI

ToolDescription
gnmi_getGet one or more paths
gnmi_capabilitiesSupported models and encodings
gnmi_subscribeCollect telemetry over a bounded window (once/sample/on-change)

Resources

Per device, the server exposes two read-only MCP resources:

  • eos://<device>/running-config — running configuration (text)
  • eos://<device>/version — show version output (JSON)

Prompts

Reusable troubleshooting prompt templates:

PromptArgumentsPurpose
troubleshoot_interfacedevice, interfaceInvestigate a problematic interface
troubleshoot_bgpdevice, neighbor (optional)Investigate BGP session problems
device_health_reviewdeviceFull health review and summary
compare_devicesdevice_a, device_bCompare two devices and explain the diff

Safety model

In read-only mode (the default) every eAPI command is validated against an allow-list: only show ... and a small set of diagnostics (ping, traceroute) are permitted. Commands starting with configure, write, copy, delete, reload, clear, no , bash, etc. are rejected, as are pipes that redirect/tee to a file. ping and traceroute are permitted as read-only diagnostics. gNMI is restricted to Get/Capabilities/Subscribe (no Set); subscriptions are bounded by a time window (max 60s).

To allow write operations in a future version, set EOS_READ_ONLY=false — but no write tools are currently implemented.

Development

go test ./...
go vet ./...

Releases

Releases are automated with release-please. Commits to master that follow Conventional Commits (feat:, fix:, feat!:/BREAKING CHANGE:, …) drive the version bump.

On each push to master the workflow maintains a release PR that updates CHANGELOG.md, the version in cmd/arista-eos-mcp/main.go (marked with // x-release-please-version), and .release-please-manifest.json. Merging that PR tags the commit (vX.Y.Z) and publishes a GitHub Release. The same workflow then runs GoReleaser (.goreleaser.yaml) to cross-compile the binaries and attach the archives + checksums.txt to that release.

Config lives in release-please-config.json, .goreleaser.yaml, and the workflow in .github/workflows/release-please.yml.

License

MIT © Takaharu Umeda

Ver o original no GitHub

Bom para

Relacionados