Provides tools to retrieve structured network information from Cisco devices (specifically IOS-XR) using gNMI and OpenConfig, including routing data, interface status, MPLS forwarding tables, and device-specific system logs.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@gNMIBuddycheck the BGP neighbor status on xrd-1"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
๐งช gNMIBuddy
An over-engineered and opinionated tool that retrieves essential network information from devices using gNMI and OpenConfig models. Designed primarily for LLMs with Model Context Protocol (MCP) integration, it also provides a full CLI for direct use.
Opinionated by design, over-engineered by passion. gNMI and YANG expose overwhelming amounts of data with countless parameters. This tool provides what I consider the most relevant information for LLMs. And who doesn't enjoy building complicated solutions.
๐ฏ What It Does
Retrieve structured network data in JSON format:
๐ Routing: BGP, ISIS protocols and neighbor states
๐ Interfaces: Status, configuration, and statistics
๐ท๏ธ MPLS: Labels, forwarding tables, and segment routing
๐ VPN/VRF: L3VPN configuration and route targets
๐ Logs: Filtered device logs with keyword search
๐ Topology: Device neighbors and network-wide topology analysis
See the API definition for all available APIs and options.
โก Prerequisites
Python
3.13+uv, see the docs to install it.brewis recommended for macOS users
Network devices with gNMI enabled.
Windows users: The repo require a Unix-like environment. Use WSL.
Device Compatibility
Tested on:
Cisco XRd Control Plane (
24.4.1.26I,25.3.1)
Theget_logs() function only works on IOS-XR.
Devices must support gNMI and OpenConfig models listed below:
OpenConfig Models dependencies
openconfig-system >= 0.17.1openconfig-interfaces >= 3.0.0openconfig-network-instance >= 1.3.0
If the required model for a function is not found, gNMIBuddy will return an error. If the model version is older than required, it will continue execution but warn the user about potential errors.
You can use the capabilities command to verify the supported models on a specific device. If you have many devices you can use the --device option.
Device Inventory file
gNMIBuddy identifies devices by hostname and looks up their corresponding IP addresses and credentials from the inventory file.
Without a device inventory file, gNMIBuddy cannot operate.
Provide device inventory via --inventory PATH or set NETWORK_INVENTORY env var.
Store environment variables in a.env file.
The inventory must be a JSON list of Device objects with these required fields:
name: Device hostnameip_address: IP for gNMI connectionsnos: Network OS identifieriosxronly for now, use it even if you have other NOS. More will be added later.
Authentication (choose one method):
Username/Password: Requires both
usernameandpasswordfieldsCertificate-based: Requires both
path_certandpath_keyfields
Schema: src/schemas/models.py | Example: xrd_sandbox.json
Validate your inventory: Usegnmibuddy inventory validate to check your inventory file for proper format, valid IP addresses, required fields, and authentication configuration before running network commands.
๐ Quick Start
๐ฏ Instant Testing with MCP Inspector
Fastest way to try gNMIBuddy:
No repo cloning, no MCP client setup required! If you don't have XRd, seeTesting with DevNet Sandbox.
Recommended: No installation required - runs directly from GitHub using uvx:
MCP Client | Configuration |
VSCode | |
Standard MCP Clients |
For Development - when you need to test local changes:
MCP Client | Configuration |
VSCode | |
Standard MCP Clients |
The "Standard MCP Clients" config works with any MCP client following the MCP specification (Cursor, Claude Desktop, etc.). VSCode uses a different format.
Setup:
uvx configs: Update the
NETWORK_INVENTORYpath to your inventory filedev configs: Update the
NETWORK_INVENTORYpath andcwdto your local project directory
For CLI users who want to use gNMIBuddy as a command-line tool:
One-time execution
Install as a persistent tool
The uvx method automatically builds and runs the tool in an isolated environment without affecting your system.
๐ CLI Reference
๐ค Development
Quick Testing with MCP Inspector
Recommended: Use uvx (no repository clone needed):
For local development (testing uncommitted changes):
MCP Client Configuration
Choose the approach that fits your needs:
Use Case | VSCode | Standard MCP Clients |
Production/Testing | ||
Local Development |
Standard MCP Clients config works with Cursor, Claude Desktop, and any other client following the MCP specification. VSCode requires a specific format.
Configuration requirements:
uvx configs: Only update
NETWORK_INVENTORYpath to your inventory filedev configs: Update both
NETWORK_INVENTORYpath andcwdto your local project directory
๐งช Testing with DevNet Sandbox
Don't have network devices? Use the DevNet XRd Sandbox, follow the instructions to bring up a MPLS network with docker, then configure gNMI with the included Ansible playbook:
Test with the xrd_sandbox.json inventory file part of the repository.
Enable manually gNMI. Apply this configuration to all XRd devices:
Don't forget to commit your changes to XRd.
Testing with AI Agents
Want to see how this MCP tool integrates with actual AI agents? Check out sp_oncall - a graph of agents that use gNMIBuddy to demonstrate real-world network operations scenarios.
๐ Response Format
gNMIBuddy provides structured, consistent responses for all network operations. The response format depends on whether you're targeting a single device or multiple devices.
Single Device Operations
Single device operations return a NetworkOperationResult object with detailed information about the operation, including status, data, metadata, and error handling.
Batch Operations
Batch operations (using --all-devices, --devices, or --device-file) return a BatchOperationResult object containing:
results: A list ofNetworkOperationResultobjects, one for each devicesummary: Aggregate statistics about the batch operationmetadata: Additional batch operation metadata
For more details, see the response schema definition.
๐๏ธ Architecture
Schema Organization
gNMIBuddy uses a centralized schema approach for data contracts:
src/schemas/: Contains all shared data models and response contracts.src/collectors/: Network telemetry data collectors following OpenTelemetry patterns.src/processors/: Data transformation processors following OpenTelemetry patterns.
These schemas serve as contracts between different parts of the system, ensuring consistency across:
CLI and API interfaces.
Network operation responses.
Error handling and status reporting.
MCP tool integration.
Data Processing Pipeline
The application follows an OpenTelemetry-inspired architecture:
Collectors gather data from network devices via gNMI.
Processors transform raw data into structured, LLM-friendly formats.
Schemas ensure consistent data contracts across the system.
Responses provide standardized output for CLI, API, and MCP interfaces.
โ๏ธ Environment Variables
gNMIBuddy supports environment variables for configuration, which work for both CLI and MCP server usage. Environment variables can be loaded from:
Command line arguments (highest priority)
Operating system environment variables
.env(default:.envin project root)Default values (lowest priority)
.env File Support
gNMIBuddy automatically loads environment variables from a .env file in the project root. You can specify a custom .env file using the --env-file option:
Example:
Global Configuration
Variable | Description | Values | Default |
| Device inventory file path | File path | - |
| Global log level |
|
|
| Module-specific log levels |
| - |
| Custom log file path (overrides sequential) | File path |
|
| Enable JSON logging |
|
|
| External library suppression |
|
|
| Enable MCP tool debugging |
|
|
Sequential Log Files: gNMIBuddy automatically creates numbered log files (gnmibuddy_001.log, gnmibuddy_002.log, etc.) for each execution in the logs/ directory. The highest number is always the most recent run.
Environment variables serve as defaults and can be overridden by CLI arguments like--log-level and --module-log-levels.
For detailed environment configuration options and advanced usage, see Environment Configuration Guide
For complete logging environment variable documentation, see Logging README
โ๏ธ Batch Operations & Concurrency
gNMIBuddy supports running commands across multiple devices simultaneously with configurable concurrency controls to optimize performance while avoiding rate limiting.
Batch Operation Options
Device Selection:
--device DEVICE: Single device operation--devices device1,device2,device3: Comma-separated device list--device-file path/to/devices.txt: Device list from file (one per line)--all-devices: Run on all devices in inventory
Concurrency Controls:
--max-workers N: Maximum concurrent devices to process (default: 5)--per-device-workers N: Maximum concurrent operations per device (default: varies by command)
Understanding Concurrency Levels
gNMIBuddy operates with two levels of concurrency:
Device-level concurrency (
--max-workers): How many devices to process simultaneouslyPer-device concurrency (command-specific): How many operations to run simultaneously on each device
Total concurrent requests = max_workers ร per_device_operations