GitHub CLI Setup for Cursor AI Agents

Version: 1.0
Date: January 30, 2026
Owner: AI Team


1. Purpose

This guide enables Cursor AI agents to interact with GitHub for repository management, pull requests, and code operations.


2. Cursor MCP Integration (Preferred)

Cursor has a built-in GitHub MCP integration that provides comprehensive GitHub access.

Available MCP Tools

Repository Operations:

ToolDescription
user-github-get_file_contentsRead files from repo
user-github-create_or_update_fileCreate/update files
user-github-delete_fileDelete file
user-github-push_filesPush multiple files
user-github-list_branchesList branches
user-github-create_branchCreate new branch
user-github-list_commitsList commits
user-github-get_commitGet commit details

Pull Requests:

ToolDescription
user-github-create_pull_requestCreate PR
user-github-update_pull_requestUpdate PR
user-github-list_pull_requestsList PRs
user-github-pull_request_readGet PR details/diff/files
user-github-merge_pull_requestMerge PR

Issues:

ToolDescription
user-github-list_issuesList issues
user-github-issue_readGet issue details
user-github-issue_writeCreate/update issue
user-github-add_issue_commentAdd comment

Search:

ToolDescription
user-github-search_codeSearch code
user-github-search_repositoriesFind repos
user-github-search_issuesSearch issues
user-github-search_pull_requestsSearch PRs

3. CLI Installation

# Install via Homebrew
brew install gh
 
# Verify installation
gh --version

4. Authentication

# Login (interactive)
gh auth login
 
# Check auth status
gh auth status
 
# Login with token
gh auth login --with-token < token.txt

5. Common Operations

5.1 Create Pull Request

When the PR relates to a Linear issue, include the issue ID in the title (e.g. AMB-19: feat: My feature) so the Linear–GitHub integration can link them.

Via MCP:

user-github-create_pull_request
  owner: "brainforge-ai"
  repo: "brainforge-platform"
  title: "AMB-19: feat: My feature"
  head: "feature-branch"
  base: "main"
  body: "## Summary\n..."

Via CLI:

gh pr create --title "AMB-19: feat: My feature" --body "Description"

5.2 List Pull Requests

gh pr list
gh pr list --state open
gh pr list --author "@me"

5.3 View PR Details

gh pr view 123
gh pr view 123 --comments
gh pr diff 123

5.4 Create Issues

gh issue create --title "Bug: Something broken" --body "Description"
gh issue create --label bug --assignee @me

6. Cursor Agent Workflows

Create PR from Current Work

When the PR relates to a Linear issue, include the issue ID in the title (e.g. AMB-19: feat: My feature) so the Linear–GitHub integration can link them.

1. git add . && git commit -m "..."
2. git push -u origin HEAD
3. user-github-create_pull_request
   - owner: "brainforge-ai"
   - repo: "repo-name"
   - title: "AMB-19: PR title"
   - head: "branch-name"
   - base: "main"
   - body: "PR description..."

Get PR Review Comments

user-github-pull_request_read
  method: "get_review_comments"
  owner: "brainforge-ai"
  repo: "repo-name"
  pullNumber: 47

7. Our Repositories

RepositoryPurpose
brainforge-platformPlatform code, standards/ (standards and docs), and knowledge/ (internal knowledge) — all in one repo

8. API Reference


9. Version History

  • v1.0 (January 30, 2026) — Initial documentation