GitLab PR 분석 MCP 서버
이 프로젝트는 GitLab 병합 요청 분석과 Confluence 문서를 통합하는 MCP(모델 제어 프로토콜) 서버를 제공합니다. 이를 통해 병합 요청 세부 정보를 가져오고, 코드 변경 사항을 분석하고, 결과를 Confluence 페이지에 저장할 수 있습니다.
특징
GitLab에서 병합 요청 세부 정보 가져오기
병합 요청의 코드 변경 사항 분석
다음을 포함한 자세한 보고서를 생성합니다.
기본 병합 요청 정보
코드 변경 통계
파일 유형 분석
자세한 파일 변경 사항
Confluence에서 매장 분석 결과
디버깅을 위한 포괄적인 로깅
Related MCP server: GitLab MCP Server
필수 조건
Python 3.8 이상
API 액세스가 가능한 GitLab 계정
Confluence 계정(선택 사항, 분석 결과 저장용)
필요한 GitLab 프로젝트에 대한 액세스
설치
저장소를 복제합니다.
지엑스피1
가상 환경을 만들고 활성화하세요.
python -m venv .venv
source .venv/bin/activate # On Windows, use: .venv\Scripts\activate종속성 설치:
pip install -r requirements.txt또는
uv add "mcp[cli]" python-gitlab python-dotenv atlassian-python-api requests구성
예제 환경 파일을 복사하세요.
cp .env.example .env자격 증명으로
.env파일을 편집합니다.
GITLAB_URL=https://gitlab.com
GITLAB_TOKEN=your_gitlab_token
GITLAB_PROJECT_ID=your_project_id
# Optional Confluence integration
CONFLUENCE_URL=your_confluence_url
CONFLUENCE_USERNAME=your_username
CONFLUENCE_TOKEN=your_confluence_token
CONFLUENCE_SPACE=your_space_key자격 증명 취득
GitLab 토큰 :
api범위로 GitLab에서 개인 액세스 토큰 생성Confluence 토큰 : Atlassian 계정 설정에서 API 토큰을 생성하세요
용법
MCP 서버를 시작합니다.
python src/MRConfluenceLinker-mcp-server/server.py또는
Claude Desktop으로 설정
# claude_desktop_config.json
# Can find location through:
# Claude -> Settings -> Developer -> Edit Config
{
"mcpServers": {
"MRConfluenceLinker-mcp-server": {
"command": "uv",
"args": [
"--directory",
"/<Absolute-path-to-folder>/MRConfluenceLinker-mcp-server/src/MRConfluenceLinker-mcp-server",
"run",
"server.py"
]
}
}
}
2. The server will listen for commands through stdin/stdout. You can interact with it using prompts like:
"my-project" 프로젝트의 병합 요청 #1에 대한 세부 정보를 가져올 수 있나요? "my-project" 프로젝트의 병합 요청 #1에서 코드 변경 사항을 분석할 수 있나요? "my-project" 프로젝트의 병합 요청 #1에 대한 요약을 Confluence에 저장할 수 있나요?
## Available Tools
The server provides the following tools:
1. `fetch_mr_details`: Fetches details of a specific merge request or all merge requests
- Parameters:
- `project_id`: The GitLab project ID
- `mr_id` (optional): Specific merge request ID
2. `analyze_code_changes`: Analyzes code changes in a merge request
- Parameters:
- `project_id`: The GitLab project ID
- `mr_id`: The merge request ID to analyze
3. `store_in_confluence`: Stores analysis results in Confluence
- Parameters:
- `project_id`: The GitLab project ID
- `mr_id` (optional): Specific merge request ID
- `analysis` (optional): Analysis results to store
## Logging
The server generates detailed logs in `mcp_server.log` and outputs to stderr. This helps in debugging issues with:
- GitLab API access
- Confluence integration
- Code analysis
- Page creation and updates
## Error Handling
The server includes comprehensive error handling for:
- Missing environment variables
- API authentication issues
- Network connectivity problems
- Invalid project or merge request IDs
- Confluence permission issues
## Contributing
1. Fork the repository
2. Create a feature branch
3. Commit your changes
4. Push to the branch
5. Create a Pull Request
## License
This project is licensed under the MIT License - see the LICENSE file for details.
## Support
For support, please [create an issue](https://github.com/CodeByWaqas/MRConfluenceLinker-mcp-server/issues) or contact the maintainers.
## Project Structure
MRConfluenceLinker-mcp-server/ ├── src/ # 소스 코드 디렉터리 │ └── MRConfluenceLinker-mcp-server/ # 메인 서버 패키지 │ ├── resources/ # 리소스 모듈 │ │ ├── init .py │ │ ├── client.py # 클라이언트 구현 / GitLab PR 통합 │ ├── server.py # 메인 서버 구현 │ └── mcp_server.log # 서버 로그 ├── pycache / # Python 캐시 파일 ├── .git/ # Git 저장소 ├── .gitignore # Git 무시 규칙 ├── CONTRIBUTING.md # 기여 지침 ├── LICENSE # 프로젝트 라이선스 ├── README.md # 프로젝트 문서 ├── pyproject.toml # Python 프로젝트 구성 ├── requirements.txt # 프로젝트 종속성 └── uv.lock # 종속성 잠금 파일
### Key Components
- **Source Code**: Located in the `src/MRConfluenceLinker-mcp-server/` directory
- `server.py`: Main MCP server implementation
- `resources/client.py`: Client-side implementation contains GitLab PR integration
- **Configuration Files**:
- `requirements.txt`: Python package dependencies
- `pyproject.toml`: Project metadata and build configuration
- `uv.lock`: Locked dependency versions
- `.env.example`: Environment variables template
- **Documentation**:
- `README.md`: Project overview and setup instructions
- `CONTRIBUTING.md`: Contribution guidelines
- `LICENSE`: Project license
- **Development**:
- `__pycache__/`: Python cache files
- `mcp_server.log`: Server logs for debugging