Cover image
Try Now
2025-04-10

3 years

Works with Finder

1

Github Watches

23

Github Forks

12

Github Stars

파이썬으로 MCP Agent 만들기

YouTube 검색, 요약, 채널 분석 기능을 갖춘 유튜브 에이전트를 MCP로 구현한 예제입니다.

MCP (Model Context Protocol) 소개

  • AI가 외부 데이터의 도구(Tools)에 효과적으로 연결할 수 있는 표준화된 방식
  • 특히 다양한 도구의 표준화된 연결로 많이 활용되고 있음
    • MCP Server: 사용할 수 있는 도구(tool)를 정의하고 제공하는 역할
    • MCP Client: 정의된 도구를 불러와 사용 (Claude Desktop, Cursor, OpenAI Agents SDK)
  • 이번 예제에서는 유튜브 컨텐츠 분석을 위한 MCP Server를 만들어보고, OpenAI Agents SDK 기반의 MCP Client와도 연결해볼 예정입니다.

image

초기 셋팅

  1. 레포지토리 clone 또는 다운로드하기

    git clone https://github.com/dabidstudio/python-mcp-agent.git
    cd python-mcp-agent
    
  2. OpenAI 키 발급

  3. YouTube Data API Key 발급

  4. .env.example를 복사한 후 API 키를 입력하고 .env로 저장

    OPENAI_API_KEY=api키_입력
    YOUTUBE_API_KEY=api_키_입력
    
  5. 파이썬 가상환경 설정

    python -m venv venv
    venv\Scripts\activate # Mac은 source venv/bin/activate  
    
  6. 패키지 설치

    pip install mcp openai-agents streamlit youtube-transcript-api python-dotenv requests
    

MCP 클라이언트 연동을 위한 준비

Claude, Cursor와 같은 MCP 클라이언트 애플리케이션에서 로컬 MCP 서버를 연동하려면,
서버 실행에 필요한 Python 실행 파일 경로MCP 서버 스크립트 경로를 JSON 설정에 입력해야 합니다.

  • 내 경로에 알맞게 mcp.json을 수정해둡니다.

경로 구성 예시

✅ Windows 예시

(예: 프로젝트 폴더가 C:\projects\dabidstudio_videos\python_mcp_agent인 경우)

주의: Windows에서는 JSON 문법상 \ 대신 \\ (역슬래시 두 번)을 사용해야 합니다.

{
  "mcpServers": {
    "mcp-test": {
      "command": "C:\\projects\\dabidstudio_videos\\python_mcp_agent\\venv\\Scripts\\python.exe",
      "args": [
        "C:\\projects\\dabidstudio_videos\\python_mcp_agent\\2_mcp_server.py"
      ]
    }
  }
}

✅ macOS / Linux 예시

(예: 프로젝트 폴더가 /Users/yourname/projects/python_mcp_agent인 경우)

{
  "mcpServers": {
    "mcp-test": {
      "command": "/Users/yourname/projects/python_mcp_agent/venv/bin/python",
      "args": [
        "/Users/yourname/projects/python_mcp_agent/2_mcp_server.py"
      ]
    }
  }
}

폴더 구조

python-mcp-agent/
├── 1_mcp_server_functions.ipynb   # MCP 서버 함수 예제 노트북
├── 2_mcp_server.py                # MCP 서버 구현 예제
├── 3_openai_agents_basics.py      # OpenAI Agent 기본 예제
├── 4_mcp_client.py                # Streamlit MCP Client 예제
├── .env.example                   # 환경변수 예제 파일
└── mcp.json                       # MCP 서버 설정 파일

相关推荐

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • https://appia.in
  • Siri Shortcut Finder – your go-to place for discovering amazing Siri Shortcuts with ease

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • tomoyoshi hirata
  • Sony α7IIIマニュアルアシスタント

  • apappascs
  • Descubra la colección más completa y actualizada de servidores MCP en el mercado. Este repositorio sirve como un centro centralizado, que ofrece un extenso catálogo de servidores MCP de código abierto y propietarios, completos con características, enlaces de documentación y colaboradores.

  • ShrimpingIt
  • Manipulación basada en Micrypthon I2C del expansor GPIO de la serie MCP, derivada de AdaFruit_MCP230xx

  • jae-jae
  • Servidor MCP para obtener contenido de la página web con el navegador sin cabeza de dramaturgo.

  • ravitemer
  • Un poderoso complemento Neovim para administrar servidores MCP (protocolo de contexto del modelo)

  • patruff
  • Puente entre los servidores Ollama y MCP, lo que permite a LLM locales utilizar herramientas de protocolo de contexto del modelo

  • pontusab
  • La comunidad de cursor y windsurf, encontrar reglas y MCP

  • av
  • Ejecute sin esfuerzo LLM Backends, API, frontends y servicios con un solo comando.

  • WangRongsheng
  • 🧑‍🚀 全世界最好的 llM 资料总结(数据处理、模型训练、模型部署、 O1 模型、 MCP 、小语言模型、视觉语言模型) | Resumen de los mejores recursos del mundo.

  • Mintplex-Labs
  • La aplicación AI de escritorio todo en uno y Docker con trapo incorporado, agentes de IA, creador de agentes sin código, compatibilidad de MCP y más.

    Reviews

    1 (1)
    Avatar
    user_oRrxPTRe
    2025-04-17

    I've been using the python_mcp_agent from dabidstudio and it has significantly streamlined my automation tasks. The seamless integration and comprehensive documentation made it incredibly easy to get started right away. Definitely check it out on GitHub!