Labsco
CodeByWaqas logo

GitLab MR & Confluence Linker

from CodeByWaqas

Analyzes GitLab merge requests and links them to Confluence documentation.

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedFreeAdvanced setup

GitLab PR Analysis MCP Server

This project provides an MCP (Model Control Protocol) server that integrates GitLab merge request analysis with Confluence documentation. It allows you to fetch merge request details, analyze code changes, and store the results in Confluence pages.

Features

  • Fetch merge request details from GitLab
  • Analyze code changes in merge requests
  • Generate detailed reports including:
    • Basic merge request information
    • Code change statistics
    • File type analysis
    • Detailed file changes
  • Store analysis results in Confluence
  • Comprehensive logging for debugging

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 or contact the maintainers.

Project Structure

Copy & paste โ€” that's it
MRConfluenceLinker-mcp-server/
โ”œโ”€โ”€ src/                           # Source code directory
โ”‚   โ””โ”€โ”€ MRConfluenceLinker-mcp-server/  # Main server package
โ”‚       โ”œโ”€โ”€ resources/            # Resource modules
โ”‚       โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚       โ”‚   โ”œโ”€โ”€ client.py        # Client implementation / GitLab PR integration
โ”‚       โ”œโ”€โ”€ server.py            # Main server implementation
โ”‚       โ””โ”€โ”€ mcp_server.log       # Server logs
โ”œโ”€โ”€ __pycache__/                 # Python cache files
โ”œโ”€โ”€ .git/                        # Git repository
โ”œโ”€โ”€ .gitignore                   # Git ignore rules
โ”œโ”€โ”€ CONTRIBUTING.md              # Contributing guidelines
โ”œโ”€โ”€ LICENSE                      # Project license
โ”œโ”€โ”€ README.md                    # Project documentation
โ”œโ”€โ”€ pyproject.toml              # Python project configuration
โ”œโ”€โ”€ requirements.txt            # Project dependencies
โ””โ”€โ”€ uv.lock                     # Dependency lock file

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