GitLab MCP for Code Review

by mehmetakinn
MIT License
1
  • Linux
  • Apple

Integrations

  • Enables interaction with GitLab's API to analyze and manage merge requests, including fetching diffs, comparing versions, adding comments, and approving/unapproving merge requests.

코드 검토를 위한 GitLab MCP

이 프로젝트는 cayirtepeomer/gerrit-code-review-mcp 에서 포크되어 GitLab 통합에 맞게 조정되었습니다.

Claude와 같은 AI 어시스턴트를 GitLab의 병합 요청과 통합하는 MCP(Model Context Protocol) 서버입니다. 이를 통해 AI 어시스턴트는 GitLab API를 통해 코드 변경 사항을 직접 검토할 수 있습니다.

특징

  • 병합 요청 분석 완료 : diff, 커밋, 주석을 포함한 병합 요청에 대한 전체 세부 정보를 가져옵니다.
  • 파일별 차이점 : 병합 요청 내 특정 파일의 변경 사항 분석
  • 버전 비교 : 다양한 브랜치, 태그 또는 커밋을 비교합니다.
  • 검토 관리 : 주석 추가, 병합 요청 승인 또는 승인 취소
  • 프로젝트 개요 : 프로젝트의 모든 병합 요청 목록 가져오기

설치

필수 조건

  • 파이썬 3.10+
  • API 범위(read_api, api)가 있는 GitLab 개인 액세스 토큰
  • MCP 전체 통합을 위한 커서 IDE

빠른 시작

  1. 이 저장소를 복제하세요:

지엑스피1

  1. 가상 환경을 만들고 활성화하세요.
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
  1. 종속성 설치:
pip install -r requirements.txt
  1. GitLab 구성으로 .env 파일을 만듭니다(모든 옵션은 .env.example 참조):
# Required GITLAB_TOKEN=your_personal_access_token_here # Optional settings GITLAB_HOST=gitlab.com GITLAB_API_VERSION=v4 LOG_LEVEL=INFO

구성 옵션

다음 환경 변수는 .env 파일에서 구성할 수 있습니다.

변하기 쉬운필수의기본설명
GITLAB_TOKEN-귀하의 GitLab 개인 액세스 토큰
GITLAB_HOST아니요gitlab.comGitLab 인스턴스 호스트 이름
GITLAB_API_버전아니요v4사용할 GitLab API 버전
로그 레벨아니요정보로깅 수준(DEBUG, INFO, WARNING, ERROR, CRITICAL)
디버그아니요거짓디버그 모드 활성화
요청 시간 초과아니요30API 요청 시간 초과(초)
최대 재시도 횟수아니요3실패한 요청에 대한 최대 재시도 횟수

커서 IDE 통합

이 MCP를 Cursor IDE와 함께 사용하려면 ~/.cursor/mcp.json 파일에 다음 구성을 추가하세요.

{ "mcpServers": { "gitlab-mcp-code-review": { "command": "/path/to/your/gitlab-mcp-code-review/.venv/bin/python", "args": [ "/path/to/your/gitlab-mcp-code-review/server.py", "--transport", "stdio" ], "cwd": "/path/to/your/gitlab-mcp-code-review", "env": { "PYTHONPATH": "/path/to/your/gitlab-mcp-code-review", "VIRTUAL_ENV": "/path/to/your/gitlab-mcp-code-review/.venv", "PATH": "/path/to/your/gitlab-mcp-code-review/.venv/bin:/usr/local/bin:/usr/bin:/bin" }, "stdio": true } } }

/path/to/your/gitlab-mcp-code-review 복제된 저장소의 실제 경로로 바꾸세요.

사용 가능한 도구

MCP 서버는 GitLab과 상호 작용하기 위한 다음과 같은 도구를 제공합니다.

도구설명
fetch_merge_request병합 요청에 대한 전체 정보를 얻으세요
fetch_merge_request_diff특정 병합 요청에 대한 차이점 가져오기
fetch_commit_diff특정 커밋에 대한 diff 정보 가져오기
compare_versions다양한 브랜치, 태그 또는 커밋을 비교합니다.
add_merge_request_comment병합 요청에 주석 추가
approve_merge_request병합 요청 승인
unapprove_merge_request병합 요청 승인 취소
get_project_merge_requests프로젝트에 대한 병합 요청 목록 가져오기

사용 예

병합 요청 가져오기

# Get details of merge request #5 in project with ID 123 mr = fetch_merge_request("123", "5")

특정 파일 변경 사항 보기

# Get diff for a specific file in a merge request file_diff = fetch_merge_request_diff("123", "5", "path/to/file.js")

지점 비교

# Compare develop branch with master branch diff = compare_versions("123", "develop", "master")

병합 요청에 주석 추가

# Add a comment to a merge request comment = add_merge_request_comment("123", "5", "This code looks good!")

병합 요청 승인

# Approve a merge request and set required approvals to 2 approval = approve_merge_request("123", "5", approvals_required=2)

문제 해결

문제가 발생하는 경우:

  1. GitLab 토큰에 적절한 권한(api, read_api)이 있는지 확인하세요.
  2. .env 파일 설정을 확인하세요
  3. MCP 구성 경로가 올바른지 확인하세요.
  4. curl -H "Private-Token: your-token" https://gitlab.com/api/v4/projects 사용하여 연결을 테스트합니다.
  5. 더 자세한 로깅을 위해 .env 파일에서 LOG_LEVEL=DEBUG를 설정하세요.

기여하다

기여를 환영합니다! 풀 리퀘스트를 제출해 주세요.

  1. 저장소를 포크하세요
  2. 기능 브랜치를 생성합니다( git checkout -b feature/amazing-feature )
  3. 변경 사항을 커밋하세요( git commit -m 'Add some amazing feature' )
  4. 브랜치에 푸시( git push origin feature/amazing-feature )
  5. 풀 리퀘스트 열기

개발 과정에 대한 자세한 내용은 CONTRIBUTING.md 파일을 참조하세요.

특허

이 프로젝트는 MIT 라이선스에 따라 라이선스가 부여되었습니다. 자세한 내용은 라이선스 파일을 참조하세요.

-
security - not tested
A
license - permissive license
-
quality - not tested

Claude와 같은 AI 어시스턴트를 GitLab의 병합 요청과 통합하는 MCP 서버를 통해 코드 변경 사항을 검토하고, 주석을 추가하고, GitLab API를 통해 직접 병합 요청을 승인/승인 취소할 수 있습니다.

  1. 특징
    1. 설치
      1. 필수 조건
      2. 빠른 시작
    2. 구성 옵션
      1. 커서 IDE 통합
        1. 사용 가능한 도구
          1. 사용 예
            1. 병합 요청 가져오기
            2. 특정 파일 변경 사항 보기
            3. 지점 비교
            4. 병합 요청에 주석 추가
            5. 병합 요청 승인
          2. 문제 해결
            1. 기여하다
              1. 특허

                Related MCP Servers

                • A
                  security
                  A
                  license
                  A
                  quality
                  MCP Server for the GitLab API, enabling project management, file operations, and more.
                  Last updated -
                  9
                  1,630
                  44,247
                  JavaScript
                  MIT License
                  • Linux
                  • Apple
                • -
                  security
                  F
                  license
                  -
                  quality
                  A custom server implementation that allows AI assistants to interact with GitLab repositories, providing capabilities for searching, fetching files, creating/updating content, and managing issues and merge requests.
                  Last updated -
                  JavaScript
                • -
                  security
                  F
                  license
                  -
                  quality
                  An MCP server that enables communication with GitLab repositories, allowing interaction with GitLab's API to manage projects, issues, and repositories through natural language.
                  Last updated -
                  20
                  JavaScript
                • A
                  security
                  F
                  license
                  A
                  quality
                  An MCP server that enables AI assistants to manage GitHub Actions workflows by providing tools for listing, viewing, triggering, canceling, and rerunning workflows through the GitHub API.
                  Last updated -
                  9
                  24
                  TypeScript
                  • Linux
                  • Apple

                View all related MCP servers

                ID: 1q749wqn55