home / mcp / networkx graph mcp server

NetworkX Graph MCP Server

State/decision graph MCP server using NetworkX with import/export and visualization capabilities.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "inbarajaldrin-networkx-graph-mcp-server": {
      "command": "~/Documents/networkx-graph-mcp-server/.venv/bin/python",
      "args": [
        "-m",
        "networkx_graph"
      ]
    }
  }
}

You run a state and decision graph MCP server built with NetworkX to model directed graphs, explicit edge ordering, and conditional branches. It supports import/export and visualization, enabling you to define, execute, and inspect complex decision flows inside a consistent MCP framework.

How to use

To use this MCP server, connect an MCP client that can load and drive graph-based processes. You can create, modify, and inspect graphs, export or import graph definitions, and visualize the graph structure and run results. Use the provided tools to manage nodes, edges, and graph metadata, and leverage the web visualization for interactive exploration.

Typical workflows include creating a state graph, adding nodes and edges with explicit order, setting conditions on edges to direct flow, exporting the graph for backup or sharing, and using the visualization to understand graph topology and execution paths.

How to install

Prerequisites: you need Python and a compatible shell environment. You will also use a language-specific virtual environment tool and a package manager compatible with your setup.

Step 1: Open a terminal and navigate to your project directory.

Step 2: Create and activate the virtual environment, then synchronize dependencies.

Step 3: Start the MCP server client configuration for local operation.

cd ~/Documents/networkx-graph-mcp-server
uv venv
source .venv/bin/activate
uv sync

Configuration and visualization

Configure the MCP client to connect to this server using a local stdio setup. The client configuration points to the Python module that runs the server.

{
  "mcpServers": {
    "networkx-graph": {
      "disabled": false,
      "timeout": 60,
      "type": "stdio",
      "command": "~/Documents/networkx-graph-mcp-server/.venv/bin/python",
      "args": ["-m", "networkx_graph"]
    }
  }
}

Web Visualization

You can run the interactive web browser visualization to load YAML/JSON graph files, explore nodes and edges, and view statistics. Start the app and open the browser at the given URL.

uv run app.py

Available tools

Graph

Manage the overall graph structure: create, delete, list state graphs, and fetch graph info.

Nodes

Manage graph nodes: add, update, remove, fetch single nodes, and list all nodes.

Edges

Manage connections: add/remove edges, view edges, set edge order, set edge conditions, and retrieve node edges.

Bulk

Perform bulk operations to add multiple nodes or edges at once.

Export/Visualize

Export or import graphs in YAML/JSON format and render a PNG visualization of the graph.

Analysis

Run validation, compute graph statistics, and find paths through the graph.