Apstra MCP Server

Apstra MCP Server

Enables natural language management of Juniper Apstra datacenter networks, including blueprints, virtual networks, connectivity templates, and deployment.

Category
访问服务器

README

Apstra MCP Server

A Model Context Protocol (MCP) server that provides tools for interacting with Juniper Apstra Fabric Manager APIs. Enables Claude and other MCP clients to manage datacenter network infrastructure through natural language commands.

Features

  • Blueprint Management: Create, retrieve, and delete blueprint configurations
  • Infrastructure Queries: Get rack, routing zone, and system information
  • Network Provisioning: Create virtual networks with advanced configuration options and remote gateways
  • Connectivity Templates: Manage connectivity templates and application endpoint assignments
  • Policy Management: Apply and remove connectivity template policies from application endpoints
  • Configuration Management: Check deployment status and deploy configurations
  • Protocol Monitoring: Monitor BGP and other protocol sessions
  • Anomaly Detection: Retrieve and analyze blueprint anomalies
  • Native Streaming Support: Real-time updates with Server-Sent Events

Quick Start

Local Usage (stdio)

# Create config file
cp apstra_config_sample.json apstra_config.json
# Edit with your Apstra server details

# Run with stdio transport
python3 apstra_mcp.py -t stdio -f apstra_config.json

Network Deployment (Streamable HTTP)

Docker (Recommended)

# Clone and configure
git clone <this-repo>
cd apstra-mcp-server
cp apstra_config_sample.json apstra_config.json
# Edit config with your Apstra details

# Start HTTP streaming server
docker-compose up -d

Direct Python

# Install dependencies
pip install -r requirements.txt

# Start streamable HTTP server
python3 apstra_mcp.py -t streamable-http -H 0.0.0.0 -p 8080 -f apstra_config.json

Installation

Prerequisites

  • Python 3.7+
  • Access to Juniper Apstra server
  • Valid Apstra credentials

Dependencies

pip install -r requirements.txt

Available Tools (21 total)

Health & Status Tools (2 tools)

  • health() - Server health check and Apstra connectivity status
  • formatting_guidelines() - Get formatting guidelines for network data presentation

Query Tools (12 tools)

  • get_bp() - Get blueprint information
  • get_racks(blueprint_id) - Get rack information
  • get_rz(blueprint_id) - Get routing zones
  • get_vn(blueprint_id) - Get virtual networks
  • get_ct(blueprint_id) - Get connectivity templates
  • get_app_ep(blueprint_id) - Get application endpoints for connectivity templates
  • get_system_info(blueprint_id) - Get system/device information
  • get_protocol_sessions(blueprint_id) - Get protocol sessions
  • get_anomalies(blueprint_id) - Get blueprint anomalies
  • get_remote_gw(blueprint_id) - Get remote gateways
  • get_diff_status(blueprint_id) - Get deployment diff status
  • get_templates() - Get available templates

Management Tools (3 tools)

  • deploy(blueprint_id, description, staging_version) - Deploy configurations
  • delete_blueprint(blueprint_id) - Delete blueprints
  • apply_ct_policies(blueprint_id, application_points) - Apply/remove connectivity template policies to application endpoints

Create Tools (4 tools)

  • create_vn(blueprint_id, security_zone_id, vn_name, virtual_gateway_ipv4, ipv4_subnet, ...) - Create virtual networks with advanced configuration options
  • create_remote_gw(blueprint_id, gw_ip, gw_asn, gw_name, local_gw_nodes, ...) - Create remote gateways
  • create_datacenter_blueprint(blueprint_name, template_id) - Create datacenter blueprints
  • create_freeform_blueprint(blueprint_name) - Create freeform blueprints

Security Model

stdio Transport (Default)

  • Secure by default with no network exposure
  • Uses configuration file credentials
  • Ideal for Claude Desktop integration

streamable-http Transport

  • Network-accessible with native FastMCP streaming capabilities
  • Automatic SSE upgrades for real-time updates
  • Single container deployment

Claude Desktop Configuration

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "apstra": {
      "command": "uv",
      "args": [
        "run",
        "--with",
        "fastmcp,httpx",
        "python3",
        "/path/to/apstra_mcp.py",
        "-f",
        "/path/to/apstra_config.json"
      ]
    }
  }
}

Update the paths to match your installation directory.

Usage Examples

With Claude Desktop

  • "Show me all blueprints in the system"
  • "Create a virtual network called 'web-tier' with gateway 192.168.1.1 and subnet 192.168.1.0/24"
  • "Get all connectivity templates in blueprint X"
  • "Apply connectivity template policy Y to interface Z"
  • "Show me application endpoints for connectivity templates"
  • "Deploy the staging configuration"
  • "Check for any anomalies in blueprint X"

Streaming HTTP Client

The server exposes native FastMCP endpoints on /mcp/* with automatic SSE upgrades for streaming responses.

Architecture

  • FastMCP Framework: Native transport system with automatic SSE streaming
  • Config-based Authentication: Simple stateless operation with direct Apstra API auth
  • Single Container: HTTP server on port 8080 with streamable-http transport

Documentation

  • DEPLOYMENT.md - Complete deployment guide with examples
  • CLAUDE.md - Technical implementation details and development guide

Troubleshooting

  • Authentication fails: Check credentials and server connectivity
  • Tools not appearing: Verify server startup in Claude Desktop logs
  • Transport errors: Ensure FastMCP version compatibility
  • Docker issues: Check docker-compose logs

License

This project is provided as-is for educational and demonstration purposes.


Blog Post: MCP for Datacenter Networks

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选