🧠 MCP:多代理控制点
该项目实现了一个多代理服务器,将用户问题路由到 LLM 模型或专门的代理(例如日期、位置、天气或技术专家)。包括使用 Streamlit 构建的简单 Web 界面,以方便使用。
🚀 功能
- 🌐 使用 FastAPI 的后端
- 🧠 专业代理(日期、地点、天气、法学硕士专家)
- 🧩 具有继承性的可扩展和模块化代理系统
- ⚙️ 通用继承
AgenteBase
,用于统一错误和响应处理 - 🤖 代理之间相互协作的智能逻辑
- 🖥️ Streamlit 的可视化界面(GUI)
- 🐳 Docker 容器,易于部署
- 🔌 客户端-服务器通信可用于本地或远程网络
📁 项目结构
⚙️ 要求
🧪 快速安装
1. 克隆存储库
2.创建Streamlit的配置文件
在gui
目录中,创建文件:
内容如下:
3. 使用 Docker Compose 运行
这将构建并提升两个容器:
- 后端位于
http://localhost:8000
- 图形界面
http://localhost:8501
🌍 从另一台机器访问(可选)
- 确保正确公开端口(
8000
、8501
)。 - 在
secrets.toml
中使用服务器机器的 IP 而不是localhost
。 - 您还可以设置自定义 Docker 网络以实现跨主机访问。
📦用于生产
如果您想将其与另一个界面集成,则可以只运行后端:
✨ 使用示例
在 Web 界面中,您可以输入如下问题:
¿Qué día es hoy?
¿Dónde estoy?
¿Qué clima hace?
Explícame qué es Python
该应用程序将决定是否直接回答问题或将其委托给代理。
🛠️ 代理可用
代理人 | 功能 |
---|---|
日期 | 返回当前日期和时间 |
地点 | 通过 IP 检测城市和国家 |
气候 | 返回当前位置的天气 |
🔄 代理之间的交互
天气代理现在在查询天气之前直接使用位置代理来确定地理坐标( lat
、 lon
)和城市,从而允许根据用户的实际位置做出定制的响应。这提高了代理之间的模块化和协作。
🧩 如何创建新代理
- 创建一个继承自 AgenteBase 的类:
- 指定模式来检测相关问题。
- 实现
agente()
,返回一个包含成功键和数据或错误的字典。 - 代理将自动使用指示的 LLM 根据您的数据生成自然响应。
⚠️ 重要技术说明
- 所有代理都继承自 AgenteBase,它管理:
- 标准误差
- 通过 LLM 将数据转换为自然响应
- agent() 方法必须返回一个结构化字典。
- 每个代理指定要使用哪个 LLM 模型(
llm_simple
或llm_experto
)。
📄 许可证
该项目已获得 MIT 许可。
🙋♂️ 作者
由 Alejandro Gómez Sierra 开发。
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
将用户问题路由给专门代理(日期、地点、天气)或 LLM 专家的服务器,并配有简单的 Streamlit 网络界面以便于交互。
Related MCP Servers
- -securityAlicense-qualityThis is a server that lets your LLMs (like Claude) talk directly to your BigQuery data! Think of it as a friendly translator that sits between your AI assistant and your database, making sure they can chat securely and efficiently.Last updated -124181JavaScriptMIT License
- AsecurityFlicenseAqualityA server that implements the Model Context Protocol to connect LLMs to Brightsy AI agents, allowing users to pass messages to and receive responses from these agents.Last updated -196JavaScript
- -securityFlicense-qualityA server that manages conversation context for LLM interactions, storing recent prompts and providing relevant context for each user via REST API endpoints.Last updated -602TypeScript
- AsecurityAlicenseAqualityAn AI router that connects applications to multiple LLM providers (OpenAI, Anthropic, Google, DeepSeek, Ollama, etc.) with smart model orchestration capabilities, enabling dynamic switching between models for different reasoning tasks.Last updated -31011TypeScriptMIT License