# ashwinjo/ixnetwork-mcp architecture

> Architecture diagram of the GitHub repository ashwinjo/ixnetwork-mcp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ashwinjo/ixnetwork-mcp
- Repository: https://github.com/ashwinjo/ixnetwork-mcp

## Overview

##### Project Type & Purpose
- This is an open-source Python tool implementing the MCP (Model Context Protocol) to let LLM-based clients (e.g. Claude Desktop) manage IxNetwork Web Sessions.
- It exposes a server (server.py) that speaks MCP and translates requests into IxNetwork REST API calls, using configuration files for session definitions.

##### File Structure Analysis (exclude docs & metadata)
- main.py – CLI entrypoint or local client harness
- server.py – ASGI-compatible MCP server (likely FastAPI + uvicorn)
- ixnetwork_config.json & ixia_configuration_files/*.ixncfg – configuration store for IxNetwork sessions
- pyproject.toml & uv.lock – Python project metadata and lock file

##### Key Components
A. LLM Client
- External application (e.g. Claude Desktop) that drives the conversation via MCP.
B. MCP Server
- Written in Python, spun up by server.py under uvicorn.
- Modules inside:
- SessionManager – creates/views/deletes IxNetwork sessions
- ProtocolController – starts/stops protocols/tests
- TrafficViewer – retrieves traffic item stats
C. Configuration Store
- JSON + .ixncfg files loaded at startup or on demand.
D. IxNetwork REST API
- External service endpoint exposed by IxNetwork Web Sessions.

##### Interactions & Data Flow
1) LLM Client → MCP Server: MCP protocol over HTTP/WebSocket (JSON-RPC style)
2) MCP Server → Config Store: file I/O (load/save session definitions)
3) MCP Server → IxNetwork REST API: HTTP calls to create/manage sessions and traffic
4) IxNetwork REST API → MCP Server → LLM Client: response payloads (status, stats)

##### Architectural Patterns & Design Principles
- Adapter/Bridge pattern for each integration point (MCP ↔ IxNetwork).
- Configuration-driven design: behavior changes by swapping JSON or .ixncfg.
- Separation of concerns: protocol handling, business logic (session/test control), config I/O, external API client.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Systems
    LLMC["LLM Client"]:::external
    IXAPI["IxNetwork REST API"]:::external

    %% Configuration Store
    ConfigJSON[(ixnetwork_config.json)]:::config
    ConfigDir[(ixia_configuration_files/)]:::config

    %% CLI Local Client
    CLI["CLI Local Client"]:::internal

    %% MCP Server and Sub-modules
    subgraph "MCP Server"
        direction TB
        SP["server.py"]:::internal
        MS["SessionManager"]:::internal
        PC["ProtocolController"]:::internal
        TV["TrafficViewer"]:::internal
    end

    %% Interactions
    LLMC -->|"MCP Request/Response"| SP
    CLI -->|"Local Harness"| SP
    SP -->|"delegates"| MS
    SP -->|"delegates"| PC
    SP -->|"delegates"| TV
    MS -->|"File I/O"| ConfigJSON
    MS -->|"File I/O"| ConfigDir
    PC -->|"REST API Call"| IXAPI
    TV -->|"REST API Call"| IXAPI
    IXAPI -->|"Response"| SP
    SP -->|"MCP Response"| LLMC

    %% Click Events
    click CLI "https://github.com/ashwinjo/ixnetwork-mcp/blob/main/main.py"
    click SP "https://github.com/ashwinjo/ixnetwork-mcp/blob/main/server.py"
    click MS "https://github.com/ashwinjo/ixnetwork-mcp/blob/main/server.py"
    click PC "https://github.com/ashwinjo/ixnetwork-mcp/blob/main/server.py"
    click TV "https://github.com/ashwinjo/ixnetwork-mcp/blob/main/server.py"
    click ConfigJSON "https://github.com/ashwinjo/ixnetwork-mcp/blob/main/ixnetwork_config.json"
    click ConfigDir "https://github.com/ashwinjo/ixnetwork-mcp/tree/main/ixia_configuration_files/"

    %% Styles
    classDef internal fill:#cce5ff,stroke:#333,stroke-width:1px;
    classDef external fill:#d4edda,stroke:#333,stroke-width:1px;
    classDef config fill:#e2e3e5,stroke:#666,stroke-dasharray: 2 2;
    class SP,MS,PC,TV,CLI internal;
    class LLMC,IXAPI external;
    class ConfigJSON,ConfigDir config;
```
