HE

haohao-end/mcp-agent

Developer tools

Эта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал

74 stars 16 forks Качество 51 Тренд 18

haohao-end/mcp-agent - кандидат на сервер MCP, импортированный из https://github.com/haohao-end/mcp-agent.

Обзор

haohao-end/mcp-agent - кандидат на сервер MCP, импортированный из https://github.com/haohao-end/mcp-agent.

Обзор (машинный перевод)

MCP Agent Orchestrator - это профессиональная реализация Python протокола Model Context Protocol (MCP). Он обеспечивает структурированную среду для крупных языковых моделей (LLM) для взаимодействия с внешними инструментами и базами знаний через стандартизированный уровень связи. Проект использует FastMCP для определения инструментов на стороне сервера и асинхронного моста на стороне клиента к OpenAI-совместимым интерфейсам.

Системная архитектура

Проект построен на архитектуре клиент-сервер:

  1. MCP Client: выступает в качестве оркестратора. Он управляет жизненным циклом сервера MCP, выполняет обнаружение инструментов, обрабатывает завершения LLM и выполняет вызовы инструментов, возвращаемые моделью.
  2. MCP-серверы: независимые сервисы (Weather, RAG), которые предоставляют клиенту определенные функции через протокол Model Context Protocol.
  3. ** Транспортный уровень**: использует стандартный ввод/вывод (StdIO) для высокопроизводительной локальной межпроцессной связи.

Основные компоненты

###1 Интеллектуальный клиентский мост

Реализация клиентом rag_agent.py, client.py облегчает:

Асинхронное управление жизненным циклом с использованием AsyncExitStack.

  • Автоматическое преобразование схемы инструмента для вызова OpenAI-совместимых функций.

Эта страница переведена автоматически. Технические детали смотрите в оригинале.

README

Показан фрагмент оригинального README. Открыть оригинал.

MCP Agent Orchestrator

The MCP Agent Orchestrator is a professional-grade Python implementation of the Model Context Protocol (MCP). It provides a structured environment for Large Language Models (LLMs) to interact with external tools and knowledge bases through a standardized communication layer. The project utilizes FastMCP for server-side tool definitions and an asynchronous client-side bridge to OpenAI-compatible interfaces.

System Architecture

The project follows a decoupled client-server architecture:

  1. MCP Client: Acts as the orchestrator. It manages the lifecycle of the MCP server, performs tool discovery, handles LLM completions, and executes tool calls returned by the model.
  2. MCP Servers: Independent services (Weather, RAG) that expose specific functions to the client via the Model Context Protocol.
  3. Transport Layer: Uses Standard Input/Output (StdIO) for high-performance, local inter-process communication.

Core Components

1. Intelligent Client Bridge

The client implementation (rag_agent.py, client.py) facilitates:

  • Asynchronous lifecycle management using AsyncExitStack.
  • Automatic tool schema conversion for OpenAI-compatible function calling.
  • Persistent conversation state and multi-turn reasoning loops.

2. Weather Service Server

The weather server (server.py) demonstrates real-time API integration:

  • Integration with external REST APIs (WeatherAPI).
  • Data normalization and formatting for LLM consumption.
  • Asynchronous request handling using httpx.

3. RAG Knowledge Server

The RAG server (rag_server.py) provides advanced document intelligence:

  • Data Ingestion: Support for PDF and TXT formats using LangChain.
  • Vector Database: Persistent storage via ChromaDB.
  • Search Optimization: Implements Maximal Marginal Relevance (MMR) for diverse information retrieval.
  • Embeddings: Integration with HuggingFace transformer models.

Project Structure

├── client.py             # Standard MCP client implementation
├── rag_agent.py          # Specialized agent for RAG operations
├── server.py             # Weather service MCP server
├── rag_server.py         # RAG knowledge base MCP server
├── test.py               # Connectivity test for LLM API
├── .env                  # Environment configuration
└── data/
    ├── rag_db/           # Vector store persistence directory
    └── text.txt # Sample knowledge base source

Technical Stack

  • Protocol: Model Context Protocol (MCP)
  • LLM Interface: OpenAI SDK (Compatible with Qwen/DashScope)
  • RAG Framework: LangChain
  • Vector Store: ChromaDB
  • Communication: Asynchronous I/O (asyncio)

Installation

Prerequisites

  • Python 3.10+
  • Virtual environment (recommended)

Environment Setup

Открыть полный README на GitHub

Установка

This server does not publish a one-line install command.

Open the repository installation guide Новичок в MCP? Начните с руководства на mcpskill.org →