Skip to main content

NetworkX MCP Server

The first NetworkX integration for Model Context Protocol - Bringing graph analysis directly into your AI conversations.

Python NetworkX MCP License: MIT Enterprise

🚀 What is this?

NetworkX MCP Server enables Large Language Models (like Claude) to perform graph analysis operations directly within conversations. No more context switching between tools - analyze networks, find communities, calculate centrality, and visualize graphs all through natural language.

🎯 Key Features

  • 13 Essential Graph Operations: From basic graph creation to advanced algorithms like PageRank and community detection
  • Visualization: Generate graph visualizations on-demand with multiple layout options
  • Import/Export: Load graphs from CSV, export to JSON
  • Zero Setup: Works immediately with Claude Desktop or any MCP-compatible client
  • First of Its Kind: The first NetworkX server in the MCP ecosystem

🌟 Why NetworkX MCP Server?

  • Natural Language Graph Analysis: Describe what you want to analyze in plain English
  • No Database Required: Unlike graph database integrations, this works with in-memory graphs
  • Instant Insights: Get centrality metrics, find communities, and discover patterns immediately
  • Visual Understanding: See your graphs, don't just analyze them
  • Enterprise Ready: Production-grade security, monitoring, and scale (Enterprise Edition)

📊 Editions

Community Edition (Free)

  • 13 Graph Operations: Complete NetworkX functionality
  • Visualization: PNG output with multiple layouts
  • Import/Export: CSV and JSON support
  • Zero Setup: Works with Claude Desktop immediately
pip install networkx-mcp-server

🏢 Enterprise Edition

  • Everything in Community Edition +
  • 🔐 Enterprise Security: OAuth 2.1, API keys, RBAC
  • ⚡ Rate Limiting: Per-user and per-operation quotas
  • 📊 Monitoring: Prometheus metrics, audit logging
  • 🛡️ Input Validation: Comprehensive security validation
  • 📈 Resource Control: Memory and execution limits
  • 🚀 Production Ready: Health checks, Docker support
pip install networkx-mcp-server[enterprise]

📖 Enterprise Guide | Demo | Security

📊 Available Operations

Core Operations

  • create_graph - Create directed or undirected graphs
  • add_nodes - Add nodes to your graph
  • add_edges - Connect nodes with edges
  • get_info - Get basic graph statistics
  • shortest_path - Find optimal paths between nodes

Analysis Operations

  • degree_centrality - Find the most connected nodes
  • betweenness_centrality - Identify bridges and key connectors
  • pagerank - Google's PageRank algorithm for node importance
  • connected_components - Find isolated subgraphs
  • community_detection - Discover natural groupings

Visualization & I/O

  • visualize_graph - Create PNG visualizations with multiple layouts
  • import_csv - Load graphs from edge lists
  • export_json - Export graphs in standard formats

🚦 Quick Start

Community Edition

# Install community edition
pip install networkx-mcp-server

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "networkx": {
      "command": "networkx-mcp",
      "args": []
    }
  }
}

Enterprise Edition

# Install enterprise edition with security features
pip install networkx-mcp-server[enterprise]

# Set up authentication (generate secure key)
export NETWORKX_MCP_SECURITY_API_KEYS="$(python -c 'import secrets; print(secrets.token_urlsafe(32))')"

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "networkx-enterprise": {
      "command": "networkx-mcp-enterprise",
      "args": [],
      "env": {
        "NETWORKX_MCP_SECURITY_API_KEYS": "your-secure-api-key-here",
        "NETWORKX_MCP_RATE_LIMIT_ENABLED": "true",
        "NETWORKX_MCP_MONITORING_METRICS_ENABLED": "true"
      }
    }
  }
}

📖 Complete Enterprise Setup Guide

Basic Usage Example

Human: Create a social network graph and analyze it

Claude: I'll help you create and analyze a social network graph.

[Creates graph "social_network"]
[Adds nodes: Alice, Bob, Charlie, David, Eve]
[Adds edges: Alice-Bob, Alice-Charlie, Bob-Charlie, Bob-David, Charlie-Eve]

Now let me analyze this network:

[Calculates degree centrality]
Most connected: Bob and Charlie (degree centrality: 0.75)

[Calculates betweenness centrality]
Key bridges: Charlie (betweenness: 0.58) - connects different parts of the network

[Detects communities]
Found 2 communities: [Alice, Bob, Charlie] and [David, Eve]

[Visualizes the graph]
Here's what your social network looks like: [displays graph image]

🎓 Example Use Cases

1. Social Network Analysis

  • Identify influencers and key connectors
  • Find communities and cliques
  • Analyze information flow patterns

2. Transportation Planning

  • Find shortest routes between locations
  • Identify critical intersections
  • Analyze network resilience

3. Knowledge Graphs

  • Map concept relationships
  • Find learning paths
  • Identify prerequisite chains

See the demos/ folder for complete examples.

📈 Performance

  • Memory: ~70MB (including Python, NetworkX, and visualization)
  • Graph Size: Tested up to 10,000 nodes
  • Operations: Most complete in milliseconds
  • Visualization: 1-2 seconds for complex graphs

🛠️ Development

Running from Source

# Clone the repository
git clone https://github.com/Bright-L01/networkx-mcp-server
cd networkx-mcp-server

# Install dependencies
pip install -e .

# Run the server
python -m networkx_mcp.server_minimal

Running Tests

pytest tests/working/

📚 Documentation

🤝 Contributing

We welcome contributions! This is the first NetworkX MCP server, and there's lots of room for improvement:

  • Add more graph algorithms
  • Improve visualization options
  • Add graph file format support
  • Optimize performance
  • Write more examples

📄 License

MIT License - See LICENSE for details.

🙏 Acknowledgments

  • NetworkX - The amazing graph library that powers this server
  • Anthropic - For creating the Model Context Protocol
  • The MCP community - For inspiration and examples

Built with ❤️ for the AI and Graph Analysis communities

Metadata

Release files for networkx-mcp-server 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for networkx-mcp-server 2.0.0
File Size Uploaded
networkx_mcp_server-2.0.0.tar.gz 447.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for networkx-mcp-server 2.0.0
File Interpreter ABI Platform
networkx_mcp_server-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 654.9 kB

Release files / networkx_mcp_server-2.0.0.tar.gz

Download URL networkx_mcp_server-2.0.0.tar.gz
Size 447.3 kB
Tags Source
SHA-256 checksum
How to use checksums
259f2a591491dc9eb8b67205914ba4e7dbbab5934a485e799ca80bb1d152e1b7
BLAKE2b-256 checksum
How to use checksums
d94bdb832d2222a7f7533ba5e6d4eeb511b6b611bfbb8af8b86e145b79d6006e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / networkx_mcp_server-2.0.0-py3-none-any.whl

Download URL networkx_mcp_server-2.0.0-py3-none-any.whl
Size 207.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2c3fbbc6806875d2f79f20dd445f0b99242b062ff474517dfc1c4b2adee83416
BLAKE2b-256 checksum
How to use checksums
47acfa61b4b38d8120de067e2e8fd909b1342cb11384bb589f63ac2073c82920
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.1.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page