SD-WAN MCP Server

SD-WAN MCP Server

Enables monitoring and management of SD-WAN devices through REST API endpoints, with tools for device health, statistics, BFD sessions, and network analytics. Integrates with Cursor IDE for natural language queries.

Category
访问服务器

README

SD-WAN MCP Server

A comprehensive Model Context Protocol (MCP) server for monitoring and managing SD-WAN devices through REST API endpoints. This server exposes SD-WAN device monitoring and management functionality that can be integrated with Cursor and other MCP-compatible tools.

License Python MCP

🚀 Features

  • 🔧 Device Management: List and monitor SD-WAN fabric devices
  • 📊 Statistics Collection: Interface statistics, device counters, tunnel statistics
  • 🔍 BFD Monitoring: Bidirectional Forwarding Detection state and sessions
  • ⚙️ Configuration Access: Device configuration retrieval
  • 📈 Advanced Analytics: Health summaries, traffic analysis, and alerting
  • 🔐 Session Management: Automatic authentication and session handling
  • ⚡ Async Support: Full async/await support for non-blocking operations
  • 🎯 Cursor Integration: Seamless integration with Cursor IDE

📋 Available Tools

Basic Monitoring Tools

  1. get_fabric_devices - Get list of all SD-WAN fabric devices
  2. get_device_monitor - Get SD-WAN device monitoring information
  3. get_device_counters - Get SD-WAN device counters and statistics
  4. get_interface_statistics - Get interface statistics for all SD-WAN devices
  5. get_device_config - Get SD-WAN device configuration (requires device_id)
  6. get_bfd_state - Get BFD state for an SD-WAN device (requires device_id)
  7. get_bfd_sessions - Get BFD sessions for an SD-WAN device (requires device_id)
  8. get_tunnel_statistics - Get tunnel statistics for an SD-WAN device (requires device_id)

Authentication Tools

  1. authenticate - Authenticate with the SD-WAN management server
  2. get_session_status - Check current authentication session status

Advanced Analytics Tools

  1. get_device_health_summary - Comprehensive health summary across all SD-WAN devices
  2. filter_devices_by_status - Filter SD-WAN devices by operational status
  3. get_top_interfaces_by_traffic - Get top interfaces ranked by traffic utilization
  4. check_bfd_session_health - Monitor BFD session health across all SD-WAN devices
  5. generate_network_report - Generate comprehensive SD-WAN network status report
  6. get_device_alerts - Get alerts and warnings for SD-WAN devices by severity
  7. monitor_interface_utilization - Monitor interface utilization with configurable thresholds
  8. get_network_topology - Get SD-WAN network topology information

🛠️ Quick Start

Prerequisites

  • Python 3.8 or higher
  • Access to SD-WAN management server
  • Cursor IDE (for integration)

Installation

  1. Clone the repository

    git clone https://github.com/yourusername/sdwan-mcp-server.git
    cd sdwan-mcp-server
    
  2. Install dependencies

    pip install -r requirements.txt
    
  3. Configure environment variables

    # Copy the example environment file
    cp .env.example .env
    
    # Edit .env with your settings
    nano .env
    
  4. Update configuration

    ⚠️ IMPORTANT: You must update the IP address in your configuration!

    Edit your .env file:

    # REQUIRED: Change this to your SD-WAN management server IP
    SDWAN_BASE_URL="https://YOUR_SDWAN_SERVER_IP:8443"
    
    # Update credentials
    SDWAN_USERNAME="your_username"
    SDWAN_PASSWORD="your_password"
    
    # Optional settings
    VERIFY_SSL="false"
    LOG_LEVEL="INFO"
    
  5. Test the server

    python test_client.py
    
  6. Run the server

    python main.py
    

⚙️ Configuration

Environment Variables

Variable Description Default Required
SDWAN_BASE_URL SD-WAN server base URL https://192.168.10.130:8443 YES
SDWAN_USERNAME Authentication username admin YES
SDWAN_PASSWORD Authentication password 1 YES
VERIFY_SSL Enable SSL certificate verification false No
LOG_LEVEL Logging level (DEBUG, INFO, WARNING, ERROR) INFO No
SESSION_TIMEOUT Session timeout in seconds 3600 No
AUTO_RECONNECT Auto-reconnect on session expiry true No

Configuration Methods

Method 1: Environment Variables (Recommended)

export SDWAN_BASE_URL="https://your-sdwan-server:8443"
export SDWAN_USERNAME="admin"
export SDWAN_PASSWORD="your_password"
python main.py

Method 2: .env File

# Create .env file
echo "SDWAN_BASE_URL=https://your-sdwan-server:8443" > .env
echo "SDWAN_USERNAME=admin" >> .env
echo "SDWAN_PASSWORD=your_password" >> .env
python main.py

Method 3: Direct Configuration

Edit config.py to change default values (not recommended for production).

🔧 Cursor Integration

Option 1: MCP Configuration File

  1. Create or update your MCP configuration file:

    {
      "mcpServers": {
        "sdwan-mcp-server": {
          "command": "python",
          "args": ["/full/path/to/your/project/main.py"],
          "env": {
            "SDWAN_BASE_URL": "https://your-sdwan-server:8443",
            "SDWAN_USERNAME": "admin",
            "SDWAN_PASSWORD": "your_password"
          }
        }
      }
    }
    
  2. Update the path to point to your main.py file

  3. Restart Cursor

Option 2: Cursor Settings

Add to your Cursor settings:

{
  "mcp": {
    "servers": {
      "sdwan-mcp-server": {
        "command": "python",
        "args": ["/full/path/to/main.py"]
      }
    }
  }
}

💡 Usage Examples

Once integrated with Cursor, you can use natural language queries:

Basic Queries

  • "Show me all SD-WAN fabric devices"
  • "Get the SD-WAN interface statistics"
  • "Check BFD state for SD-WAN device 200.0.1.1"
  • "Get tunnel statistics for SD-WAN device 200.0.2.2"

Advanced Analytics

  • "Give me a comprehensive health summary of the SD-WAN network"
  • "Show me all SD-WAN devices that are currently down"
  • "What are the top 10 interfaces by traffic volume?"
  • "Generate a full SD-WAN network report"
  • "Which interfaces are using more than 80% bandwidth?"

Troubleshooting

  • "Check if I'm authenticated to the SD-WAN server"
  • "Show me all critical alerts in the SD-WAN network"
  • "What SD-WAN devices need immediate attention?"

🏗️ Project Structure

sdwan-mcp-server/
├── main.py              # Main MCP server implementation
├── config.py            # Configuration management
├── test_client.py       # Test client for validation
├── requirements.txt     # Python dependencies
├── setup.py            # Package setup
├── mcp_config.json     # MCP configuration template
├── .env.example        # Environment variables template
├── .gitignore          # Git ignore file
├── LICENSE             # MIT license
└── README.md           # This file

🔍 API Endpoints

The server connects to these SD-WAN management API endpoints:

  • /dataservice/device - Fabric devices
  • /dataservice/device/monitor - Device monitoring
  • /dataservice/device/counters - Device counters
  • /dataservice/statistics/interface - Interface statistics
  • /dataservice/device/config - Device configuration
  • /dataservice/device/bfd/state/device - BFD state
  • /dataservice/device/bfd/sessions - BFD sessions
  • /dataservice/device/tunnel/statistics - Tunnel statistics

🐛 Troubleshooting

Common Issues

  1. Connection Errors

    # Check if your SD-WAN server is accessible
    curl -k https://YOUR_SDWAN_SERVER_IP:8443
    
  2. Authentication Errors

    # Verify credentials
    export SDWAN_USERNAME="correct_username"
    export SDWAN_PASSWORD="correct_password"
    
  3. SSL Certificate Issues

    # Disable SSL verification for self-signed certificates
    export VERIFY_SSL="false"
    
  4. Import Errors

    # Install missing dependencies
    pip install -r requirements.txt
    

Debug Mode

Enable detailed logging:

export LOG_LEVEL="DEBUG"
python main.py

Testing Connection

# Test authentication
python -c "
import asyncio
from main import SDWANMCPServer
async def test():
    server = SDWANMCPServer()
    result = await server._authenticate()
    print(result)
asyncio.run(test())
"

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

🆘 Support

🙏 Acknowledgments


⚠️ Remember: Always update the SDWAN_BASE_URL to match your SD-WAN management server's IP address!

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选