# MCP (Model Context Protocol) 설정 가이드

> Clawdbot에서 MCP 연동을 설정하는 방법

---

## 📋 목록

1. [MCP란 무엇인가?](https://#mcp%EB%9E%80-%EB%AC%B4%EC%97%87%EC%9D%B8%EA%B0%80)

2. [MCP 서버 구성](https://#mcp-%EC%84%9C%EB%B2%84-%EA%B5%AC%EC%84%B1)

3. [MCP 클라이언트 설정](https://#mcp-%ED%81%B4%EB%9D%BC%EC%9D%B4%EC%96%B8%ED%8A%B8-%EC%84%A4%EC%A0%95)

4. [Clawdbot과 MCP 연동](https://#clawdbot%EA%B3%BC-mcp-%EC%97%B0%EB%8F%99)

5. [데이터 Notion으로 업로드](https://#%EB%8D%B0%EC%9D%B4%ED%84%B0-notion%EC%9C%BC%EB%A1%9C-%EC%97%85%EB%A1%9C%EB%93%9C)

---

## 🤔 MCP란 무엇인가?

**MCP (Model Context Protocol)**는 AI 어시스턴트가 외부 도구와 데이터 소스에 연결하기 위한 표준 프로토콜입니다.

### 핵심 특징

- ✅ **표준화된 인터페이스**: 도구와 데이터 소스에 통합된 접근

- ✅ **타입 안정성**: JSON Schema 기반 타입 정의

- ✅ **양방향 통신**: 스트리밍과 이벤트 지원

- ✅ **리소스 격리**: 각 리소스가 독립된 샌드박스에서 실행

### 지원 리소스

| 리소스 타입 | 설명 | 예시 |
| --- | --- | --- |
| **도구 (Tools)** | 실행 가능한 함수 | 데이터베이스 쿼리, 검색, 파일 조작 |
| **프롬프트 (Prompts)** | 재사용 가능한 프롬프트 템플릿 | 시스템 프롬프트, 사용자 정의 프롬프트 |
| **리소스 (Resources)** | 읽기 전용 데이터 소스 | 문서, 데이터베이스, API |

---

## 🏗 MCP 서버 구성

### MCP 서버 시작

```javascript
# MCP 서버 실행 (stdio 모드)
mcp-server

# 또는 HTTP 모드
mcp-server --transport sse
```

### 구성 파일 (mcp-server.config.json)

```javascript
{
  "mcpServers": {
    "filesystem": {
      "command": "npx -y @modelcontextprotocol/server-filesystem",
      "args": ["~/Documents"]
    },
    "sqlite": {
      "command": "npx -y @modelcontextprotocol/server-sqlite",
      "args": ["~/clawd/memory.db"]
    },
    "git": {
      "command": "npx -y @modelcontextprotocol/server-git",
      "args": ["~/clawd"]
    }
  },

  "tools": {
    "npx -y @modelcontextprotocol/server-postgres": {
      "enabled": false
    }
  }
}
```

---

## 🔌 MCP 클라이언트 설정

### Clawdbot MCP 클라이언트

Clawdbot은 MCP 클라이언트로 다음 MCP 서버와 연결할 수 있습니다:

```javascript
{
  "mcp": {
    "servers": {
      "notion": {
        "enabled": true,
        "transport": "stdio",
        "command": "npx -y @notionhq/mcp-server-notion",
        "args": ["--token", "$NOTION_API_TOKEN"]
      },
      "filesystem": {
        "enabled": true,
        "transport": "stdio",
        "command": "npx -y @modelcontextprotocol/server-filesystem",
        "args": ["~/clawd"]
      },
      "github": {
        "enabled": false
      "command": "npx -y @mcp-server/github",
        "args": ["--token", "$GITHUB_TOKEN"]
      }
    }
  },

  "agents": {
    "notion-integration": {
      "enabled": true,
      "mcpServers": ["notion", "filesystem"],
      "description": "Notion 통합 에이전트"
    }
  }
}
```

---

## 🦞 Clawdbot과 MCP 연동

### 1. MCP 서버 설치

```javascript
# Notion MCP 서버 설치
npm install -g @notionhq/mcp-server-notion

# 파일 시스템 MCP 서버 설치
npx -y @modelcontextprotocol/server-filesystem
```

### 2. 환경 변수 설정

```javascript
# Notion API 토큰 설정
export NOTION_API_TOKEN="your_notion_integration_token"

# GitHub 토큰 설정 (선택적)
export GITHUB_TOKEN="your_github_token"
```

### 3. Clawdbot 설정에 MCP 추가

```javascript
{
  "mcp": {
    "enabled": true,
    "maxConnections": 10,
    "timeout": 30000,
    "logLevel": "info"
  },

  "agents": {
    "notion-integration": {
      "model": "anthropic/claude-opus-4-5",
      "tools": ["mcp"],
      "workspace": "~/clawd"
    }
  }
}
```

### 4. MCP 도구 사용

**에이전트에서 MCP 도구 사용:**

```javascript
Notion에 문서를 생성해줘
```

Clawdbot이 MCP를 통해 Notion과 통신:

```javascript
1. 에이전트가 MCP 클라이언트에게 요청
2. MCP 클라이언트가 Notion MCP 서버와 통신
3. Notion MCP 서버가 Notion API 호출
4. 결과가 에이전트로 반환됨
```

---

## 📝 데이터 Notion으로 업로드

### 방법 1: MCP 도구를 통한 직접 업로드

```javascript
# Clawdbot에서 Notion으로 데이터 전송
clawdbot agent --message "다음 내용을 Notion에 업로드해줘:

1. Clawdbot 문서 개요
2. 아키텍처 다이어그램
3. 사용 가이드
4. 고급 기능 가이드"
```

**에이전트 프롬프트:**

```javascript
Notion에 문서를 업로드합니다.

## 업로드할 문서 목록

1. 개요 (overview/README.md)
2. 빠른 시작 (overview/quickstart.md)
3. 아키텍처 (architecture/README.md)
4. 채널 (channels/README.md)
5. 도구 (tools/README.md)
6. 보안 (security/README.md)
7. CLI 명령어 (cli-config/commands.md)
8. 설정 (cli-config/configuration.md)
9. 워크스페이스 (cli-config/workspace.md)
10. 문제 해결 (usage/troubleshooting.md)
11. 비교 분석 (comparison/frameworks.md)
12. 고급 기능 (usage/advanced-features.md)
13. 사용 시나리오 (usage/scenarios.md)
14. 핵심 가이드 (CORY_GUIDE.md)
15. 아키텍처 다이어그램 (diagrams/architecture.md)

## 업로드 방법

Notion API를 사용하여 각 문서를 별도 페이지로 생성하고 컨텐츠에 추가합니다.
```

### 방법 2: 파일 시스템 MCP를 통한 업로드

```javascript
# 파일 시스템 MCP 서버 사용
mcp-server-filesystem --path ~/clawd

# Clawdbot에서 파일 시스템 접근
clawdbot agent --message "~/clawd/ClawdbotDocs 디렉토리의 모든 파일을 읽어서 Notion에 업로드해줘"
```

### 방법 3: GitHub 연동을 통한 업로드

```javascript
# GitHub MCP 서버 사용
npx -y @mcp-server/github

# Clawdbot에서 GitHub 접근
clawdbot agent --message "https://github.com/user/clawdbot-docs 레포지토리를 Notion으로 임포트해줘"
```

---

## 🔍 설정 확인

### MCP 연결 확인

```javascript
# MCP 서버 상태 확인
mcp-server status

# Clawdbot에서 MCP 테스트
clawdbot agent --message "MCP 서버에 연결할 수 있는지 테스트해줘"
```

### 로그 확인

```javascript
# MCP 로그 확인
tail -f ~/.mcp-server/logs/mcp.log

# Clawdbot 로그에서 MCP 확인
clawdbot logs gateway | grep -i mcp
```

---

## 🎯 추천 업로드 절차

### 1. 준비 단계

```javascript
# 1. Notion API 토큰 확인
echo $NOTION_API_TOKEN

# 2. 문서 구조 확인
ls -la ~/clawd/ClawdbotDocs/

# 3. 업로드할 파일 목록 생성
find ~/clawd/ClawdbotDocs -name "*.md" -type f > upload-list.txt
```

### 2. 업로드 단계

```javascript
# Clawdbot을 사용하여 순차적 업로드
clawdbot agent --message "upload-list.txt의 파일 목록을 읽고 각 파일을 Notion에 업로드해줘. 한 번에 5개씩 업로드해주세요."
```

### 3. 검증 단계

```javascript
# Notion에서 업로드된 문서 확인
clawdbot agent --message "Notion에서 업로드된 문서의 제목과 URL을 확인해줘"
```

---

## 📊 MCP 연동 구조

```javascript
graph TB
    A[Clawdbot] -->|MCP Client| B[MCP Client]
    B -->|Protocol| C[Notion MCP Server]
    B -->|Protocol| D[Filesystem MCP Server]
    B -->|Protocol| E[Github MCP Server]
    C -->|Notion API| F[Notion]
    D -->|G| G[GitHub]
    E --> H[Local Filesystem]
```

---

## 🔗 관련 문서

- [Notion API 문서](https://developers.notion.com/docs)

- [MCP 공식 문서](https://modelcontextprotocol.io)

- [MCP 서버 레포지토리](https://github.com/modelcontextprotocol/servers)

- [Notion MCP 서버](https://github.com/notionhq/mcp-server-notion)

---

## 🎯 다음 단계

1. **Notion API 토큰 발급**: [https://www.notion.so/my-integrations](https://www.notion.so/my-integrations)

2. **MCP 서버 설치**: `npm install -g @notionhq/mcp-server-notion`

3. **Clawdbot 설정 업데이트**: 위 설정을 적용

4. **데이터 업로드**: Clawdbot을 통해 순차적 업로드

---

## ✅ 완료 체크리스트

- [ ] MCP 서버 설치 완료

- [ ] Notion API 토큰 설정 완료

- [ ] Clawdbot MCP 설정 완료

- [ ] 연결 테스트 완료

- [ ] 문서 업로드 완료

For the site tree, see the [root Markdown](https://slashpage.com/techkwon.md).
