Skip to main content
Glama
ChatGPT Orchestrator MCP Server

ChatGPT Orchestrator MCP Server

by vadimsey

ChatGPT 오케스트레이터 MCP 서버

다음 구조를 위한 최소한의 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.ps1

macOS/Linux:

python3 -m venv .venv
source .venv/bin/activate

2. 의존성 설치

pip install -r requirements.txt

3. 서버 실행

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를 통한 방법

  1. 새 GitHub 저장소를 만듭니다.

  2. 이 파일들을 업로드합니다.

  3. Render를 엽니다.

  4. New -> Web Service를 클릭합니다.

  5. GitHub 저장소를 연결합니다.

  6. Render는 일반적으로 render.yaml을 자동으로 읽습니다.

  7. 수동으로 설정하는 경우:

    • Runtime: Python

    • Build Command: pip install -r requirements.txt

    • Start Command: python server.py

  8. Deploy를 클릭합니다.

배포 후 Render는 다음과 같은 형식의 URL을 제공합니다:

https://chatgpt-orchestrator-mcp.onrender.com

프로덕션 MCP 엔드포인트는 다음과 같습니다:

https://chatgpt-orchestrator-mcp.onrender.com/mcp

브라우저 확인용 프로덕션 상태(health) 엔드포인트:

https://chatgpt-orchestrator-mcp.onrender.com/health

ChatGPT에 입력해야 할 URL은 바로 이것입니다.

ChatGPT에 연결하는 방법

  1. 브라우저에서 ChatGPT를 엽니다.

  2. Settings로 이동합니다.

  3. Apps & Connectors 또는 Connectors를 엽니다.

  4. 개발자 모드가 꺼져 있다면 켭니다:

    • Advanced settings

    • Developer mode

  5. Create 또는 Create connector를 클릭합니다.

  6. 다음을 입력합니다:

    • Name: Orchestrator

    • Description: Runs my main orchestrator agent through MCP.

    • Connector URL: https://YOUR-RENDER-SERVICE.onrender.com/mcp

  7. 저장합니다.

  8. 새 채팅에서 이 커넥터/도구를 선택하고 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/mcp

ChatGPT용 URL:

https://YOUR-RENDER-SERVICE.onrender.com/mcp

유용한 공식 문서

Related MCP Connectors

Related MCP Servers