인터넷

Model Context Protocol 이 뭐지?

ngcbbs 2025. 3. 24. 10:11

Anthropic이 2024년 11월 오픈소스로 공개한 프로토콜. AI(특히 LLM)가 외부 데이터나 도구와 연결되도록 표준화된 방식 제공.

 

목적

  • 실시간 외부 데이터 접근 (문서, DB 등).
  • 개발 효율성 (개별 커넥터 없이 통합).
  • 워크플로우 확장성 (컨텍스트 유지).
  • 보안 (API 키 공유 없이 연결).

동작 - AI(클라이언트)가 도구/데이터(서버)를 호출. 훈련 데이터 한계 넘어서 최신 정보 활용 가능.

  • 개념: 클라이언트-서버 간 표준 인터페이스.
  • 설치: Python에서 pip install fastmcp.
  • 예제:
    # 이름은 통해서 국적을 추측하는 ai api
    from fastmcp import FastMCP
    import httpx
    mcp = FastMCP("origin-predictor")
    @mcp.tool()
    async def predict_origin(name: str) -> dict:
        async with httpx.AsyncClient() as client:
            response = await client.get(f"https://api.nationalize.io/?name={name}")
            return response.json()
    mcp.run(transport='stdio')
  • 참고 자료:https://spec.modelcontextprotocol.io/specification/2024-11-05/ 
  • 관련 C# 프로젝트:https://github.com/modelcontextprotocol/csharp-sdk
  • 활용 예: 회사 문서 검색, 슬랙 메시지 분석 등. 작은 테스트 시작 → 대규모 통합 가능.