|
| 1 | +# Jira Development Information Integration |
| 2 | + |
| 3 | +This feature adds support for retrieving development information (pull requests, branches, commits, builds) linked to Jira issues through integrations like Bitbucket for Jira, GitHub for Jira, or GitLab for Jira. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +### New MCP Tool |
| 8 | +- `get_development_information` - Retrieves all linked development data for a Jira issue |
| 9 | + |
| 10 | +### Data Retrieved |
| 11 | +- **Pull Requests**: Title, status, author, source/destination branches, URLs |
| 12 | +- **Branches**: Name, repository, last commit, URLs |
| 13 | +- **Commits**: ID, message, author, timestamp, files changed |
| 14 | +- **Builds**: Name, status, duration, URLs |
| 15 | +- **Repositories**: Name, URL, description |
| 16 | + |
| 17 | +## Implementation Details |
| 18 | + |
| 19 | +### Files Added |
| 20 | +1. `src/mcp_atlassian/jira/development.py` - Core development information retrieval logic |
| 21 | +2. `src/mcp_atlassian/models/jira/development.py` - Data models for development information |
| 22 | +3. `test_dev_info.py` - Test script to verify functionality |
| 23 | + |
| 24 | +### Files Modified |
| 25 | +1. `src/mcp_atlassian/jira/client.py` - Added DevelopmentMixin to JiraClient |
| 26 | +2. `src/mcp_atlassian/servers/jira.py` - Added MCP tool endpoint |
| 27 | +3. `src/mcp_atlassian/models/__init__.py` - Exported development models |
| 28 | + |
| 29 | +## API Endpoints Used |
| 30 | + |
| 31 | +### Server/Data Center |
| 32 | +- `/rest/dev-status/latest/issue/detail` - Legacy endpoint for development status |
| 33 | + |
| 34 | +### Cloud |
| 35 | +- `/rest/api/3/issue/{issueIdOrKey}/development` - Cloud API endpoint |
| 36 | +- Falls back to legacy endpoint if needed |
| 37 | + |
| 38 | +## Usage |
| 39 | + |
| 40 | +### Via MCP Tool in Claude |
| 41 | +```python |
| 42 | +# Get all development information |
| 43 | +await get_development_information( |
| 44 | + issue_key="PROJ-123" |
| 45 | +) |
| 46 | + |
| 47 | +# Filter by application type |
| 48 | +await get_development_information( |
| 49 | + issue_key="PROJ-123", |
| 50 | + application_type="bitbucket" # or "github", "gitlab", "stash" |
| 51 | +) |
| 52 | +``` |
| 53 | + |
| 54 | +### Direct Python Usage |
| 55 | +```python |
| 56 | +from mcp_atlassian.jira.client import JiraClient |
| 57 | +from mcp_atlassian.jira.config import JiraConfig |
| 58 | + |
| 59 | +# Initialize client |
| 60 | +config = JiraConfig.from_env() |
| 61 | +client = JiraClient(config) |
| 62 | + |
| 63 | +# Get development information |
| 64 | +dev_info = client.get_development_information("PROJ-123") |
| 65 | + |
| 66 | +# Access specific data |
| 67 | +print(f"Open PRs: {len(dev_info.open_pull_requests)}") |
| 68 | +print(f"Total commits: {dev_info.total_commits}") |
| 69 | +print(f"Summary: {dev_info.summary}") |
| 70 | + |
| 71 | +# Get just pull requests |
| 72 | +prs = client.get_linked_pull_requests("PROJ-123") |
| 73 | +``` |
| 74 | + |
| 75 | +## Testing |
| 76 | + |
| 77 | +Test the feature using the provided script: |
| 78 | + |
| 79 | +```bash |
| 80 | +# Test with a specific issue |
| 81 | +python test_dev_info.py PROJ-123 |
| 82 | +``` |
| 83 | + |
| 84 | +This will: |
| 85 | +1. Fetch development information for the issue |
| 86 | +2. Display a summary in the console |
| 87 | +3. Export full details to a JSON file |
| 88 | + |
| 89 | +## Data Models |
| 90 | + |
| 91 | +### DevelopmentInformation |
| 92 | +Main container with: |
| 93 | +- `pull_requests`: List of PullRequest objects |
| 94 | +- `branches`: List of Branch objects |
| 95 | +- `commits`: List of Commit objects |
| 96 | +- `builds`: List of Build objects |
| 97 | +- `repositories`: List of Repository objects |
| 98 | +- `has_development_info`: Boolean indicator |
| 99 | +- `summary`: Text summary of all development data |
| 100 | + |
| 101 | +### PullRequest |
| 102 | +- `id`, `title`, `url` |
| 103 | +- `status` (OPEN, MERGED, DECLINED) |
| 104 | +- `author`, `source_branch`, `destination_branch` |
| 105 | +- `last_update`, `commentCount` |
| 106 | +- Helper properties: `is_open`, `is_merged` |
| 107 | + |
| 108 | +### Branch |
| 109 | +- `id`, `name`, `url` |
| 110 | +- `last_commit`, `repository` |
| 111 | +- Helper properties: `is_feature_branch`, `is_bugfix_branch` |
| 112 | + |
| 113 | +### Commit |
| 114 | +- `id`, `message`, `url` |
| 115 | +- `author`, `author_timestamp` |
| 116 | +- `files_changed`, `lines_added`, `lines_removed` |
| 117 | +- Helper properties: `short_id`, `first_line_message` |
| 118 | + |
| 119 | +### Build |
| 120 | +- `id`, `name`, `url` |
| 121 | +- `status` (SUCCESS, FAILED, IN_PROGRESS) |
| 122 | +- `started_time`, `finished_time`, `duration_seconds` |
| 123 | +- Helper properties: `is_successful`, `is_failed` |
| 124 | + |
| 125 | +## Error Handling |
| 126 | + |
| 127 | +The implementation handles: |
| 128 | +- Missing development panel/plugin |
| 129 | +- Permission issues accessing development data |
| 130 | +- Different response formats between Cloud and Server/DC |
| 131 | +- Empty or malformed responses |
| 132 | + |
| 133 | +If development information cannot be retrieved, an empty DevelopmentInformation object is returned with error details. |
| 134 | + |
| 135 | +## Compatibility |
| 136 | + |
| 137 | +- ✅ Jira Server/Data Center (with Bitbucket Server integration) |
| 138 | +- ✅ Jira Cloud (with Bitbucket Cloud, GitHub, GitLab integrations) |
| 139 | +- ✅ Handles both PAT and Basic authentication |
| 140 | +- ✅ Works with the authentication fix for Server/DC Bearer tokens |
| 141 | + |
| 142 | +## Limitations |
| 143 | + |
| 144 | +1. Requires the appropriate integration plugin installed in Jira |
| 145 | +2. User must have permission to view development information |
| 146 | +3. Some fields may not be available depending on the integration type |
| 147 | +4. Build information requires additional CI/CD integration |
| 148 | + |
| 149 | +## Contributing |
| 150 | + |
| 151 | +When adding support for new development tool integrations: |
| 152 | +1. Add parsing logic in `_parse_<provider>_instance()` method |
| 153 | +2. Update the `application_type` parameter documentation |
| 154 | +3. Add test cases for the new provider format |
0 commit comments