To overcome the limitations of the gh CLI and build a more scalable and performant foundation for our GitHub integration, this epic outlines the complete migration of our MCP services' data access layer. All remote data-fetching and mutation operations currently using gh subprocess calls will be refactored to use direct calls to the official GitHub GraphQL API.
While the gh CLI provided a rapid path to a working prototype, it lacks support for critical features (e.g., issue relationships) and is less performant for complex queries. A direct GraphQL implementation will give us full, typed access to the GitHub API, improve performance by consolidating queries, and provide a single, robust data layer for all current and future features.
Operations that perform local Git repository manipulations (e.g., gh pr checkout) will be explicitly excluded from this migration and will continue to use the gh CLI.
Key Sub-Tasks
#7591 - Implement GraphQL Client & Auth Service:
- Add a lightweight HTTP client (
node-fetch) to package.json.
- Create a new
GraphqlService to encapsulate all API calls.
- Implement a method within the service to fetch the GitHub auth token from the
gh CLI (gh auth token) and manage the required HTTP headers.
#7592 - Migrate Label & Issue Services to GraphQL:
- Refactor
LabelService.listLabels to use a GraphQL query.
- Refactor
IssueService.addLabels and IssueService.removeLabels to use GraphQL mutations.
#7593 - Migrate PullRequestService to GraphQL:
- Refactor
listPullRequests, createComment, and getConversation to use GraphQL queries and mutations.
- Investigate and refactor
getPullRequestDiff. Note that checkoutPullRequest will remain a gh CLI call.
#7594 - Migrate SyncService to GraphQL:
- Rewrite
#pullFromGitHub to use a single, comprehensive GraphQL query that fetches issues, comments, and their relationships (parent, children, etc.).
- Rewrite
#pushToGitHub to use a GraphQL mutation for updating issues.
- Rewrite
#fetchAndCacheReleases to use a GraphQL query.
#7595 - Finalize Migration & Cleanup:
- Remove the generic
#ghCommand helper method from SyncService.
- Review all services to ensure no unnecessary
gh calls remain.
- Update all relevant JSDoc comments and documentation to reflect the new GraphQL data access patterns.
To overcome the limitations of the
ghCLI and build a more scalable and performant foundation for our GitHub integration, this epic outlines the complete migration of our MCP services' data access layer. All remote data-fetching and mutation operations currently usingghsubprocess calls will be refactored to use direct calls to the official GitHub GraphQL API.While the
ghCLI provided a rapid path to a working prototype, it lacks support for critical features (e.g., issue relationships) and is less performant for complex queries. A direct GraphQL implementation will give us full, typed access to the GitHub API, improve performance by consolidating queries, and provide a single, robust data layer for all current and future features.Operations that perform local Git repository manipulations (e.g.,
gh pr checkout) will be explicitly excluded from this migration and will continue to use theghCLI.Key Sub-Tasks
#7591 - Implement GraphQL Client & Auth Service:
node-fetch) topackage.json.GraphqlServiceto encapsulate all API calls.ghCLI (gh auth token) and manage the required HTTP headers.#7592 - Migrate Label & Issue Services to GraphQL:
LabelService.listLabelsto use a GraphQL query.IssueService.addLabelsandIssueService.removeLabelsto use GraphQL mutations.#7593 - Migrate PullRequestService to GraphQL:
listPullRequests,createComment, andgetConversationto use GraphQL queries and mutations.getPullRequestDiff. Note thatcheckoutPullRequestwill remain aghCLI call.#7594 - Migrate SyncService to GraphQL:
#pullFromGitHubto use a single, comprehensive GraphQL query that fetches issues, comments, and their relationships (parent, children, etc.).#pushToGitHubto use a GraphQL mutation for updating issues.#fetchAndCacheReleasesto use a GraphQL query.#7595 - Finalize Migration & Cleanup:
#ghCommandhelper method fromSyncService.ghcalls remain.