使用说明
使用MCP服务器的服务网格
该项目采用Istio实现了一种服务网格架构,通过连接多个模型上下文协议(MCP)服务器,增强了洞察力和可观测性。
🏗️ 项目结构
MCP-Demo/
├── go-event-dashboard/ # Go application for monitoring
├── mcp-servers/ # MCP server implementations
│ ├── data-processor/ # Data processing MCP server
│ ├── analytics/ # Analytics MCP server
│ └── notification/ # Notification MCP server
├── kubernetes/ # Kubernetes deployment manifests
├── istio/ # Istio service mesh configuration
├── monitoring/ # Monitoring stack (Prometheus, Grafana)
├── deploy.sh # Deployment script
├── cleanup.sh # Cleanup script
└── test-demo.sh # Test script
🚀 快速入门
先决条件
- Podman 用于容器运行时
- Minikube 启用Istio后
- `kubectl` 是 Kubernetes 的命令行工具,用于与 Kubernetes 集群进行交互。 用于Kubernetes管理
- Python 3.8及以上版本 对于MCP服务器
部署演示
# 1. Deploy everything
./deploy.sh
# 2. Test the deployment
./test-demo.sh
# 3. Clean up when done
./cleanup.sh
🎯 组件
1. MCP 服务器
- 数据处理器从各种来源处理和分析数据
- **分析(或分析学)**为服务网格提供分析和见解
- 通知处理通知和警报
2. 前往活动仪表盘
- HTTP服务器用于查询Kubernetes事件的REST API
- gRPC 服务器实时事件流
- 事件缓冲区线程安全的内存中缓冲区,用于存储事件
3. 服务网格(Istio)
- 交通管理负载均衡和路由
- 安全mTLS和认证
- 可观测性指标、日志和追踪
4. 监控栈(或监控堆栈)
- 普罗米修斯指标收集与存储
- Grafana可视化与仪表板
- **雅各(Jaeger,人名,音译可能因方言或习惯不同而有所差异)**分布式追踪
📊 服务URL
部署后,访问这些服务:
- Go 事件仪表板:
http://<minikube-ip>:<port> - 普罗米修斯:
http://<minikube-ip>:<port> - Grafana(中文可译为“格拉夫纳”,但通常直接使用其英文名,因其在技术领域已广为人知):
http://<minikube-ip>:<port>
默认凭据
- 仪表盘:
admin/demo - Grafana(音译:格拉夫纳):
admin/admin
🔧 开发
本地开发
# Test Go application locally
cd go-event-dashboard
./test-local.sh
# Run individual components
./run-http.sh # HTTP server
./run-grpc.sh # gRPC server
构建镜像
# Build Go Event Dashboard
podman build -f Dockerfile.go-event-dashboard -t go-event-dashboard:latest .
# Build MCP servers
cd mcp-servers/data-processor
podman build -t mcp-data-processor:latest .
API 端点
Go 事件仪表板
GET /health- 健康检查GET /metrics- Prometheus 指标GET /events- 查询事件(需要认证)GET /stats- 活动统计(需要授权)
MCP 服务器
每个MCP服务器提供以下工具:
- 数据处理:
process_data,get_statistics - 分析(或分析学):
get_metrics,generate_report,record_event - 通知:
send_notification,subscribe,get_notifications
🧪 测试
# Test the entire demo
./test-demo.sh
# Check pod health
kubectl get pods -n mcp-demo
# View logs
kubectl logs -f deployment/go-event-dashboard -n mcp-demo
🧹 清理
# Remove all resources
./cleanup.sh
# Verify cleanup
kubectl get all -n mcp-demo
📚 建筑学
该演示展示了:
- 服务网格Istio 管理 MCP 服务器之间的流量
- 可观测性Prometheus收集指标,Grafana对它们进行可视化展示
- 事件监控Go仪表板监控Kubernetes事件
- MCP 集成多个MCP服务器通过服务网格进行交互
- 安全服务间的mTLS(双向传输层安全)和身份验证
这展示了具备服务网格能力的现代微服务架构的全面示例。