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.
- 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
# 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# 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# 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- Python 3.7+
- Access to Juniper Apstra server
- Valid Apstra credentials
pip install -r requirements.txthealth()- Server health check and Apstra connectivity statusformatting_guidelines()- Get formatting guidelines for network data presentation
get_bp()- Get blueprint informationget_racks(blueprint_id)- Get rack informationget_rz(blueprint_id)- Get routing zonesget_vn(blueprint_id)- Get virtual networksget_ct(blueprint_id)- Get connectivity templatesget_app_ep(blueprint_id)- Get application endpoints for connectivity templatesget_system_info(blueprint_id)- Get system/device informationget_protocol_sessions(blueprint_id)- Get protocol sessionsget_anomalies(blueprint_id)- Get blueprint anomaliesget_remote_gw(blueprint_id)- Get remote gatewaysget_diff_status(blueprint_id)- Get deployment diff statusget_templates()- Get available templates
deploy(blueprint_id, description, staging_version)- Deploy configurationsdelete_blueprint(blueprint_id)- Delete blueprintsapply_ct_policies(blueprint_id, application_points)- Apply/remove connectivity template policies to application endpoints
create_vn(blueprint_id, security_zone_id, vn_name, virtual_gateway_ipv4, ipv4_subnet, ...)- Create virtual networks with advanced configuration optionscreate_remote_gw(blueprint_id, gw_ip, gw_asn, gw_name, local_gw_nodes, ...)- Create remote gatewayscreate_datacenter_blueprint(blueprint_name, template_id)- Create datacenter blueprintscreate_freeform_blueprint(blueprint_name)- Create freeform blueprints
- Secure by default with no network exposure
- Uses configuration file credentials
- Ideal for Claude Desktop integration
- Network-accessible with native FastMCP streaming capabilities
- Automatic SSE upgrades for real-time updates
- Single container deployment
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.
- "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"
The server exposes native FastMCP endpoints on /mcp/* with automatic SSE upgrades for streaming responses.
- 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
- DEPLOYMENT.md - Complete deployment guide with examples
- CLAUDE.md - Technical implementation details and development guide
- 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
This project is provided as-is for educational and demonstration purposes.
Blog Post: MCP for Datacenter Networks