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

  • Lists Tailwind CSS classes in monospaced font

  • 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
  • Discover the most comprehensive and up-to-date collection of MCP servers in the market. This repository serves as a centralized hub, offering an extensive catalog of open-source and proprietary MCP servers, complete with features, documentation links, and contributors.

  • ShrimpingIt
  • Micropython I2C-based manipulation of the MCP series GPIO expander, derived from Adafruit_MCP230xx

  • jae-jae
  • MCP server for fetch web page content using Playwright headless browser.

  • ravitemer
  • A powerful Neovim plugin for managing MCP (Model Context Protocol) servers

  • patruff
  • Bridge between Ollama and MCP servers, enabling local LLMs to use Model Context Protocol tools

  • pontusab
  • The Cursor & Windsurf community, find rules and MCPs

  • av
  • Effortlessly run LLM backends, APIs, frontends, and services with one command.

  • WangRongsheng
  • 🧑‍🚀 全世界最好的LLM资料总结(Agent框架、辅助编程、数据处理、模型训练、模型推理、o1 模型、MCP、小语言模型、视觉语言模型) | Summary of the world's best LLM resources.

  • Mintplex-Labs
  • The all-in-one Desktop & Docker AI application with built-in RAG, AI agents, No-code agent builder, MCP compatibility, and more.

  • appcypher
  • Awesome MCP Servers - A curated list of Model Context Protocol servers

    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!