An intelligent MCP (Model Context Protocol) server that provides automated PR review capabilities using AutoGen multi-agent teams. The system integrates GitLab, Jira, and Outline to perform comprehensive code reviews with context-aware analysis.
This project implements a multi-agent system for automated GitLab merge request reviews. It uses:
- MCP Server: Exposes tools for GitLab, Jira, and Outline integration
- AutoGen Agents: Specialized agents for different review aspects
- Multi-Team Orchestration: Supports RoundRobin, Selector, MagenticOne, and Swarm patterns
- GitLab Tools: PR details, file reading, git blame, commit details, PR review posting
- Jira Tools: Board listing, epic retrieval, task details
- Outline Tools: Document collections, tree navigation, content retrieval
- context_analyzer_agent: Analyzes PR metadata, commits, and categorizes changes
- code_quality_agent: Performs deep code analysis and identifies technical debt
- impact_analyzer_agent: Identifies cross-file impacts and breaking changes
- jira_explorer_agent: Extracts Jira ticket context and epic relationships
- outline_exp_agent: Retrieves PR templates and documentation
- publisher_agent: Formats and posts review to GitLab
- queen_agent (Swarm only): Orchestrator for Swarm-based workflow
- main.py: RoundRobin, Selector, and MagenticOne teams
- swarm_host.py: Swarm-based team with handoff capabilities
- tool_pointer.py: MCP client wrappers for tool invocation
- model_clients.py: LLM client configurations (GPT-4, Claude)
Follow the official installation instructions at: https://docs.astral.sh/uv/getting-started/installation/
# Install all dependencies
uv sync
# Or install with dev dependencies for testing
uv sync --all-extrasCreate a .env file in the project root:
# GitLab Configuration
GITLAB_API_BASE_URL=https://your-gitlab-instance.com/api/v4
GITLAB_PERSONAL_ACCESS_TOKEN=your_gitlab_token
# Jira Configuration
JIRA_BASE_URL=https://your-jira-instance.atlassian.net
JIRA_EMAIL=your-email@example.com
JIRA_API_TOKEN=your_jira_token
# Outline Configuration
OUTLINE_BASE_URL=https://your-outline-instance.com/api
OUTLINE_API_TOKEN=your_outline_token
# OpenAI Configuration
OPENAI_API_KEY=your_openai_api_key
# Anthropic Configuration
ANTHROPIC_API_KEY=your_anthropic_api_key# Start the MCP server on localhost:8000
python -m src.serverThe server exposes MCP tools at http://localhost:8000/mcp
# Run the Selector team (recommended)
python -m src.host.main
# Run the Swarm team
python -m src.host.swarm_hostAgents execute in fixed sequential order:
- context_analyzer → 2. code_quality → 3. impact_analyzer → 4. jira_agent → 5. outline_agent → 6. publisher_agent
LLM-driven agent selection with termination on "published" keyword
- Termination: Stops when any agent mentions "published"
- Best for: Dynamic workflows where agent order may vary
Built-in orchestrator with intelligent agent coordination
Handoff-based pattern with queen_agent orchestrator
- queen_agent delegates tasks to specialized agents
- Agents can hand off to each other based on workflow needs
get_gitlab_pr_detail(pr_url)- Get PR metadata, commits, changesread_gitlab_repository_file(repo_url, file_path, ref)- Read file contentget_gitlab_git_blame(repo_url, file_path, line_number, ref)- Get blame infoget_gitlab_commit_detail(repo_url, commit_hash)- Get commit detailsget_gitlab_repository_tree(repo_url, parent_folder, ref)- Get folder treecreate_gitlab_pr_review(pr_url, markdown_content)- Post review comment
get_jira_boards()- List all boardsget_jira_epics(board_id)- Get epics from boardget_jira_task_detail(task_key)- Get task detailsget_jira_epic_tasks(board_id, epic_id)- Get tasks in epic
get_collection()- Get document collectionsget_outline_tree(document_id)- Get document outline treeget_outline_document_content(document_id)- Get document content
-
User Request: "Review PR https://gitlab.com/project/-/merge_requests/123 on feature-branch"
-
context_analyzer_agent:
- Fetches PR details (title, description, commits, changed files)
- Categorizes PR (Bug Fix / Feature / Refactor)
- Outputs structured summary
-
code_quality_agent:
- Reads changed files
- Performs git blame analysis
- Identifies code smells, security issues, technical debt
- Outputs findings with file paths and line numbers
-
impact_analyzer_agent:
- Analyzes cross-file dependencies
- Identifies breaking changes
- Checks architectural violations
-
jira_explorer_agent:
- Extracts Jira ticket key from PR
- Fetches ticket details and epic context
-
outline_exp_agent:
- Retrieves appropriate PR template (bug/feature)
- Fetches relevant documentation
-
publisher_agent:
- Aggregates all findings
- Formats review in markdown
- Posts to GitLab PR
# Run unit tests
uv run pytest tests/ -v
# Run specific test file
uv run pytest tests/test_server.py -vMCP-burak/
├── src/
│ ├── server.py # MCP server entry point
│ ├── config.py # Environment configuration
│ ├── agents/ # Agent implementations
│ │ ├── gitlab/ # GitLab-specific agents
│ │ │ ├── context_analyzer.py
│ │ │ ├── code_quality.py
│ │ │ ├── impact_analyzer.py
│ │ │ └── publisher.py
│ │ ├── jira/ # Jira agent
│ │ │ └── jira_explorer.py
│ │ ├── outline/ # Outline agent
│ │ │ └── outline_explorer.py
│ │ └── queen.py # Swarm orchestrator
│ ├── host/ # Team orchestration
│ │ ├── main.py # RoundRobin/Selector/MagenticOne
│ │ ├── swarm_host.py # Swarm team
│ │ ├── tool_pointer.py # MCP client wrappers
│ │ └── model_clients.py # LLM configurations
│ └── tools/ # MCP tool implementations
│ ├── Gitlab/
│ │ ├── gitlab_service.py
│ │ └── gitlab_model.py
│ ├── Jira/
│ │ ├── jira_service.py
│ │ └── jira_model.py
│ └── Outline/
│ ├── outline_service.py
│ ├── outline_model.py
│ └── outline_document_traverser.py
├── tests/ # Unit tests
├── pyproject.toml # Project dependencies
├── .env # Environment variables
└── README.md
Edit src/host/model_clients.py to configure LLM models:
- GPT-4 for code analysis agents (fast, cost-effective)
- Claude Sonnet for orchestration and complex reasoning
max_turns: Maximum conversation rounds (default: 13)termination_condition: Custom termination logicallow_repeated_speaker: Allow same agent multiple times
Configure MCP client timeout in src/host/tool_pointer.py:
MCP_SERVER_TIMEOUT = 30.0 # secondsThis JSON parsing error occurs when MCP tools return empty/malformed responses. Check:
- MCP server is running (
python -m src.server) - Environment variables are correctly set
- API tokens have proper permissions
Ensure termination condition is set:
termination_condition=TextMentionTermination("published")Verify MCP client connection in tool_pointer.py and check server logs.
- Create agent file in
src/agents/ - Define system prompt and tools
- Add to team configuration in
src/host/main.pyorswarm_host.py
- Implement tool in
src/tools/<category>/ - Register tool in
src/server.py - Create wrapper in
src/host/tool_pointer.py - Add to agent's tools list
[Add your license here]
[Add contributing guidelines here]