C.W.K.
Stream
Lesson 05 of 08 · published

Agent SDK의 MCP 서버

~16 min · mcp, model-context-protocol, servers

Level 0Observer
0 XP0/64 lessons0/13 achievements
0/150 XP to next level150 XP to go0% complete

MCP가 여기서 중요한 이유

MCP(Model Context Protocol)가 Agent SDK가 built-in 도구 너머로 확장하는 법. MCP 서버(너 코드, 또는 third-party) launch하고 SDK가 connect, 서버 도구 학습, 모델한테 노출. Claude Code가 사용하는 같은 프로토콜; Cursor와 Windsurf가 사용하는 같은 프로토콜. 한 번 빌드, 어디서든 사용.

Transport 옵션 셋

MCP 서버가 stdio(서브프로세스), SSE(HTTP server-sent events), HTTP(request/response) 위에 run. stdio가 가장 싸고 흔함 — 너 서버가 SDK가 spawn하는 child 프로세스. SSE와 HTTP는 서버가 별도(컨테이너, 원격 service) run할 때 fit.

cwkPippa가 MCP로 능력 노출

피파의 vault, 날씨 데이터, 이미지 생성, 다른 personal-data 능력이 MCP 서버로 run. Claude 브레인(Agent SDK)이 모두에 connect. 같은 MCP 서버가 어떤 클라이언트에서든 같은 피파 능력 위해 Claude Code나 Cursor에 wire 가능.

원칙: 능력을 MCP 서버로 빌드, 코드가 어떤 단일 클라이언트도 outlive. 프로토콜이 durable 표면.

Code

Options로 MCP 서버 attach·python
from claude_agent_sdk import ClaudeAgentOptions

options = ClaudeAgentOptions(
    cwd="/srv/agent",
    mcp_servers={
        "pippa-vault": {
            "type": "stdio",
            "command": "node",
            "args": ["/Users/you_username/Obsidian/pippa/mcp/vault-server.js"],
        },
        "weather": {
            "type": "stdio",
            "command": "python",
            "args": ["-m", "my_weather_mcp"],
            "env": {"WEATHER_API_KEY": os.environ["WEATHER_API_KEY"]},
        },
        "shared-cache": {
            "type": "http",
            "url": "https://internal.example.com/mcp/cache",
            "headers": {"Authorization": f"Bearer {token}"},
        },
    },
)
MCP 서버가 노출하는 도구 발견·bash
# Claude Code CLI 안 (인터랙티브):
#   /mcp list
#
# 또는 SDK로 programmatically, connect() 후:
#   await client.list_tools()  # 모든 attached MCP 서버에서 merged 도구 카탈로그 반환

External links

Exercise

에이전트가 inline 호출하는 능력 하나 식별. 그것을 위한 작은 MCP 서버 빌드(stdio OK). Agent SDK options에 wire. 모델이 built-in 도구처럼 호출 가능 verify.
Hint
직접 쓴 HTTP API 있으면 MCP가 그걸 클라이언트 사이 Claude-callable로 만드는 thin wrapper — 보통 50-100 라인 glue code.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.