Token导航 LogoToken导航TokenDH.com
MCP Agent Orchestration System logo
AI代理stdio官方级别未说明来源级核验

MCP Agent Orchestration System

MCP Server

一个基于Python和模型上下文协议(MCP)的状态驱动代理编排系统,用于标准化LLM上下文管理并提供资源、工具和提示模板。

工具数

1

提示词数

0

GitHub Stars

2

资源数

0
上下文管理PythonClaudeClaude DesktopClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

aviz85

提供方

aviz85

最后核验

2026/5/17 20:22

运行时

Python

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

python -m venv venv

详细介绍

MCP代理编排系统

使用模型上下文协议(MCP)的基于状态的代理编排系统的Python实现。

什么是MCP?

模型上下文协议(MCP)允许应用程序以标准化的方式为LLM提供上下文,将提供上下文的关注点与实际的LLM交互分开。使用MCP,您可以构建公开以下内容的服务器:

  • 资源:向LLM提供信息的数据源
  • 工具:允许LLM执行操作的功能
  • 提示:LLM交互的可重用模板

安装

先决条件

  • Python 3.10或更高版本
  • MCP Python SDK 1.2.0或更高版本

设置您的环境

使用紫外线(推荐)

# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh

# Create a new directory for our project
uv init mcp-agents-orchestra
cd mcp-agents-orchestra

# Create virtual environment and activate it
uv venv
source .venv/bin/activate  # On Unix/macOS
.venv\Scripts\activate     # On Windows

# Install dependencies
uv add "mcp[cli]" httpx

使用pip

# Create a new directory for our project
mkdir mcp-agents-orchestra
cd mcp-agents-orchestra

# Create a virtual environment
python -m venv venv
source venv/bin/activate  # On Unix/macOS
venv\Scripts\activate     # On Windows

# Install dependencies
pip install "mcp[cli]" httpx

克隆或下载项目文件

将项目文件放置在您的目录中:

  • orchestrator.py -实现状态机的主MCP服务器
  • orchestrator_client.py -客户演示编排流程
  • requirements.txt -项目的依赖关系
  • .gitignore -Git忽略文件

项目结构

  • orchestrator.py -实现状态机的主MCP服务器
  • orchestrator_client.py -客户演示编排流程
  • requirements.txt -项目的依赖关系

运行编排系统

  1. 直接启动编排服务器进行测试:
python orchestrator.py
  1. 在单独的终端中,运行客户端以查看正在运行的编排:
python orchestrator_client.py

与Claude for Desktop集成

1.安装桌面版Claude

确保您安装了Claude for Desktop。您可以从以下网址下载最新版本 Anthropic网站.

2.为桌面配置Claude

  1. 打开Claude for Desktop配置文件:

macOS/Linux:

   # Create or edit the configuration file
   code ~/Library/Application\ Support/Claude/claude_desktop_config.json

窗户:

   # Path may vary depending on your Windows version
   code %APPDATA%\Claude\claude_desktop_config.json
  1. 添加编排器服务器配置:
   {
       "mcpServers": {
           "agent-orchestrator": {
               "command": "python",
               "args": [
                   "/ABSOLUTE/PATH/TO/YOUR/PROJECT/orchestrator.py"
               ]
           }
       }
   }

将路径替换为orchestrator.py文件的绝对路径。

  1. 保存配置文件并重新启动Claude for Desktop。

3.使用克劳德的编曲

配置后,您可以:

  1. 打开Claude桌面版
  2. 点击侧栏中的MCP服务器图标
  3. 从可用服务器列表中选择“代理编排器”
  4. 开始与编排系统交互

克劳德将能够:

  • 不同代理状态之间的转换
  • 存储和检索知识库中的信息
  • 跨状态转换维护对话上下文
  • 访问状态特定提示

代理国

编排系统实现了具有以下状态的状态机:

  • 闲置:等待指示
  • 规划:为任务创建结构化计划
  • 研究:收集任务所需的信息
  • 执行:执行计划的行动
  • 审查:评估结果并确定下一步行动
  • 错误:处理错误或意外情况

自定义系统

添加新州

  1. 将状态添加到 AgentState 枚举在 orchestrator.py
  2. 为新状态创建提示函数
  3. 更新中的转换逻辑 _get_available_transitions()
  4. 在资源访问函数中为新状态添加处理程序

创建自定义工具

通过创建装饰有以下内容的函数来添加新工具 @mcp.tool():

@mcp.tool()
def my_custom_tool(arg1: str, arg2: int, ctx: Context) -> str:
    """Description of what this tool does
    
    Args:
        arg1: Description of arg1
        arg2: Description of arg2
    """
    # Implementation here
    return "Result"

开发和测试

使用MCP CLI

MCP CLI提供了用于开发和测试的工具:

# Install MCP CLI if you haven't already
pip install "mcp[cli]"

# Test your server with the MCP Inspector
mcp dev orchestrator.py

# Install in Claude Desktop
mcp install orchestrator.py

使用Python进行手动测试

from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client

async with stdio_client(StdioServerParameters(command="python", args=["orchestrator.py"])) as (read, write):
    async with ClientSession(read, write) as session:
        await session.initialize()
        # Test state transitions
        await session.call_tool("transition_state", arguments={"new_state": "PLANNING"})

资源

许可证

此项目根据MIT许可证获得许可-有关详细信息,请参阅许可证文件。

目录标签

目录标签

上下文管理PythonClaudeLLM编排本地部署状态机管理MCP协议AI代理

支持客户端

Claude DesktopClaude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

session

运行时(runtime,运行环境)

Python

部署方式(deploymentType,部署类型)

local-only

工具数量(toolCount,工具数)

1

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdiosessionlocal-only

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP