forked from cardosofelipe/fast-next-template
feat(mcp): Implement Issues MCP Server #59
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Overview
Implement an MCP server that provides unified issue tracking operations across multiple providers (Gitea, GitHub, GitLab). This server enables agents to create, update, query, and manage issues with bi-directional sync capabilities.
Parent Epic
Dependencies
Implementation Sub-Tasks
1. Project Setup & Structure
backend/src/mcp_servers/issues/directory__init__.pywith public exportsserver.pywith FastMCP initializationpyproject.tomlfor standalone installationDockerfilefor containerized deployment.env.examplewith all configuration optionsdocker-compose.mcp.ymlservice definition2. Configuration & Settings
config.pywith Pydantic settings class3. Provider Abstraction Layer
providers/base.pywith abstractIssueProviderclasslist_issues(),get_issue(),create_issue(),update_issue(),delete_issue()list_comments(),add_comment(),update_comment(),delete_comment()list_labels(),add_label(),remove_label()assign_user(),unassign_user()get_milestones(),set_milestone()search_issues()with query builderget_issue_history(),get_issue_timeline()4. Gitea Provider Implementation
providers/gitea.pyimplementingIssueProviderlist_issues()with pagination supportget_issue()with full detail retrievalcreate_issue()with all fieldsupdate_issue()with partial updatesdelete_issue()(archive behavior)list_comments()with paginationadd_comment()with markdown supportupdate_comment()anddelete_comment()list_labels()with color parsingadd_label()andremove_label()assign_user()andunassign_user()get_milestones()andset_milestone()search_issues()using Gitea's query syntax5. GitHub Provider Implementation
providers/github.pyimplementingIssueProviderlist_issues()with GitHub pagination (Link headers)get_issue()with timeline datacreate_issue()with templates supportupdate_issue()with partial updatesdelete_issue()(close behavior - GitHub doesn't delete)list_comments()with reactionsadd_comment()with GitHub-flavored markdownupdate_comment()anddelete_comment()search_issues()using GitHub's search syntax6. GitLab Provider Implementation
providers/gitlab.pyimplementingIssueProviderlist_issues()with GitLab paginationget_issue()with related merge requestscreate_issue()with confidential issues supportupdate_issue()with weight/time trackingdelete_issue()(close behavior)list_comments()(notes in GitLab)add_comment()and note operationsupdate_comment()anddelete_comment()search_issues()using GitLab's search API7. Unified Issue Model
models/issue.pywith Pydantic modelsUnifiedIssuemodel with common fieldsUnifiedCommentmodelUnifiedLabelmodel with color normalizationUnifiedMilestonemodelUnifiedUsermodel for assignees/authorsIssueStateenum (open, closed, merged for MRs)IssuePriorityenum with provider mappingIssueTypeenum (issue, bug, feature, task)IssueSearchQuerymodel with filter options8. Sync Service Implementation
sync/service.pywithIssueSyncServiceclass9. Conflict Resolution
sync/conflicts.pywith conflict handling10. Database Schema & Repository
issues_sync_statetable for sync trackingissue_mappingstable (local_id ↔ provider_id mapping)sync_conflictstable for unresolved conflictssync_audit_logtable for debuggingwebhook_eventstable for event deduplicationIssueMappingRepositorywith CRUD operationsSyncStateRepositoryfor trackingConflictRepositoryfor conflict management11. MCP Tools Definition
list_issuestool with filtering parametersget_issuetool with full detailscreate_issuetoolupdate_issuetooladd_commenttoolsearch_issuestool with advanced querybulk_update_issuestool for batch operationsget_issue_statstool for analyticslink_issuestool for issue relationships12. Caching Layer
cache/issue_cache.pywith Redis integration13. Webhook Handler
webhooks/handler.pyfor incoming webhooks14. Error Handling & Resilience
exceptions.pyProviderConnectionErrorfor network issuesRateLimitExceededErrorwith retry-afterAuthenticationErrorfor auth failuresIssueNotFoundErrorfor 404 responsesConflictErrorfor sync conflicts15. Metrics & Observability
issues_synced_totalcountersync_latency_secondshistogramprovider_errors_totalby provider and typecache_hit_ratiogaugeactive_sync_jobsgauge16. Testing
17. Docker & Deployment
18. Documentation
Technical Specifications
Provider API References
Sync Strategy
Conflict Resolution Priority
Acceptance Criteria
Labels
phase-2,mcp,backend,issues,syncMilestone
Phase 2: MCP Integration