snow · 2026.5.9 11:48 · 조회 2

MCP 서버 연동

MCP(Model Context Protocol)란?

MCP는 AI 에이전트가 외부 도구와 서비스에 접근할 수 있도록 하는 표준 프로토콜입니다. Claude Code에 MCP 서버를 연결하면 GitHub, Slack, Jira, 데이터베이스 등을 대화 중에 직접 제어할 수 있습니다.


MCP 서버 등록

글로벌 설정 (~/.claude/settings.json)

모든 프로젝트에서 사용할 MCP 서버를 등록합니다.

{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_..."
      }
    },
    "slack": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-slack"],
      "env": {
        "SLACK_BOT_TOKEN": "xoxb-...",
        "SLACK_TEAM_ID": "T..."
      }
    }
  }
}

프로젝트 설정 (.claude/settings.json)

특정 프로젝트에서만 사용할 MCP 서버를 등록합니다.

{
  "mcpServers": {
    "snowiki": {
      "command": "node",
      "args": ["./mcp-server/dist/index.js"],
      "env": {
        "SNOWIKI_BASE_URL": "https://wiki.example.com",
        "SNOWIKI_API_TOKEN": "your-token"
      }
    }
  }
}

CLI로 MCP 서버 관리

# 등록된 MCP 서버 목록 확인
claude mcp list

# MCP 서버 추가
claude mcp add github -e GITHUB_PERSONAL_ACCESS_TOKEN=ghp_...

# MCP 서버 제거
claude mcp remove github

# MCP 서버 상태 확인
claude mcp status

주요 MCP 서버

GitHub

claude mcp add github \
  -e GITHUB_PERSONAL_ACCESS_TOKEN=ghp_...

사용 예시:

내 GitHub에서 오픈된 PR 목록을 보여줘.
이 코드 변경사항으로 PR을 만들어줘.

Filesystem

로컬 파일 시스템 접근 범위를 명시적으로 설정합니다.

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/home/user/projects"]
    }
  }
}

PostgreSQL / MySQL

{
  "mcpServers": {
    "postgres": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-postgres"],
      "env": {
        "POSTGRES_CONNECTION_STRING": "postgresql://user:pass@localhost/mydb"
      }
    }
  }
}

사용 예시:

users 테이블의 구조를 보여줘.
지난 7일간 가입한 사용자 수를 조회해줘.

Slack

#dev-team 채널에 배포 완료 메시지를 보내줘.
오늘 #incident 채널의 주요 내용을 요약해줘.

커스텀 MCP 서버 만들기

MCP SDK를 사용하여 자체 서버를 만들 수 있습니다.

import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";

const server = new Server({ name: "my-server", version: "1.0.0" });

server.setRequestHandler("tools/list", async () => ({
  tools: [{
    name: "get_data",
    description: "데이터를 가져옵니다",
    inputSchema: {
      type: "object",
      properties: { id: { type: "string" } },
      required: ["id"]
    }
  }]
}));

const transport = new StdioServerTransport();
await server.connect(transport);

댓글

아직 댓글이 없습니다.

댓글을 작성하려면 로그인이 필요합니다.