ChatGPT Orchestrator MCP Server
ChatGPT Orchestrator MCP Server
用于以下架构的 Python 最小化远程 MCP 服务器:
ChatGPT -> MCP server -> main orchestrator -> helper agents在第一阶段,服务器包含一个工具:
run_orchestrator输入:
goal: string输出:简单的 JSON
目前内部是一个存根。稍后可以将其替换为您实际的主代理调用。
为什么选择 FastMCP
选择 FastMCP 是因为它允许使用普通的 Python 函数描述 MCP 工具,并立即通过 HTTP 启动远程 MCP 端点。要连接到 ChatGPT,需要一个类似 /mcp 的公共 HTTPS 端点。
Related MCP server: native-agent-router
项目结构
.
├── .gitignore
├── server.py
├── requirements.txt
├── Procfile
├── render.yaml
└── README.md本地运行
要求:
Python 3.11+
pip
1. 创建虚拟环境
PowerShell:
python -m venv .venv
.\.venv\Scripts\Activate.ps1如果 Windows 上的 python 命令打开 Microsoft Store 或未显示版本,请使用:
py -3.11 -m venv .venv
.\.venv\Scripts\Activate.ps1macOS/Linux:
python3 -m venv .venv
source .venv/bin/activate2. 安装依赖
pip install -r requirements.txt3. 启动服务器
python server.py本地 MCP 端点:
http://localhost:8000/mcp检查服务器是否存活的常规检查:
http://localhost:8000/health如果客户端要求末尾带有斜杠的端点,请使用:
http://localhost:8000/mcp/本地测试
保持 python server.py 运行。在第二个终端中执行:
Invoke-RestMethod http://localhost:8000/health预期响应:
{
"status": "ok"
}重要提示:如果在浏览器中打开 http://localhost:8000/mcp 或在没有 MCP 标头的情况下使用常规 curl 请求它,可能会看到错误:
{
"error": {
"message": "Not Acceptable: Client must accept text/event-stream"
}
}这对于 MCP 端点是正常的。请使用常规浏览器检查 /health,并使用 MCP 客户端检查 /mcp。
@'
import asyncio
from fastmcp import Client
async def main():
async with Client("http://localhost:8000/mcp") as client:
tools = await client.list_tools()
print("TOOLS:")
for tool in tools:
print("-", tool.name)
result = await client.call_tool(
"run_orchestrator",
{"goal": "Create an MVP launch plan"}
)
print("RESULT:")
print(result)
asyncio.run(main())
'@ | python预期的响应含义:服务器将显示 run_orchestrator 工具,并返回一个包含存根已接收任务文本的 JSON。
也可以通过 MCP Inspector 进行检查:
npx @modelcontextprotocol/inspector在 UI 中选择传输方式 Streamable HTTP 和 URL:
http://localhost:8000/mcp部署到 Render
通过 GitHub 部署
创建一个新的 GitHub 仓库。
将这些文件上传到那里。
打开 Render。
点击
New->Web Service。连接 GitHub 仓库。
Render 通常会自动读取
render.yaml。如果手动配置:
Runtime:
PythonBuild Command:
pip install -r requirements.txtStart Command:
python server.py
点击
Deploy。
部署后,Render 将提供类似以下的 URL:
https://chatgpt-orchestrator-mcp.onrender.com生产环境 MCP 端点将是:
https://chatgpt-orchestrator-mcp.onrender.com/mcp用于浏览器检查的生产环境健康检查端点:
https://chatgpt-orchestrator-mcp.onrender.com/health正是这个 URL 需要填入 ChatGPT。
如何连接到 ChatGPT
在浏览器中打开 ChatGPT。
进入
Settings。打开
Apps & Connectors或Connectors。如果尚未开启,请启用 Developer Mode:
Advanced settingsDeveloper mode
点击
Create或Create connector。填写:
Name:
OrchestratorDescription:
Runs my main orchestrator agent through MCP.Connector URL:
https://YOUR-RENDER-SERVICE.onrender.com/mcp
保存。
在新聊天中选择此 connector/tool 并要求 ChatGPT 调用编排器。
ChatGPT 中的测试请求示例
Используй Orchestrator и вызови run_orchestrator с goal:
"Составь пошаговый план запуска MVP моего продукта"工具目前的预期响应大约是:
{
"status": "ok",
"message": "Stub orchestrator accepted the goal.",
"goal": "Составь пошаговый план запуска MVP моего продукта",
"next_step": "Replace call_real_orchestrator() in server.py with your real agent call."
}在何处将存根替换为真实代理
打开 server.py 并找到函数:
def call_real_orchestrator(goal: str) -> dict[str, Any]:目前它返回测试 JSON。稍后将其主体替换为您主代理的实际调用。
未来替换示例:
def call_real_orchestrator(goal: str) -> dict[str, Any]:
result = my_main_agent.run(goal)
return {
"status": "ok",
"goal": goal,
"result": result,
}重要提示:在第一阶段,不要为每个辅助代理创建单独的 MCP 服务器。让 ChatGPT 只看到一个 run_orchestrator 工具,而由您内部的主代理决定调用哪些辅助代理。
最终 URL
本地:
http://localhost:8000/mcp生产环境 URL 模板:
https://YOUR-RENDER-SERVICE.onrender.com/mcpChatGPT 使用的 URL:
https://YOUR-RENDER-SERVICE.onrender.com/mcp有用的官方文档
This server cannot be deployed
Related MCP Connectors
LLM Orchestration Agent (Mcp)
MCP-Native LLM Orchestration Agent
Discover and call AI agents via MCP. Supports A2A agents and platform agents with async tasks.
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables any MCP client to drive a multi-agent orchestration engine with planning, specialist tools, critic revision, and human-in-the-loop approval for sensitive actions.3MIT
- AlicenseAqualityBmaintenanceEnables orchestrator agents to route coding tasks to native CLI worker agents via MCP, providing tools for agent discovery, task submission, waiting, inspection, and cancellation.53MIT
- FlicenseNot gradedqualityDmaintenanceEnables MCP clients to chat with a single Watson Orchestrate agent by exposing invoke_agent and get_agent tools for sending messages and fetching agent details.-
- AlicenseNot gradedqualityBmaintenanceEnables ChatGPT to interact with Engineering MCP through a secure MCP endpoint, including executing C2C plans and workspace file access with operator approval.Apache 2.0