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.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • 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
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • jae-jae
  • MCP服务器使用剧作《无头浏览器》获取网页内容。

  • ravitemer
  • 一个功能强大的Neovim插件,用于管理MCP(模型上下文协议)服务器

  • patruff
  • Ollama和MCP服务器之间的桥梁,使本地LLMS可以使用模型上下文协议工具

  • pontusab
  • 光标与风浪冲浪社区,查找规则和MCP

  • av
  • 毫不费力地使用一个命令运行LLM后端,API,前端和服务。

  • WangRongsheng
  • 🧑‍🚀 llm 资料总结(数据处理、模型训练、模型部署、 o1 模型、mcp 、小语言模型、视觉语言模型)|摘要世界上最好的LLM资源。

  • Mintplex-Labs
  • 带有内置抹布,AI代理,无代理构建器,MCP兼容性等的多合一桌面和Docker AI应用程序。

  • appcypher
  • 很棒的MCP服务器 - 模型上下文协议服务器的策划列表

    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!