Introducing batfish-q-mcp for AI-Powered Network Analysis

Network validation has traditionally required a deep understanding of complex toolchains, specialized APIs, and query languages. While tools like Batfish have revolutionized how we analyze network configurations and prove correctness before changes hit production, constructing the right queries or parsing raw data can still introduce friction into daily engineering workflows.

This post introduces my latest project, batfish-q-mcp, an open-source Model Context Protocol (MCP) server designed to bring conversational, intent-driven network analysis directly to your AI agents and local developer workflows.

You can check out the repository and source code on GitHub at martimy/batfish-q-mcp.

Why Bring Batfish into the MCP Ecosystem?

A MCP standardizes how AI models connect to data sources and execution tools. By wrapping Batfish’s robust configuration analysis engine inside an MCP server, batfish-q-mcp bridges the gap between natural language intent and formal network verification.

Instead of writing custom Python scripts via PyBatfish, you can now interact with your network snapshots conversationally through any MCP-compatible client (such as Claude Desktop).

The workflow shifts fundamentally:

  • Before: Manually spin up a Batfish container, load snapshots, write customized PyBatfish filter/reachability queries, and parse JSON outputs
  • With MCP: Ask your AI agent questions like “Verify if UDP traffic from Server 1 can reach the Internet” or “Will Server 1 still be able to reach the Internet after router r1 fails?,” and let the AI invoke the precise Batfish tools underneath.

Key Capabilities of batfish-q-mcp

The server exposes a comprehensive suite of Batfish capabilities structured around standard network engineering tasks:

  1. Snapshot Initialization & Management: Seamlessly load and manage configuration snapshots across multi-vendor topologies (Cisco, Arista, etc.).
  2. Reachability and Path Analysis: Query end-to-end packet paths, test security group or ACL rules, and verify connectivity under normal and failure scenarios.
  3. Topology and Routing Inspection: Inspect BGP sessions, OSPF adjacencies, layer-2/layer-3 topologies, and active routing tables without touching production hardware.
  4. Configuration Compliance: Instantly flag structural anomalies, missing baseline settings, or undefined references across device configs.

Architecture and Design

batfish-q-mcp is designed to run cleanly alongside your standard Batfish analysis container using a decoupled architecture:

  • The Batfish Engine: The core Java-based container (batfish/allinone) that parses configurations, builds the data plane, and performs the mathematical verification.
  • The MCP Server: A lightweight Python-based server implementing the Model Context Protocol that translates AI tool calls into structured Batfish API interactions.

Looking Ahead

Network automation is moving rapidly toward model-driven, intent-based architectures. By combining formal verification engines like Batfish with flexible agentic interfaces via MCP, we can dramatically lower the barrier to rigorous network testing.

Head over to the GitHub Repository to check out the code, open an issue, or contribute ideas. I’d love to hear how you’re incorporating AI-driven verification into your NetDevOps pipelines!