Enables creation and management of branches, committing AI-generated fixes, creating merge requests, and handling repository operations in GitLab projects.
Provides tools for fetching issues using JQL queries, adding comments, managing project data, analyzing issues with AI, and updating issue status in Jira projects.
Integrates OpenAI models for intelligent issue analysis and automated code generation to fix bugs and technical issues.
Jira-GitLab MCP Server
A Python-based Model Context Protocol (MCP) server that integrates Jira and GitLab, enabling AI agents to seamlessly manage issues and branches across both platforms.
Features
Jira Integration: Fetch issues, add comments, and manage project data
GitLab Integration: Create branches, manage projects, and handle repository operations
AI-Powered Analysis: Real OpenAI integration for intelligent issue analysis and code generation
Automated Workflow: Complete SRE workflow from issue detection to fix deployment
Code Validation: AST-based validation with security pattern detection
Secure Configuration: Support for environment variables and encrypted credentials
Robust Error Handling: Comprehensive error management with retry mechanisms
Async Support: Full asynchronous operation for better performance
MCP Compliance: Fully compatible with the Model Context Protocol specification
Quick Start
Prerequisites
Python 3.8+
Jira account with API access
GitLab account with Personal Access Token
Installation
Clone the repository:
Install dependencies:
Configure credentials (choose one method):
Option A: Environment Variables (Recommended)
Option B: Configuration File
Run the MCP server:
Configuration
Environment Variables
Variable | Description | Required |
| Your Jira instance URL | Yes |
| Your Jira account email | Yes |
| Jira API token | Yes |
| GitLab instance URL | No (defaults to gitlab.com) |
| GitLab Personal Access Token | Yes |
Generating API Tokens
Jira API Token:
Click "Create API token"
Copy the generated token
GitLab Personal Access Token:
Go to GitLab → Settings → Access Tokens
Create token with
api
,read_repository
, andwrite_repository
scopesCopy the generated token
MCP Tools
create_branch_for_issue
Creates a GitLab branch for a Jira issue and links them.
Parameters:
issue_key
(string): Jira issue key (e.g., "PROJ-123")project_id
(integer): GitLab project IDbase_branch
(string, optional): Base branch (default: "main")
Branch Naming Convention: feature/{issue_key}-fix
Example:
get_jira_issues
Fetch Jira issues using JQL query.
Parameters:
jql
(string, optional): JQL query stringmax_results
(integer, optional): Maximum results (default: 50)
Example:
comment_on_issue
Add a comment to a Jira issue.
Parameters:
issue_key
(string): Jira issue keycomment
(string): Comment text
Example:
get_issues_by_tags
Fetch Jira issues by project and tags (labels).
Parameters:
project_key
(string): Jira project key (e.g., "PROJ", "DEMO")tags
(array): List of tags/labels to filter by (1-10 tags)max_results
(integer, optional): Maximum results (default: 50, max: 100)
Example:
Use Cases:
Find bugs tagged for AI-assisted fixing:
["AI-Fix", "AutoFix"]
Locate security issues:
["security", "vulnerability"]
Filter performance problems:
["performance", "optimization"]
Identify technical debt:
["tech-debt", "refactor"]
analyze_and_fix_issue
Use AI to analyze a Jira issue and generate code fixes.
Parameters:
issue_key
(string): Jira issue key to analyzemodel
(string, optional): AI model to use (default: "gpt-4-turbo")validation_level
(string, optional): Code validation strictness ("basic" or "strict")include_context
(boolean, optional): Include repository context (default: true)
Example:
commit_ai_fix
Commit AI-generated fixes to GitLab branch with validation.
Parameters:
project_id
(integer): GitLab project IDbranch_name
(string): Branch name to commit tofiles
(array): Files to commit with content and actionscommit_message
(string): Commit message
Example:
create_merge_request
Create a GitLab merge request.
Parameters:
project_id
(integer): GitLab project IDsource_branch
(string): Source branch nametarget_branch
(string, optional): Target branch (default: "main")title
(string, optional): MR titledescription
(string, optional): MR descriptiondraft
(boolean, optional): Create as draft (default: true)
Example:
update_issue_status
Update Jira issue status and add comments.
Parameters:
issue_key
(string): Jira issue keystatus
(string): New status (e.g., "In Review", "Done")comment
(string, optional): Comment to add with status change
Example:
sre_ai_workflow
Complete SRE AI workflow: fetch tagged issues, create fixes, and update status.
Parameters:
project_key
(string): Jira project keygitlab_project_id
(integer): GitLab project IDtags
(array, optional): Tags to filter by (default: ["AI-Fix", "AutoFix"])max_issues
(integer, optional): Maximum issues to process (default: 5)auto_merge
(boolean, optional): Auto-merge approved fixes (default: false)
Example:
Workflow Steps:
Fetch issues with specified tags
Analyze each issue with AI
Generate and validate code fixes
Create branches and commit changes
Create draft merge requests
Update Jira issue status to "In Review"
MCP Resources
jira://issues
Access to Jira issues in the configured project.
gitlab://projects
Access to GitLab projects and branches.
Development
Running Tests
Project Structure
Error Handling
The server implements comprehensive error handling:
Retry Mechanisms: Automatic retry with exponential backoff
Authentication Errors: Clear messages for credential issues
API Rate Limiting: Handles rate limits gracefully
Network Issues: Robust handling of connection problems
Validation: Input validation with helpful error messages
Logging
The server uses Python's logging module with configurable levels:
Usage Examples
Basic Workflow
Fetch Jira Issues:
Create Branch for Issue:
Add Progress Comment:
Integration with AI Agents
This MCP server is designed to work with AI agents and LLMs. Example integration:
Security Considerations
Environment Variables: Use environment variables for production
Token Rotation: Regularly rotate API tokens
Network Security: Use HTTPS for all API communications
Access Control: Limit token permissions to minimum required
Logging: Avoid logging sensitive information
Troubleshooting
Common Issues
Authentication Errors:
Verify API tokens are correct and not expired
Check that email matches Jira account
Ensure GitLab token has required permissions
Connection Issues:
Verify base URLs are correct
Check network connectivity
Confirm firewall settings allow HTTPS traffic
Permission Errors:
Ensure Jira user has project access
Verify GitLab token has repository permissions
Check project visibility settings
Debug Mode
Enable debug logging:
Contributing
Fork the repository
Create a feature branch
Make your changes
Add tests for new functionality
Run the test suite
Submit a pull request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
For issues and questions:
Check the troubleshooting section
Review existing GitHub issues
Create a new issue with detailed information
Changelog
v1.0.0
Initial MCP server implementation
Jira and GitLab integration
Comprehensive error handling
Full test coverage
Documentation and examples
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Integrates Jira and GitLab to enable AI agents to seamlessly manage issues, create branches, and automate SRE workflows from issue detection to fix deployment. Features AI-powered analysis for intelligent code generation and comprehensive automation across both platforms.