Retrieves essential network information from devices using gNMI and OpenConfig models.
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.
Retrieve structured network data in JSON format:
See the API definition for all available APIs and options.
3.13+
[!IMPORTANT] gNMIBuddy requires devices to support specific OpenConfig models depending on the functionality used.
OpenConfig Models dependencies
openconfig-system
(0.17.1
)openconfig-interfaces
(4.0.0
)openconfig-network-instance
(1.3.0
)Tested on:
24.4.1.26I
)[!NOTE] The function to get logs from devices, only works on XR systems.
Install uv
package manager (docs):
# macOS
brew install uv
Don't want to clone the repo? Use gNMIBuddy as a tool directly from GitHub:
# Run directly without installation
uvx --from git+https://github.com/jillesca/gNMIBuddy.git gnmibuddy --help
# Example with commands
uvx --from git+https://github.com/jillesca/gNMIBuddy.git gnmibuddy --inventory your_inventory.json device list
[!TIP] Don't want to always type the inventory? use the
NETWORK_INVENTORY
env var.
# Install the tool globally
uv tool install git+https://github.com/jillesca/gNMIBuddy.git
# Use it directly
gnmibuddy --help
gnmibuddy device info --device R1
# Uninstall when no longer needed
uv tool uninstall gnmibuddy
# To get updates
uv tool upgrade gnmibuddy
[!TIP] The
uvx
method automatically builds and runs the tool in an isolated environment without affecting your system.
If you don't want to use uvx
, clone this repo and do.
uv sync --frozen --no-dev
This is needed only the first time you install the project.
โฏ uv run gnmibuddy.py --help
โโโโโโ โโโโ โโโโโโโโโโโ โโ โโโโโโ โโโโโโ โโ
โโ โโโโโโโโโโโโ โ โโ โโโโ โโโโ โโโ โโโโโ
โโโโโโโ โโโโโ โโ โ โโโโโโโ โโโโ โโโ โ โโ
โโโโโโโ โโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โโ
An 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.
Help: https://github.com/jillesca/gNMIBuddy
Python Version: 3.13.4
gNMIBuddy Version: 0.1.0
Usage:
gnmibuddy.py [OPTIONS] COMMAND [ARGS]...
๐ Inventory Requirement:
Provide device inventory via --inventory PATH or set NETWORK_INVENTORY env var
Options:
-h, --help Show this message and exit
-V, --version Show version information
--log-level LEVEL Set logging level (debug, info, warning, error)
--module-log-help Show detailed module logging help
--all-devices Run on all devices concurrently
--inventory PATH Path to inventory JSON file
--max-workers NUMBER Maximum number of concurrent workers for batch operations (--all-devices, --devices, --device-file)
Commands:
device (d) Device Information
info Get system information from a network device
list List all available devices in the inventory
profile Get device profile and role information
network (n) Network Protocols
interface Get interface status and configuration
mpls Get MPLS forwarding and label information
routing Get routing protocol information (BGP, ISIS, OSPF)
vpn Get VPN/VRF configuration and status
topology (t) Network Topology
neighbors Get direct neighbor information via LLDP/CDP
network Get complete network topology information. Queries all devices in inventory.
ops (o) Operations
logs Retrieve and filter device logs
validate Validate all collector functions (development tool)
Examples:
gnmibuddy.py device info --device R1
gnmibuddy.py network routing --device R1
gnmibuddy.py --all-devices device list
Run 'gnmibuddy.py COMMAND --help' for more information on a command.
gNMIBuddy integrates with LLMs through the Model Context Protocol (MCP), providing network telemetry tools for AI agents.
No installation required - runs directly from GitHub using uvx
:
MCP Client | Configuration | Location |
---|---|---|
VSCode | ๐ Copy config | .vscode/mcp.json |
Cursor | ๐ Copy config | .cursor/mcp.json |
Claude Desktop | ๐ Copy config | See Claude Docs |
[!TIP] Copy the configuration file contents and update the paths.
# Test the MCP integration
NETWORK_INVENTORY=your_inventory.json \
npx @modelcontextprotocol/inspector \
uvx --from git+https://github.com/jillesca/gNMIBuddy.git gnmibuddy-mcp
If you're developing or want full control over the installation:
Clone the repository:
git clone https://github.com/jillesca/gNMIBuddy.git
cd gNMIBuddy
Choose your configuration:
MCP Client | Configuration |
---|---|
VSCode | ๐ Copy config |
Cursor | ๐ Copy config |
Claude Desktop | ๐ Copy config |
Test the development setup:
NETWORK_INVENTORY=your_inventory.json \
npx @modelcontextprotocol/inspector \
uv run --with "mcp[cli],pygnmi,networkx,pyyaml" \
mcp run mcp_server.py
[!IMPORTANT] Set the
NETWORK_INVENTORY
environment variable to your inventory file.
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:
# Enable gRPC on the DevNet XRd Sandbox
ANSIBLE_HOST_KEY_CHECKING=False \
uv run --with "paramiko,ansible" \
ansible-playbook ansible-helper/xrd_apply_config.yaml -i ansible-helper/hosts
Then test with the provided xrd_sandbox.json
inventory file.
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.
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 return a NetworkOperationResult
object with detailed information about the operation, including status, data, metadata, and error handling.
@dataclass
class NetworkOperationResult:
device_name: str
ip_address: str
nos: str
operation_type: str
status: OperationStatus
data: Dict[str, Any] = field(default_factory=dict)
metadata: Dict[str, Any] = field(default_factory=dict)
error_response: Optional[ErrorResponse] = None
feature_not_found_response: Optional[FeatureNotFoundResponse] = None
Batch operations (using --all-devices
, --devices
, or --device-file
) return a BatchOperationResult
object containing:
results
: A list of NetworkOperationResult
objects, one for each devicesummary
: Aggregate statistics about the batch operationmetadata
: Additional batch operation metadata@dataclass
class BatchOperationResult:
results: List[NetworkOperationResult] # One result per device
summary: BatchOperationSummary
metadata: Dict[str, Any] = field(default_factory=dict)
For more details, see the response schema definition.
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:
The application follows an OpenTelemetry-inspired architecture:
Raw gNMI Data โ Collector โ Processor โ Schema โ Response
gNMIBuddy supports environment variables for configuration, which work for both CLI and MCP server usage.
Variable | Description | Values | Default |
---|---|---|---|
NETWORK_INVENTORY | Device inventory file path | File path | - |
GNMIBUDDY_LOG_LEVEL | Global log level | debug , info , warning , error | info |
GNMIBUDDY_MODULE_LEVELS | Module-specific log levels | module1=debug,module2=warning | - |
GNMIBUDDY_LOG_FILE | Custom log file path (overrides sequential) | File path | logs/gnmibuddy_XXX.log |
GNMIBUDDY_STRUCTURED_LOGGING | Enable JSON logging | true , false | false |
GNMIBUDDY_EXTERNAL_SUPPRESSION_MODE | External library suppression | cli , mcp , development | cli |
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.
[!NOTE] Environment variables serve as defaults and can be overridden by CLI arguments like
--log-level
and--module-log-levels
.
For complete logging environment variable documentation, see Logging README
gNMIBuddy supports running commands across multiple devices simultaneously with configurable concurrency controls to optimize performance while avoiding rate limiting.
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 inventoryConcurrency Controls:
--max-workers N
: Maximum concurrent devices to process (default: 5)--per-device-workers N
: Maximum concurrent operations per device (default: varies by command)gNMIBuddy operates with two levels of concurrency:
--max-workers
): How many devices to process simultaneouslyTotal concurrent requests = max_workers ร per_device_operations
# Process 3 devices, 2 operations per device = 6 total requests
uv run gnmibuddy.py --max-workers 3 ops validate --devices xrd-1,xrd-2,xrd-3 --per-device-workers 2
An example of a remote MCP server deployable on Cloudflare Workers without authentication.
Manage and utilize website content within the DevHub CMS platform
An MCP server for the Arduino CLI, offering tools to manage sketches, boards, libraries, and files.
Automate Android devices using the uiautomator2 library, requiring adb and a connected device.
A starter MCP server built with TypeScript and the official MCP SDK, featuring example tools like echo, add, time, and flight status.
A Tabby plugin implementing an MCP server for AI-powered terminal control and automation.
A template for deploying a remote MCP server on Cloudflare Workers, customizable by defining tools in the source code.
Execute shell commands without permission prompts.
A code sandbox for AI assistants to safely execute arbitrary code. Requires a 302AI API key for authentication.
A natural language interface for single-cell RNA sequencing (scRNA-Seq) analysis using the CellRank toolkit.