Splunk MCP支持的RAG代理平台
一个生产就绪的LangGraph代理应用程序,具有Streamlit前端、FastAPI后端、使用ChromaDB的RAG功能、MCP服务器集成(Splunk+Atlassian)以及用于Splunk数据交互和基于文档的问答的LangSmith监控。
建筑
- 前端:用于聊天界面和文档上传的流线型UI
- 后端:FastAPI服务器处理业务逻辑和LangGraph编排
- 代理层:具有RAG、MCP工具调用和人在环支持的LangGraph代理
特性
- ✅ 与OpenAI GPT-4进行通用聊天
- ✅ 文档上传和基于RAG的检索(PDF、TXT、DOCX)
- ✅ Splunk MCP集成用于SPL查询
- ✅ Atlassian MCP集成
- ✅ 敏感操作的人在回路中
- ✅ LangSmith追踪和监测
- ✅ 基于配置的MCP服务器加载
- ✅ 会话线程持久性
先决条件
- Python>=3.12
- 紫外线 用于包管理
- OpenAI API密钥
- LangSmith API密钥(可选,用于监控)
- 访问Splunk和Atlassian MCP服务器
快速开始
1.安装依赖项
# Install uv if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh
# Install project dependencies
uv sync
uv sync --dev # Include development dependencies2.配置环境
# Copy example environment file
cp .env.example .env
# Edit .env with your API keys and configuration3.配置MCP服务器
编辑 config/mcp_servers.json 配置您的Splunk和Atlassian MCP服务器连接。
4.运行应用程序
假设您是项目根用户:
# Terminal 1: Start FastAPI backend
./scripts/run_backend.sh
-or-
uv run uvicorn backend.main:app --reload --host localhost --port 8000
# Terminal 2: Start Streamlit frontend
./scripts/run_frontend.sh
-or-
uv run streamlit run frontend/app.py5.访问应用程序
- 流线型UI: http://localhost:8501
- FastAPI文档: http://localhost:8000/docs
- 健康检查: http://localhost:8000/health
发展
装订和格式化
# Run ruff linting
uvx ruff check
# Auto-fix issues
uvx ruff check --fix
# Format code
uvx ruff format类型检查
# Run type checking with ty
uvx ty backend/
uvx ty frontend/项目结构
.
├── backend/
│ ├── main.py # FastAPI application entry point
│ ├── agent/
│ │ ├── graph.py # LangGraph agent definition
│ │ ├── state.py # Agent state models
│ │ └── tools.py # MCP and RAG tools
│ ├── rag/
│ │ ├── vectorstore.py # ChromaDB integration
│ │ └── document_processor.py # Document loading and chunking
│ ├── mcp/
│ │ ├── server_manager.py # MCP server connection manager
│ │ └── config.py # MCP server configuration loader
│ └── api/
│ └── routes.py # FastAPI endpoints
├── frontend/
│ └── app.py # Streamlit application
├── config/
│ └── mcp_servers.json # MCP server configurations
├── data/
│ ├── uploads/ # User document uploads
│ ├── chroma_db/ # ChromaDB persistence
│ └── checkpoints/ # Conversation state checkpoints
├── scripts/
│ ├── run_backend.sh # Backend startup script
│ └── run_frontend.sh # Frontend startup script
├── docs/
│ ├── TESTING.md # Testing guide and scenarios
│ ├── QUICKSTART.md # Quick start guide
│ ├── IMPLEMENTATION_SUMMARY.md # Technical implementation details
│ ├── MCP_INTEGRATION_NOTES.md # MCP server integration guide
│ ├── TYPE_CHECKING_NOTES.md # Type checking with ty
│ ├── CHANGES_SUMMARY.md # Recent changes log
│ └── SLASH_COMMANDS.md # Chat slash commands reference
├── pyproject.toml
├── .env.example
└── README.md许可证
麻省理工学院
