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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

networkx_mcp_server-2.0.0.tar.gz (447.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

networkx_mcp_server-2.0.0-py3-none-any.whl (207.7 kB view details)

Uploaded Python 3

File details

Details for the file networkx_mcp_server-2.0.0.tar.gz.

File metadata

  • Download URL: networkx_mcp_server-2.0.0.tar.gz
  • Upload date:
  • Size: 447.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for networkx_mcp_server-2.0.0.tar.gz
Algorithm Hash digest
SHA256 259f2a591491dc9eb8b67205914ba4e7dbbab5934a485e799ca80bb1d152e1b7
MD5 9df4230cfd451b1ad8b0744c64d9dfb6
BLAKE2b-256 d94bdb832d2222a7f7533ba5e6d4eeb511b6b611bfbb8af8b86e145b79d6006e

See more details on using hashes here.

File details

Details for the file networkx_mcp_server-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for networkx_mcp_server-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2c3fbbc6806875d2f79f20dd445f0b99242b062ff474517dfc1c4b2adee83416
MD5 23058b1b2ba659acf86903f0479e31a0
BLAKE2b-256 47acfa61b4b38d8120de067e2e8fd909b1342cb11384bb589f63ac2073c82920

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 files

1.1.0

2 files

1.0.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page