Skip to main content
Glama

Jira MCP Server

create_issues_v3_conversion.md4.57 kB
# Convert create_issues to v3 REST API - Implementation Summary ## Overview This document summarizes the conversion of the `create_jira_issues` method from using the legacy Jira Python SDK to the v3 REST API, following the established patterns in the codebase. ## Changes Made ### 1. JiraV3APIClient - New Method **File:** `src/mcp_server_jira/jira_v3_api.py` Added `bulk_create_issues()` method: - Uses POST `/rest/api/3/issue/bulk` endpoint - Supports up to 50 issues per API specification - Takes `issue_updates` array with proper v3 API structure - Returns response with `issues` and `errors` arrays ### 2. JiraServer - Method Conversion **File:** `src/mcp_server_jira/server.py` Converted `create_jira_issues()` method: - Changed from synchronous to `async` method - Uses `self._get_v3_api_client()` instead of legacy client - Maintains existing interface and return format for backward compatibility - Added ADF (Atlassian Document Format) conversion for descriptions ### 3. Server Integration **File:** `src/mcp_server_jira/server.py` (line ~1420) Updated the tool call handler: - Changed from synchronous to `await` call - Updated logging messages to reflect async operation ## Key Technical Features ### ADF Conversion String descriptions are automatically converted to Atlassian Document Format: ```python # Input: "Simple text description" # Output: { "type": "doc", "version": 1, "content": [ { "type": "paragraph", "content": [{"type": "text", "text": "Simple text description"}] } ] } ``` ### Issue Type Conversion Maintains existing case conversion logic: - `"bug"` → `"Bug"` - `"new feature"` → `"New Feature"` - `"STORY"` → `"Story"` - Custom types preserved as-is ### Field Processing Preserves all existing field processing: - Project: `"PROJ"` → `{"key": "PROJ"}` - Labels: `"label"` → `["label"]` - Assignee: `"user"` → `{"name": "user"}` ### Backward Compatibility - Supports both `"issue_type"` and `"issuetype"` fields - Accepts both string and object formats for existing fields - Returns same result format as legacy implementation ## API Format Transformation ### Input Format (unchanged) ```python field_list = [ { "project": "PROJ", "summary": "Test issue", "description": "Simple description", "issue_type": "bug" } ] ``` ### v3 API Format (internal transformation) ```python { "issueUpdates": [ { "fields": { "project": {"key": "PROJ"}, "summary": "Test issue", "description": { "type": "doc", "version": 1, "content": [...] }, "issuetype": {"name": "Bug"} } } ] } ``` ### Output Format (unchanged) ```python [ { "key": "PROJ-1", "id": "10000", "self": "https://...", "success": True } ] ``` ## Error Handling - Maintains existing validation for required fields - Preserves error message format and logging - Handles v3 API errors with backward-compatible result format - Supports partial success scenarios (some issues created, some failed) ## Testing Comprehensive test suite created: 1. **Unit Tests**: `test_bulk_create_issues_v3_api.py` - v3 API client method testing - Validation and error handling 2. **Server Tests**: `test_create_jira_issues_server.py` - Server method integration - Field conversion and ADF formatting 3. **Integration Tests**: `test_create_issues_integration.py` - End-to-end workflow testing - Backward compatibility verification ## Manual Verification All functionality verified through comprehensive manual testing: - ✅ Field validation working correctly - ✅ ADF conversion functioning properly - ✅ Issue type conversion logic correct - ✅ Error handling preserved - ✅ Backward compatibility maintained ## Migration Notes This change is **fully backward compatible**: - Existing code using `create_jira_issues()` will continue to work - Same input format supported - Same output format returned - All existing field processing preserved The only visible change is that the method is now `async` and must be called with `await`. ## Future Maintenance When maintaining this code: 1. Follow the established v3 API patterns from other converted methods 2. Preserve the ADF conversion for description fields 3. Maintain backward compatibility with existing field formats 4. Use the comprehensive test suite to validate changes

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/InfinitIQ-Tech/mcp-jira'

If you have feedback or need assistance with the MCP directory API, please join our Discord server