Skip to main content
Glama
NetworkX Graph MCP Server

NetworkX Graph MCP Server

NetworkX Graph MCP Server

State/decision graph MCP server using NetworkX. Supports directed graphs (cycles allowed), explicit edge ordering, conditional branches, import/export, and visualization.

Setup

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

MCP client config (example)

Add to your mcp_config.json:

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

Tools (summary)

  • Graph: create_state_graph, delete_state_graph, list_state_graphs, get_state_graph_info

  • Nodes: add_node, update_node, remove_node, get_node, list_nodes

  • Edges: add_edge, remove_edge, get_edges, set_edge_order, set_edge_condition, get_node_edges

  • Bulk: bulk_add_nodes, bulk_add_edges

  • Export/Visualize: export_graph (yaml/json), import_graph, visualize_graph (PNG)

  • Analysis: validate_graph (warnings only, cycles allowed), get_graph_stats, find_path

Web Visualization

Interactive web browser for visualizing graphs:

uv run app.py

Then open your browser to: http://localhost:5000

Features:

  • Load YAML/JSON graph files via file upload

  • Interactive graph visualization with zoom, pan, and node selection

  • View node details, statistics, and graph structure

  • Color-coded nodes by type (action, decision, verification, loop, success, failure)

Available Tools

24 tools
add_edgeC

Add an edge with order and optional condition.

Inputs: graph_id (required), from (required), to (required), order, +2 more.

add_nodeC

Add a node (action/decision/verification/loop/success/failure).

Inputs: graph_id (required), node_id (required), node_type (required), label, +3 more.

bulk_add_edgesC

Add multiple edges at once (with order/condition).

Inputs: graph_id (required), edges (required).

bulk_add_nodesB

Add multiple nodes at once (parents before children).

Inputs: graph_id (required), nodes (required).

create_state_graphC

Create a new state/decision graph (directed, cycles allowed).

Inputs: graph_id (required).

delete_state_graphC

Delete a state graph.

Inputs: graph_id (required).

export_graphC

Export graph to YAML or JSON file.

Inputs: graph_id (required), format, output_dir, filename.

find_pathC

Find shortest path between two nodes.

Inputs: graph_id (required), from (required), to (required).

get_edgesC

Get edges (optionally filter by node).

Inputs: graph_id (required), node_id.

get_execution_sequenceA

Get nodes in execution order from a start node, following edges by order attribute. Stops at first decision node by default. Returns sequence of nodes with their details.

Inputs: graph_id (required), from (required), until_decision.

get_graph_statsC

Get statistics: node counts by type, edges, phases, decision points, loops.

Inputs: graph_id (required).

get_nodeD

Get node details.

Inputs: graph_id (required), node_id (required).

get_node_edgesC

Get incoming/outgoing edges for a node.

Inputs: graph_id (required), node_id (required).

get_state_graph_infoC

Get graph metadata and stats.

Inputs: graph_id (required).

import_graphC

Import graph from YAML or JSON file.

Inputs: graph_id (required), path (required).

list_nodesD

List all nodes.

Inputs: graph_id (required).

list_state_graphsB

List all available state graph files on disk (memory resets each session, so this scans for YAML/JSON files in graphs directories). Returns file paths that can be imported.

Inputs: directory.

remove_edgeD

Remove an edge.

Inputs: graph_id (required), from (required), to (required).

remove_nodeD

Remove a node.

Inputs: graph_id (required), node_id (required).

set_edge_conditionC

Set condition label for an edge.

Inputs: graph_id (required), from (required), to (required), condition.

set_edge_orderC

Set execution order for an edge.

Inputs: graph_id (required), from (required), to (required), order (required).

update_nodeC

Update node properties (label, phase, tool, properties).

Inputs: graph_id (required), node_id (required), label, phase, +2 more.

validate_graphC

Validate graph structure (cycles allowed, warnings only).

Inputs: graph_id (required).

visualize_graphB

Render graph to PNG file (saves to disk, not base64).

Inputs: graph_id (required), layout, output_dir, filename, +1 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.8/5.0

    Scored across 24 tools

    Disambiguation4/5

    Most tools have distinct purposes, such as add_edge vs. add_node or get_edges vs. get_node_edges, but some overlap exists, like get_graph_stats and get_state_graph_info both providing statistical insights, which could cause mild confusion. The descriptions generally clarify differences, but the overlap in statistical tools is noticeable.

    Naming Consistency5/5

    Tool names follow a consistent verb_noun pattern throughout, such as add_edge, remove_node, and validate_graph, with no deviations in style or convention. This predictability makes it easy for agents to understand and use the tool set without naming confusion.

    Tool Count3/5

    With 24 tools, the count is borderline high for a graph management server, as it includes many specific operations like set_edge_condition and visualize_graph that might be consolidated. While comprehensive, it feels slightly heavy compared to typical well-scoped sets of 3-15 tools, potentially overwhelming for agents.

    Completeness5/5

    The tool set provides complete CRUD/lifecycle coverage for graph management, including creation (create_state_graph), reading (get_node, list_nodes), updating (update_node, set_edge_order), deletion (delete_state_graph, remove_node), and additional utilities like import/export, validation, and visualization. No obvious gaps exist for the domain.

    Related MCP Connectors

    Related MCP Servers