集成Infoblox的多代理MCP平台
生产就绪的模型上下文协议(MCP)服务器,提供与Infoblox BloxOne平台的全面集成,用于IPAM、DNS、DHCP、VPN和安全操作。
  
______________________________________________________________________
概述
此多代理平台公开 48+企业级工具 用于管理Infoblox BloxOne基础设施,使AI代理能够通过自然语言执行网络操作。具有生产功能,包括可观察性、缓存、断路器和分布式跟踪。
关键能力
- IPAM管理:IP空间、地址块、子网、范围、固定地址
- DNS操作:A、AAAA、CNAME、MX、TXT、PTR、SRV记录,带区域管理
- VPN配置:端到端NIOSXaaS VPN服务创建和管理
- 安全:具有威胁情报和内容过滤的DNS防火墙(Atcfw/DFP)
- 联邦:跨分布式部署的服务发现和配置
- 洞察:网络分析和利用率报告
- 多代理编排:多个具有任务授权的专业代理
- 多LLM支持:Claude和OpenAI集成
生产特点
成本优化
- 工具筛选:代理商特定的工具限制,可降低75%的成本
- TOON格式化:压缩工具结果可节省30-60%的代币
- 快速缓存:Claude cache_control可节省90%的缓存令牌
- 结果截断:自动截断大型API响应(最多20项,20k个字符)以防止令牌溢出
- 综合影响:总成本降低约85%(每年节省约420美元)
A2A协议支持(新增)
- 代理卡发现:标准
/.well-known/agent.json代理发现端点 - 工具目录API:可过滤工具列表
/api/tools具有域/风险过滤功能 - 健康终点:
/health和/ready用于负载均衡器集成
企业可观察性
- Prometheus指标端点(
/metrics)用于监控 - Grafana可视化仪表板
- 代理工具执行中的OpenTetry分布式跟踪
- 带相关ID的结构化JSON日志记录
性能和可靠性
- 具有可配置TTL的响应缓存(重复查询速度提高3000倍)
- 针对API故障提供快速故障保护的断路器
- 具有可配置限制的请求超时处理
- 负载均衡器和Kubernetes的健康检查端点
可扩展性
- 具有并发客户端支持的多租户架构
- HTTP流传输(符合MCP规范,协议2025-06-18)
- SSE(服务器发送事件)传输可用作备份
- 连接池和资源优化
- 用于水平扩展的模块化服务客户端设计
云就绪部署
- Docker容器化支持
- AWS Fargate/ECS部署就绪
- API网关/ALB集成
- 基于指标的自动缩放
______________________________________________________________________
快速开始
先决条件
- Python 3.10+
- Infoblox BloxOne API密钥(从CSP门户获取)
- 可选:用于代理集成的Anthropic或OpenAI API密钥
安装
# Clone the repository
git clone https://github.com/iracic82/multiagent-mcp-platform.git
cd multiagent-mcp-platform
# Install dependencies
pip install -r requirements.txt
# Configure environment
cp .env.example .env
# Edit .env and add your INFOBLOX_API_KEY运行MCP服务器
# Start all HTTP MCP servers (recommended - spec-compliant)
./start_http_servers.sh
# Or start individual servers:
python mcp_infoblox_http.py # Port 4001/mcp (HTTP)
python mcp_server_http.py # Port 4002/mcp (HTTP)
python mcp_aws_http.py # Port 4003/mcp (HTTP)
python mcp_aws_cloudcontrol_http.py # Port 4004/mcp (HTTP)
# Legacy SSE transport (backup):
python mcp_infoblox.py # Port 3001/sse (SSE - deprecated)服务器公开了这些端点:
- HTTP端点:
http://localhost:4001/mcp(符合规范) - SSE端点:
http://localhost:3001/sse(备份/旧版)
Web服务器端点 (端口8000):
- 代理卡:
http://localhost:8000/.well-known/agent.json(A2A发现) - 健康:
http://localhost:8000/health(健康检查) - 准备:
http://localhost:8000/ready(准备就绪,组件状态) - 指标:
http://localhost:8000/metrics(普罗米修斯指标) - 工具:
http://localhost:8000/api/tools(可过滤的工具目录) - 注册表:
http://localhost:8000/api/registry(代理发现) - 双向通信:
ws://localhost:8000/ws(实时聊天)
测试服务器
# Test individual tools
python test_mcp_tools_direct.py
# Test production features
python test_caching.py # Caching performance
python test_circuit_breaker.py # Circuit breaker behavior
python test_metrics_server.py # Metrics collection
python test_tracing.py # Distributed tracing______________________________________________________________________
可用工具(48+)
IPAM Tools (18 tools)
list_ip_spaces-列出所有IP空间get_ip_space-按ID获取IP空间详细信息create_ip_space-创建新的IP空间list_address_blocks-列出地址块create_address_block-创建地址块list_subnets-列出使用率的子网create_subnet-创建新子网get_subnet-获取子网详细信息list_fixed_addresses-列出固定IP分配create_fixed_address-创建固定IP地址delete_fixed_address-删除固定IPget_next_available_ip-从范围内获取下一个免费IPallocate_next_ip-保留下一个可用IP- 还有更多。..
DNS Data Tools (15 tools)
list_dns_a_records-列表A记录create_a_record-创建记录update_a_record-更新A记录delete_a_record-删除A记录list_cname_records-列出CNAME记录create_cname_record-创建CNAMElist_mx_records-列出MX记录create_mx_record-创建MX记录list_txt_records-列出TXT记录create_txt_record-创建TXT记录list_ptr_records-列出PTR(反向DNS)- 还有更多。..
DNS Config Tools (8 tools)
list_auth_zones-列出权威区域create_auth_zone-创建DNS区域get_auth_zone-获取区域详细信息list_forward_zones-列出转发区域create_forward_zone-创建前进区域list_dns_views-列出DNS视图- 还有更多。..
VPN Tools (5 tools)
list_vpn_services-列出VPN服务create_vpn_service-创建VPN服务get_vpn_service-获取服务详细信息create_vpn_access_location-创建访问位置update_vpn_access_location-更新位置(隧道IP)
Security Tools (Atcfw/DFP)
list_security_policies-列出DNS防火墙策略create_security_policy-创建安全策略list_threat_feeds-列出威胁情报源- 还有更多。..
______________________________________________________________________
建筑
系统概述
┌─────────────────┐
│ MCP Clients │ (Claude Desktop, Custom Agents, etc.)
│ (SSE) │
└────────┬────────┘
│ SSE Transport (Port 3001)
▼
┌─────────────────────────────────────────────┐
│ Infoblox MCP Server │
│ ┌──────────────────────────────────────┐ │
│ │ FastMCP Framework │ │
│ │ - SSE Transport Handler │ │
│ │ - Tool Registry (48+ tools) │ │
│ │ - Request/Response Serialization │ │
│ └──────────────────────────────────────┘ │
│ ┌──────────────────────────────────────┐ │
│ │ Production Middleware │ │
│ │ - Response Caching (TTL-based) │ │
│ │ - Circuit Breakers │ │
│ │ - Request Timeouts │ │
│ │ - Metrics Collection │ │
│ │ - Distributed Tracing │ │
│ └──────────────────────────────────────┘ │
│ ┌──────────────────────────────────────┐ │
│ │ Service Clients (Module-level) │ │
│ │ - InfobloxClient (IPAM/DNS) │ │
│ │ - NIOSXaaSClient (VPN) │ │
│ │ - AtcfwClient (Security) │ │
│ │ - InsightsClient (Analytics) │ │
│ └──────────────────────────────────────┘ │
└────────┬───────────────────────────────────┘
│ HTTPS + Bearer Token Auth
▼
┌─────────────────────────────────────────────┐
│ Infoblox BloxOne Platform (SaaS) │
│ - IPAM API (IP spaces, subnets, IPs) │
│ - DNS Data API (records) │
│ - DNS Config API (zones, views) │
│ - NIOSXaaS API (VPN services) │
│ - Atcfw/DFP API (security policies) │
└─────────────────────────────────────────────┘多代理架构
┌──────────────────────────────────────────┐
│ Agent Orchestrator │
│ - Multi-agent coordination │
│ - Task delegation │
│ - LLM provider abstraction │
└────────┬─────────────────────────────────┘
│
┌────┴────┐
▼ ▼
┌─────────┐ ┌──────────────────┐
│ Main │ │ Network │
│ Agent │ │ Specialist │
│ │ │ Agent │
│ (Claude)│ │ (Claude/OpenAI) │
└────┬────┘ └────┬─────────────┘
│ │
└─────┬─────┘
│
▼
┌──────────────┐
│ MCP Client │
│ (Singleton) │
└──────┬───────┘
│
▼
[MCP Servers]多租户支持
MCP服务器作为 独立进程 并支持多个并发客户端连接:
- 苏格兰和南方能源公司运输:每个客户端都维护一个持久的SSE连接
- 共享服务客户端:模块级单例,有效利用资源
- 每个连接上下文:独立的请求/响应处理
- 集中式指标:所有连接共享同一个度量收集器
部署模式:
- 内部代理使用:具有MCP客户端单例的单个编排器
- 外部直接访问:多个客户端连接到SSE端点
- 混合:两种模式同时
______________________________________________________________________
可观测性
普罗米修斯指标
服务器公开了以下方面的详细指标 http://localhost:8001/metrics:
请求指标:
mcp_requests_total-按工具、客户端和状态列出的API请求总数mcp_request_duration_seconds-请求延迟直方图mcp_request_errors_total-按工具和错误类型列出的错误计数
缓存度量:
cache_hits_total-按工具分类的缓存命中次数cache_misses_total-缓存未命中计数cache_hit_rate-实时命中率百分比cache_size_bytes-当前缓存使用情况cache_entries_total-缓存条目数
断路器指标:
circuit_breaker_state-当前状态(0=关闭,1=打开,2=半打开)circuit_breaker_failures_total-连续故障计数circuit_breaker_successes_total-连续成功计数
系统指标:
active_connections-当前SSE连接uptime_seconds-服务器正常运行时间
Grafana仪表板
中提供了预配置的仪表板 docs/grafana/:
- MCP服务器概述:请求率、延迟、错误率
- 高速缓存性能:点击率、内存使用情况、驱逐统计数据
- 断路器状态:状态转换、故障率
- 客户分析:按客户端请求模式
分布式跟踪(Jaeger)
OpenTetry集成提供:
- 所有API调用的端到端请求跟踪
- 自动HTTP请求检测
- 亲子关系
- 错误跟踪和根本原因分析
- 服务依赖关系映射
查看痕迹: http://localhost:16686 (Jaeger用户界面)
______________________________________________________________________
生产部署
Docker部署
# Dockerfile included in repository
FROM python:3.10-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
EXPOSE 3001 8001
CMD ["python", "mcp_infoblox.py"]# Build and run
docker build -t infoblox-mcp-server .
docker run -p 3001:3001 -p 8001:8001 \
-e INFOBLOX_API_KEY=your_key \
-e INFOBLOX_BASE_URL=https://csp.infoblox.com \
infoblox-mcp-serverAWS Fargate部署
架构:
Internet → ALB → Fargate (MCP Server) → Infoblox API
↓
CloudWatch Logs
↓
Prometheus/Grafana关键部件:
- 应用程序负载平衡器:SSL终止、健康检查
- AWS Fargate:具有自动扩展功能的无服务器容器托管
- 云监控:日志聚合和监控
- 普罗米修斯:指标从
/metrics端点 - 猎手:分布式跟踪收集
优点:
- 基于CPU/内存或自定义指标的自动缩放
- 零服务器管理
- 多AZ高可用性
- 按使用付费定价
- 健康检查集成(
/health端点)
看 部署\_ GIDE.md 获取完整的部署说明。
______________________________________________________________________
配置
环境变量
# Infoblox API
INFOBLOX_API_KEY=your_api_key_here
INFOBLOX_BASE_URL=https://csp.infoblox.com
# Performance
CACHE_ENABLED=true
CACHE_TTL=300 # 5 minutes default
REQUEST_TIMEOUT=30 # seconds
# Circuit Breaker
CIRCUIT_BREAKER_ENABLED=true
CIRCUIT_BREAKER_FAILURE_THRESHOLD=5
CIRCUIT_BREAKER_TIMEOUT=60 # seconds
# Observability
TRACING_ENABLED=true
JAEGER_HOST=localhost
JAEGER_PORT=6831
METRICS_PORT=8001
# Logging
LOG_LEVEL=INFO
LOG_FORMAT=json # or 'console'性能调整
缓存配置:
- 调整
CACHE_TTL基于数据变化频率 - 监视器
cache_hit_rate指标 - 默认300秒适用于IPAM数据
断路器:
FAILURE_THRESHOLD=5:断路前的故障次数TIMEOUT=60:重试前等待的秒数(半打开状态)- 监视器
circuit_breaker_state指标
请求超时:
- 默认30秒覆盖大多数操作
- 大列表操作增加
- 实时需求减少
______________________________________________________________________
项目结构
multiagent-mcp-platform/
├── agents/ # Agent framework
│ ├── base_agent.py # Multi-LLM agent (tool filtering, TOON, tracing, truncation)
│ ├── mcp_client.py # MCP client (HTTP streamable transport)
│ ├── orchestrator.py # Multi-agent orchestration
│ └── toon_formatter.py # Token optimization formatter
├── services/ # Business logic and clients
│ ├── infoblox_client.py # Infoblox IPAM/DNS client
│ ├── niosxaas_client.py # NIOSXaaS VPN client
│ ├── atcfw_client.py # Atcfw/DFP security client
│ ├── insights_client.py # Analytics client
│ ├── metrics.py # Metrics collection
│ ├── metrics_server.py # Prometheus endpoint
│ └── tracing.py # OpenTelemetry tracing
├── mcp_infoblox_http.py # Infoblox MCP server (HTTP, 98 tools)
├── mcp_server_http.py # Subnet calculator MCP (HTTP, 2 tools)
├── mcp_aws_http.py # AWS Tools MCP (HTTP, 27 tools)
├── mcp_aws_cloudcontrol_http.py # AWS CloudControl MCP (HTTP, 6 tools)
├── web_server.py # FastAPI + WebSocket (Agent Card, health, metrics, tools API)
├── frontend-v2/ # Next.js frontend (port 3000)
├── mcp_config.json # MCP server and agent configuration
├── requirements.txt # Python dependencies
├── test_optimizations.py # Optimization unit tests (NEW)
├── test_api_optimizations.py # API integration tests (NEW)
├── Dockerfile # Container definition
├── ARCHITECTURE.md # System architecture documentation
├── DEPLOYMENT_GUIDE.md # Production deployment guide
├── OPTIMIZATION_SUMMARY.md # Cost optimization guide (NEW)
└── IMPROVEMENTS_CHANGELOG.md # Feature implementation log______________________________________________________________________
文档
- 建筑.md:完整的系统架构和设计模式
- A2A_README.md:代理到代理协议指南,包括代理卡、健康状况、指标
- 优化\_ SUMMARY.md:成本优化指南(工具筛选+TON格式化)
- 部署\_ GIDE.md:生产部署策略(Docker、Fargate、K8s)
- 改进_CHANGELOG.md:生产功能实施日志
- CLAUDE.md:开发人员指南和项目惯例
- 前端v2.README.md:Next.js前端文档
______________________________________________________________________
测试
# Run all tests
python -m pytest
# Test cost optimizations (NEW)
python test_optimizations.py # Tool filtering + TOON formatting tests
python test_api_optimizations.py # API integration tests
# Test specific features
python test_caching.py # Cache performance (3000x speedup demo)
python test_circuit_breaker.py # Circuit breaker behavior
python test_metrics_server.py # Prometheus metrics
python test_tracing.py # Distributed tracing
# Integration tests
python test_mcp_tools_direct.py # Direct tool invocation
python test_vpn_update.py # End-to-end VPN workflow______________________________________________________________________
贡献
欢迎投稿!该平台被设计为 模板 用于为任何REST API构建生产级MCP服务器。
可重用模式:
- 多代理编排
- 缓存层(适用于任何API)
- 断路器实施
- 指标收集框架
- 分布式跟踪集成
- 健康检查端点
- Docker/Fargate部署配置
看 贡献.md 作为指导方针。
______________________________________________________________________
许可证
MIT许可证-请参阅 许可证 文件以获取详细信息。
______________________________________________________________________
致谢
内置:
- FastMCP -MCP服务器框架
- Infoblox BloxOne平台 -API集成
- 开放遥测 -分布式跟踪
- 普罗米修斯 -指标收集
- 结构日志 -结构化日志记录
______________________________________________________________________
支持
- 问题:
- 文档:参见
docs/目录 - Infoblox API: BloxOne API文档
______________________________________________________________________
状态:生产就绪|企业级|可观察|高性能
