Skip to main content
Glama
Tae4an

Compliance Scanner MCP

by Tae4an
README.md
# Compliance Scanner MCP

[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
[![MCP](https://img.shields.io/badge/MCP-Compatible-green.svg)](https://modelcontextprotocol.io/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

**ISMS-P, NIST, CIS Benchmark** 등 보안 규제 문서를 분석하는 **MCP(Model Context Protocol) 서버**입니다.

Claude Desktop과 연동하여 PDF/TXT 형식의 규제 문서를 구조화된 JSON으로 변환하고, AWS 서비스 추천, 난이도 평가, 구현 일수 추정 등을 제공합니다.

---

## 주요 기능

| 기능 | 설명 |
|------|------|
| **규제 분석** | 텍스트에서 규제 ID, 요구사항, 키워드 자동 추출 |
| **PDF 처리** | PDF 파일 읽기, 페이지 범위 지정, 키워드 검색 |
| **AWS 추천** | 규제 요구사항에 맞는 AWS 서비스 자동 추천 |
| **규제 비교** | 여러 규제 간 공통점/차이점 분석 |
| **난이도 평가** | 구현 난이도 및 예상 일수 자동 추정 |

---

## 설치 방법

### 1. 저장소 클론

```bash
git clone https://github.com/yourusername/compliance-scanner-mcp.git
cd compliance-scanner-mcp
```

### 2. 가상환경 생성 및 활성화

```bash
python -m venv venv
source venv/bin/activate  # macOS/Linux
# 또는
venv\Scripts\activate  # Windows
```

### 3. 의존성 설치

```bash
pip install -e .
# 또는
pip install -r requirements.txt
```

---

## Claude Desktop 연동

### 1. Claude Desktop 설정 파일 열기

**macOS:**
```bash
code ~/Library/Application\ Support/Claude/claude_desktop_config.json
```

**Windows:**
```bash
code %APPDATA%\Claude\claude_desktop_config.json
```

### 2. MCP 서버 설정 추가

```json
{
  "mcpServers": {
    "compliance-scanner": {
      "command": "python",
      "args": ["-m", "src"],
      "cwd": "/path/to/compliance-scanner-mcp"
    }
  }
}
```

> `cwd` 경로를 실제 프로젝트 경로로 변경하세요.

### 3. Claude Desktop 재시작

설정 후 Claude Desktop을 재시작하면 도구가 활성화됩니다.

---

## 사용 예시

### 예시 1: 규제 텍스트 분석

Claude에게 다음과 같이 요청:

```
다음 규제를 분석해줘:

ISMS-P 2.8.1 접근통제 정책

정보시스템에 대한 접근을 통제하여 비인가자의 접근을 방지해야 한다.

- 접근권한을 최소한으로 부여한다
- 주기적으로 접근권한을 검토한다
- 접근 로그를 기록하고 모니터링한다
```

**결과:**
```json
{
  "regulation_id": "ISMS-P 2.8.1",
  "title": "ISMS-P 2.8.1 접근통제 정책",
  "summary": "정보시스템에 대한 접근을 통제하여 비인가자의 접근을 방지해야 한다.",
  "requirements": [
    "접근권한을 최소한으로 부여한다",
    "주기적으로 접근권한을 검토한다",
    "접근 로그를 기록하고 모니터링한다"
  ],
  "technical_keywords": ["IAM", "접근제어", "CloudTrail", "로깅"],
  "aws_services": ["AWS IAM", "AWS CloudTrail", "Amazon CloudWatch"],
  "difficulty": "보통",
  "estimated_days": 5
}
```

---

### 예시 2: PDF 파일 읽기 및 분석

```
regulations/ISMS-P.pdf 파일의 10~15페이지를 읽고 분석해줘
```

---

### 예시 3: PDF 키워드 검색

```
regulations/NIST-800-53.pdf에서 "encryption" 키워드를 검색해줘
```

**결과:**
```json
{
  "keyword": "encryption",
  "total_matches": 47,
  "pages_with_matches": 12,
  "results": [
    {
      "page": 15,
      "matches": [
        "SC-13: Cryptographic Protection - encryption requirements...",
        "Data encryption at rest and in transit..."
      ]
    }
  ]
}
```

---

### 예시 4: 여러 규제 비교

```
다음 두 규제를 비교 분석해줘:

1. ISMS-P 2.8.1 접근통제 정책
   - 접근권한을 최소한으로 부여
   - 주기적으로 권한 검토

2. NIST AC-2 계정 관리
   - 계정 유형 정의
   - 계정 관리자 지정
```

---

## MCP Tools

| Tool | 설명 |
|------|------|
| `analyze_regulation` | 규제 텍스트를 구조화된 JSON으로 변환 |
| `read_pdf` | PDF 파일을 텍스트로 변환 |
| `search_in_pdf` | PDF에서 키워드 검색 |
| `analyze_pdf_regulation` | PDF 읽기 + 분석 (결합) |
| `list_regulations` | regulations/ 폴더 파일 목록 |
| `compare_regulations` | 여러 규제 비교 분석 |

## MCP Resources

| Resource | 설명 |
|----------|------|
| `regulation://list` | 규제 문서 목록 |
| `regulation://isms-p/{item_id}` | ISMS-P 규제 조회 (예: `regulation://isms-p/2-8-1`) |

---

## 테스트

```bash
# 전체 테스트 실행
pytest tests/ -v

# 특정 테스트 실행
pytest tests/test_analyzer.py -v

# 커버리지 포함
pytest tests/ -v --cov=src
```

---

## 보안

- `regulations/` 폴더 외부의 파일에는 접근할 수 없습니다.
- 절대 경로 입력 시에도 `regulations/` 폴더 내부만 접근 가능합니다.

---

## 기여하기

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'feat: Add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

---

## 📄 라이선스

MIT License - 자세한 내용은 [LICENSE](LICENSE) 파일을 참조하세요.

---

## 📞 문의

문의사항이나 버그 리포트는 [Issues](https://github.com/yourusername/compliance-scanner-mcp/issues)에 등록해주세요.