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:
| Tool | Description |
|---|---|
user-github-get_file_contents | Read files from repo |
user-github-create_or_update_file | Create/update files |
user-github-delete_file | Delete file |
user-github-push_files | Push multiple files |
user-github-list_branches | List branches |
user-github-create_branch | Create new branch |
user-github-list_commits | List commits |
user-github-get_commit | Get commit details |
Pull Requests:
| Tool | Description |
|---|---|
user-github-create_pull_request | Create PR |
user-github-update_pull_request | Update PR |
user-github-list_pull_requests | List PRs |
user-github-pull_request_read | Get PR details/diff/files |
user-github-merge_pull_request | Merge PR |
Issues:
| Tool | Description |
|---|---|
user-github-list_issues | List issues |
user-github-issue_read | Get issue details |
user-github-issue_write | Create/update issue |
user-github-add_issue_comment | Add comment |
Search:
| Tool | Description |
|---|---|
user-github-search_code | Search code |
user-github-search_repositories | Find repos |
user-github-search_issues | Search issues |
user-github-search_pull_requests | Search PRs |
3. CLI Installation
# Install via Homebrew
brew install gh
# Verify installation
gh --version4. Authentication
# Login (interactive)
gh auth login
# Check auth status
gh auth status
# Login with token
gh auth login --with-token < token.txt5. 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 1235.4 Create Issues
gh issue create --title "Bug: Something broken" --body "Description"
gh issue create --label bug --assignee @me6. 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
| Repository | Purpose |
|---|---|
brainforge-platform | Platform code, standards/ (standards and docs), and knowledge/ (internal knowledge) — all in one repo |
8. API Reference
- CLI Docs: https://cli.github.com/manual/
- API Docs: https://docs.github.com/en/rest
- MCP Integration: Built into Cursor
9. Version History
- v1.0 (January 30, 2026) — Initial documentation