Skip to main content
Glama

MCP: Multi-Agent Control Point

by Gomezzz299

🧠 MCP:多代理控制点

该项目实现了一个多代理服务器,将用户问题路由到 LLM 模型或专门的代理(例如日期、位置、天气或技术专家)。包括使用 Streamlit 构建的简单 Web 界面,以方便使用。


🚀 功能

  • 🌐 使用 FastAPI 的后端
  • 🧠 专业代理(日期、地点、天气、法学硕士专家)
  • 🧩 具有继承性的可扩展和模块化代理系统
  • ⚙️ 通用继承AgenteBase ,用于统一错误和响应处理
  • 🤖 代理之间相互协作的智能逻辑
  • 🖥️ Streamlit 的可视化界面(GUI)
  • 🐳 Docker 容器,易于部署
  • 🔌 客户端-服务器通信可用于本地或远程网络

📁 项目结构

MCP/ ├── core/ │ ├── ollama_wrapper.py # Encapsula la lógica para interactuar con modelos LLM en Ollama │ ├── context_loader.py # Carga contexto adicional desde base de datos u otras fuentes │ └── router_llm.py # Router inteligente que decide qué agente usar en base a la consulta ├── agents/ # Carpeta que contiene todos los agentes disponibles del sistema ├── server/ │ ├── mcp_server.py # Punto central que gestiona los agentes registrados y el procesamiento de mensajes │ └── api.py # Define la API REST usando FastAPI para comunicación con la GUI u otros clientes ├── gui/ │ ├── app.py # Aplicación Streamlit que actúa como interfaz gráfica del sistema │ └── .streamlit/ │ └── secrets.toml # Archivo de configuración que contiene la URL del backend para la GUI ├── utils/ │ ├── db_utils.py # Funciones auxiliares para conectarse y consultar la base de datos SQLite │ ├── agente_base.py # Clase base AgenteBase, común a todos los agentes personalizados │ └── json_parser.py # Utilidad para dividir respuestas JSON en partes más manejables ├── database/ │ ├── context.db # Base de datos SQLite con información contextual para los agentes o el LLM │ ├── comprobar_db.py # Script que valida la existencia y consistencia de la base de datos │ └── create_db.py # Script para generar y poblar la base de datos desde cero ├── config.py # Archivo central de configuración del sistema (rutas, modelos, flags, etc.) ├── requirements.txt # Lista de dependencias de Python necesarias para ejecutar el proyecto ├── Dockerfile.backend # Dockerfile para construir el contenedor del backend (API + lógica de agentes) ├── Dockerfile.frontend # Dockerfile para construir el contenedor de la interfaz Streamlit └── docker-compose.yml # Archivo para levantar los servicios frontend y backend de forma conjunta

⚙️ 要求


🧪 快速安装

1. 克隆存储库

git clone https://github.com/tu-usuario/MCP.git cd MCP

2.创建Streamlit的配置文件

gui目录中,创建文件:

gui/.streamlit/secrets.toml

内容如下:

server_url = "http://backend:8000/process"

3. 使用 Docker Compose 运行

docker-compose up --build

这将构建并提升两个容器:

  • 后端位于http://localhost:8000
  • 图形界面http://localhost:8501

🌍 从另一台机器访问(可选)

  1. 确保正确公开端口( 80008501 )。
  2. secrets.toml中使用服务器机器的 IP 而不是localhost
  3. 您还可以设置自定义 Docker 网络以实现跨主机访问。

📦用于生产

如果您想将其与另一个界面集成,则可以只运行后端:

docker build -f Dockerfile.backend -t mcp_backend . docker run -p 8000:8000 mcp_backend

✨ 使用示例

在 Web 界面中,您可以输入如下问题:

  • ¿Qué día es hoy?
  • ¿Dónde estoy?
  • ¿Qué clima hace?
  • Explícame qué es Python

该应用程序将决定是否直接回答问题或将其委托给代理。


🛠️ 代理可用

代理人功能
日期返回当前日期和时间
地点通过 IP 检测城市和国家
气候返回当前位置的天气

🔄 代理之间的交互

天气代理现在在查询天气之前直接使用位置代理来确定地理坐标( latlon )和城市,从而允许根据用户的实际位置做出定制的响应。这提高了代理之间的模块化和协作。


🧩 如何创建新代理

  1. 创建一个继承自 AgenteBase 的类:
from agentes.base import AgenteBase class AgenteEjemplo(AgenteBase): patrones = [r"expresiones.*clave", r"otra.*forma.*de.*preguntar"] def agente(self) -> dict: datos = {"respuesta": "Soy un agente de ejemplo"} return {"success": True, "data": datos}
  1. 指定模式来检测相关问题。
  2. 实现agente() ,返回一个包含成功键和数据或错误的字典。
  3. 代理将自动使用指示的 LLM 根据您的数据生成自然响应。

⚠️ 重要技术说明

  • 所有代理都继承自 AgenteBase,它管理:
    • 标准误差
    • 通过 LLM 将数据转换为自然响应
  • agent() 方法必须返回一个结构化字典。
  • 每个代理指定要使用哪个 LLM 模型( llm_simplellm_experto )。

📄 许可证

该项目已获得 MIT 许可。


🙋‍♂️ 作者

由 Alejandro Gómez Sierra 开发。

-
security - not tested
F
license - not found
-
quality - not tested

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 网络界面以便于交互。

  1. 🚀 功能
    1. 📁 项目结构
      1. ⚙️ 要求
        1. 🧪 快速安装
          1. 克隆存储库
          2. 2.创建Streamlit的配置文件
          3. 使用 Docker Compose 运行
        2. 🌍 从另一台机器访问(可选)
          1. 📦用于生产
            1. ✨ 使用示例
              1. 🛠️ 代理可用
                1. 🔄 代理之间的交互
                  1. 🧩 如何创建新代理
                    1. ⚠️ 重要技术说明
                      1. 📄 许可证
                        1. 🙋‍♂️ 作者

                          Related MCP Servers

                          • -
                            security
                            A
                            license
                            -
                            quality
                            This 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 -
                            1
                            241
                            81
                            JavaScript
                            MIT License
                          • A
                            security
                            F
                            license
                            A
                            quality
                            A 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 -
                            1
                            96
                            JavaScript
                          • -
                            security
                            F
                            license
                            -
                            quality
                            A server that manages conversation context for LLM interactions, storing recent prompts and providing relevant context for each user via REST API endpoints.
                            Last updated -
                            602
                            TypeScript
                          • A
                            security
                            A
                            license
                            A
                            quality
                            An 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 -
                            3
                            10
                            11
                            TypeScript
                            MIT License
                            • Linux
                            • Apple

                          View all related MCP servers

                          MCP directory API

                          We provide all the information about MCP servers via our MCP API.

                          curl -X GET 'https://glama.ai/api/mcp/v1/servers/Gomezzz299/MCP'

                          If you have feedback or need assistance with the MCP directory API, please join our Discord server