API健康检查自动化
一个使用MCP(模型上下文协议)、LLM分析和Streamlit UI进行自动化API健康测试的项目。
特性
- 🔍 实时API测试:命中任何API端点并分析响应
- 🤖 LLM动力分析:使用GPT-4/Claude进行智能健康评估
- 📊 历史数据分析:预测延迟模式和潜在故障
- 🎨 交互式用户界面:用户友好的Streamlit界面
- 🔌 MCP集成:FastMCP服务器,用于可扩展的工具集成
建筑
┌─────────────────┐
│ Streamlit UI │ ← User Input (API URL, Headers, etc.)
└────────┬────────┘
│
↓
┌─────────────────┐
│ MCP Server │ ← Tools: test_api, analyze_health, predict_failures
└────────┬────────┘
│
├─→ API Testing Module
├─→ LLM Analysis Module
└─→ Historical Data Analyzer设置
- 安装依赖项:
pip install -r requirements.txt- 配置环境:
cp .env.example .env
# Edit .env and add your API keys- 运行应用程序:
streamlit run app.py用法
- 输入要测试的API终结点
- 配置请求参数(方法、标头、正文)
- 点击“测试API运行状况”
- 查看实时结果和LLM分析
- 检查延迟和故障模式的历史预测
项目结构
APIHealthCheck/
├── app.py # Streamlit UI entry point
├── mcp_server.py # FastMCP server with tools
├── src/
│ ├── api_tester.py # API testing logic
│ ├── llm_analyzer.py # LLM integration for analysis
│ ├── historical.py # Historical data analysis
│ └── config.py # Configuration management
├── data/
│ └── historical_data.json # Sample historical API data
└── requirements.txtMCP工具
test_api:执行API请求并收集指标analyze_health:LLM驱动的健康评估predict_failures:根据历史数据预测潜在问题
许可证
麻省理工学院
