GitLab PR Analysis MCP Server について
GitLab PR Analysis MCP Serverは、GitLabのマージリクエスト分析とConfluenceの文書化を結び付けます。変更を確認して記録するチーム向けに、詳細取得、コード変更分析、レポート保存を行います。
主な機能
- 01マージリクエスト詳細の取得
- 02コード変更の分析
- 03変更統計とファイル分析の生成
- 04分析結果のConfluence保存
- 05デバッグログの記録
活用シーン
- 01マージリクエストのコード変更確認
- 02ファイル種別と変更内容の集計
- 03分析結果のConfluenceへの保存
MCP 対応
MCP サーバーとして、GitLabのマージリクエスト詳細取得、コード変更分析、Confluenceへの保存ツールをMCPクライアントに提供します。
設定
ローカルサーバーの設定はどのクライアントでも共通です。コピーしてクライアントの MCP 設定ファイルに貼り付けてください。
このサーバーのパッケージやリモートエンドポイントはまだ取得できていません。プロジェクトの README の手順に従ってください。
ツール
ローカルサーバーのツールはマシン上で起動して初めて取得できます。メンテナーはまだツール一覧を提供していません。
詳細
GitLab PR 分析 MCP サーバー
このプロジェクトは、GitLab のマージリクエスト分析と Confluence のドキュメントを連携する MCP(Model Control Protocol)サーバーを提供します。マージリクエストの詳細を取得し、コード変更を分析して、その結果を Confluence ページに保存できます。
機能
- GitLab からマージリクエストの詳細を取得
- マージリクエストのコード変更を分析
- 次の内容を含む詳細なレポートを生成:
- マージリクエストの基本情報
- コード変更の統計情報
- ファイルタイプの分析
- ファイル変更の詳細
- 分析結果を Confluence に保存
- デバッグ用の包括的なログ記録
前提条件
- Python 3.8 以上
- API にアクセスできる GitLab アカウント
- Confluence アカウント(分析結果の保存に使用する場合は任意)
- 必要な GitLab プロジェクトへのアクセス権
インストール
- リポジトリをクローンします:
git https://github.com/CodeByWaqas/MRConfluenceLinker-mcp-server.git
cd MRConfluenceLinker-mcp-server
- 仮想環境を作成して有効化します:
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 トークン:GitLab で
apiスコープのパーソナルアクセストークンを生成します - 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
コメント
AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。