Back to .md Directory

šŸ¤– MCP GitHub CLI Commands Guide

- [Introduction](#introduction)

May 2, 2026
0 downloads
0 views
ai prompt mcp cursor copilot workflow automation
View source

šŸ¤– MCP GitHub CLI Commands Guide

šŸ“‹ Table of Contents

šŸ” Introduction

This comprehensive guide provides detailed instructions for using GitHub MCP (Model Context Protocol) commands and CLI operations for repository management, issue tracking, and project automation. The guide integrates with the PowerBridge GitHub Toolkit and Cursor AI to create a seamless development workflow.

šŸ› ļø Setup and Configuration

GitHub MCP Server Setup

Remote Server Configuration (VS Code 1.101+)

{
  "servers": {
    "github": {
      "type": "http",
      "url": "https://api.githubcopilot.com/mcp/"
    }
  }
}

Local Server Configuration with Docker

{
  "inputs": [
    {
      "type": "promptString",
      "id": "github_token",
      "description": "GitHub Personal Access Token",
      "password": true
    }
  ],
  "servers": {
    "github": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "GITHUB_PERSONAL_ACCESS_TOKEN",
        "ghcr.io/github/github-mcp-server"
      ],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github_token}"
      }
    }
  }
}

WSL Configuration (Windows)

{
  "inputs": [
    {
      "type": "promptString",
      "id": "github_token",
      "description": "GitHub Personal Access Token",
      "password": true
    }
  ],
  "mcpServers": {
    "github": {
      "command": "wsl",
      "args": [
        "-d",
        "Ubuntu",
        "--",
        "/home/user/run-github-mcp.sh"
      ]
    }
  }
}

Required Permissions

Create a GitHub Personal Access Token with these permissions:

  • repo - Full control of repositories
  • workflow - Update GitHub Action workflows
  • read:org - Read organization data
  • user - Update user data
  • project - Full control of projects

šŸ“ MCP GitHub Commands Reference

Repository Management

CommandParametersDescriptionExample
mcp_github_create_repositoryname, description, private, autoInitCreate a new repositorymcp_github_create_repository({ "name": "new-project", "description": "My new project", "private": true, "autoInit": true })
mcp_github_fork_repositoryowner, repo, organizationFork a repositorymcp_github_fork_repository({ "owner": "github", "repo": "github-mcp-server" })
mcp_github_create_branchowner, repo, branch, from_branchCreate a new branchmcp_github_create_branch({ "owner": "user", "repo": "project", "branch": "feature/auth", "from_branch": "main" })
mcp_github_list_branchesowner, repo, page, perPageList repository branchesmcp_github_list_branches({ "owner": "user", "repo": "project" })
mcp_github_get_commitowner, repo, shaGet commit detailsmcp_github_get_commit({ "owner": "user", "repo": "project", "sha": "main" })
mcp_github_list_commitsowner, repo, sha, page, perPageList commitsmcp_github_list_commits({ "owner": "user", "repo": "project", "sha": "main" })

File Operations

CommandParametersDescriptionExample
mcp_github_get_file_contentsowner, repo, path, branchGet file contentsmcp_github_get_file_contents({ "owner": "user", "repo": "project", "path": "README.md" })
mcp_github_create_or_update_fileowner, repo, path, content, message, branch, shaCreate or update filemcp_github_create_or_update_file({ "owner": "user", "repo": "project", "path": "README.md", "content": "# Project", "message": "Update README", "branch": "main" })
mcp_github_delete_fileowner, repo, path, message, branchDelete a filemcp_github_delete_file({ "owner": "user", "repo": "project", "path": "old-file.md", "message": "Remove old file", "branch": "main" })
mcp_github_push_filesowner, repo, branch, files, messagePush multiple filesmcp_github_push_files({ "owner": "user", "repo": "project", "branch": "main", "files": [{"path": "file1.md", "content": "content"}], "message": "Add files" })

Issue Management

CommandParametersDescriptionExample
mcp_github_create_issueowner, repo, title, body, labels, assignees, milestoneCreate an issuemcp_github_create_issue({ "owner": "user", "repo": "project", "title": "[BAD-001] Implement Auth", "body": "Details...", "labels": ["enhancement"] })
mcp_github_get_issueowner, repo, issue_numberGet issue detailsmcp_github_get_issue({ "owner": "user", "repo": "project", "issue_number": 1 })
mcp_github_update_issueowner, repo, issue_number, title, body, state, labels, assignees, milestoneUpdate an issuemcp_github_update_issue({ "owner": "user", "repo": "project", "issue_number": 1, "state": "closed" })
mcp_github_add_issue_commentowner, repo, issue_number, bodyComment on issuemcp_github_add_issue_comment({ "owner": "user", "repo": "project", "issue_number": 1, "body": "Comment text" })
mcp_github_get_issue_commentsowner, repo, issue_number, page, per_pageGet issue commentsmcp_github_get_issue_comments({ "owner": "user", "repo": "project", "issue_number": 1 })
mcp_github_list_issuesowner, repo, state, labels, sort, direction, since, page, perPageList issuesmcp_github_list_issues({ "owner": "user", "repo": "project", "state": "open" })

Pull Request Management

CommandParametersDescriptionExample
mcp_github_create_pull_requestowner, repo, title, body, head, base, draft, maintainer_can_modifyCreate a PRmcp_github_create_pull_request({ "owner": "user", "repo": "project", "title": "Feature: Auth", "body": "Implements...", "head": "feature/auth", "base": "main" })
mcp_github_get_pull_requestowner, repo, pullNumberGet PR detailsmcp_github_get_pull_request({ "owner": "user", "repo": "project", "pullNumber": 1 })
mcp_github_get_pull_request_filesowner, repo, pullNumberGet PR filesmcp_github_get_pull_request_files({ "owner": "user", "repo": "project", "pullNumber": 1 })
mcp_github_get_pull_request_diffowner, repo, pullNumberGet PR diffmcp_github_get_pull_request_diff({ "owner": "user", "repo": "project", "pullNumber": 1 })
mcp_github_get_pull_request_statusowner, repo, pullNumberGet PR statusmcp_github_get_pull_request_status({ "owner": "user", "repo": "project", "pullNumber": 1 })
mcp_github_merge_pull_requestowner, repo, pullNumber, commit_title, commit_message, merge_methodMerge a PRmcp_github_merge_pull_request({ "owner": "user", "repo": "project", "pullNumber": 1, "merge_method": "squash" })
mcp_github_list_pull_requestsowner, repo, state, head, base, sort, direction, page, perPageList PRsmcp_github_list_pull_requests({ "owner": "user", "repo": "project", "state": "open" })

Search Operations

CommandParametersDescriptionExample
mcp_github_search_codeq, sort, order, page, perPageSearch codemcp_github_search_code({ "q": "function in:file language:javascript repo:user/project" })
mcp_github_search_issuesq, sort, order, page, perPageSearch issuesmcp_github_search_issues({ "q": "is:issue is:open label:bug repo:user/project" })
mcp_github_search_repositoriesquery, page, perPageSearch reposmcp_github_search_repositories({ "query": "topic:javascript stars:>1000" })
mcp_github_search_usersq, sort, order, page, perPageSearch usersmcp_github_search_users({ "q": "location:london language:javascript" })

Security Operations

CommandParametersDescriptionExample
mcp_github_get_code_scanning_alertowner, repo, alertNumberGet code scanning alertmcp_github_get_code_scanning_alert({ "owner": "user", "repo": "project", "alertNumber": 1 })
mcp_github_list_code_scanning_alertsowner, repo, ref, tool_name, state, severityList code scanning alertsmcp_github_list_code_scanning_alerts({ "owner": "user", "repo": "project", "state": "open" })
mcp_github_get_secret_scanning_alertowner, repo, alertNumberGet secret scanning alertmcp_github_get_secret_scanning_alert({ "owner": "user", "repo": "project", "alertNumber": 1 })
mcp_github_list_secret_scanning_alertsowner, repo, state, secret_type, resolutionList secret scanning alertsmcp_github_list_secret_scanning_alerts({ "owner": "user", "repo": "project", "state": "open" })

User Operations

CommandParametersDescriptionExample
mcp_github_get_mereasonGet authenticated usermcp_github_get_me({ "reason": "Check permissions" })

Notification Operations

CommandParametersDescriptionExample
mcp_github_list_notificationsfilter, owner, repo, since, before, page, perPageList notificationsmcp_github_list_notifications({ "filter": "default" })
mcp_github_get_notification_detailsnotificationIDGet notification detailsmcp_github_get_notification_details({ "notificationID": "12345" })
mcp_github_dismiss_notificationthreadID, stateDismiss notificationmcp_github_dismiss_notification({ "threadID": "12345", "state": "read" })

šŸŽ¤ Voice Command Integration

Repository Management Voice Commands

# Create a new repository
"Create a new GitHub repository called project-name with description 'Project description'"

# Create a new branch
"Create a branch called feature/auth from main in the user/project repository"

# Clone a repository
"Clone the github/github-mcp-server repository"

Issue Management Voice Commands

# Create a new task/issue
"Create a task to implement user authentication with JWT"

# Update issue status
"Mark issue BAD-001 as in progress"

# Assign issue
"Assign issue BAD-001 to @developer"

# Add labels
"Add security and backend labels to issue BAD-001"

Project Management Voice Commands

# Create a project
"Create a new GitHub project called Authentication System"

# Add to project
"Add issue BAD-001 to the Authentication project board"

# Move card
"Move issue BAD-001 to In Progress column"

# Create sprint
"Create sprint 1 with duration of 2 weeks"

šŸ’¬ Chat Command Integration

Repository Management Chat Commands

# Create repository
/repo create --name "project-name" --description "Project description" --private

# Create branch
/branch create --repo "user/project" --name "feature/auth" --from "main"

# Push changes
/repo push --files "README.md,index.js" --message "Initial commit"

Issue Management Chat Commands

# Create issue
/issue create --title "[BAD-001] Implement Auth" --body "Details..." --labels "enhancement,security"

# Update issue
/issue update BAD-001 --status "In Progress" --assignee "@developer"

# Comment on issue
/issue comment BAD-001 "Added JWT implementation"

Project Management Chat Commands

# Create project
/project create "Authentication System" --template "kanban"

# Add to project
/project add BAD-001 --column "To Do"

# Create sprint
/sprint create "Sprint 1" --duration 2w --goal "Complete authentication system"

šŸ“Š Project Management Workflows

Repository Creation Workflow

  1. Create Repository

    # Voice command
    "Create a new GitHub repository called auth-service with description 'Authentication service'"
    
    # MCP command
    mcp_github_create_repository({ "name": "auth-service", "description": "Authentication service", "private": true, "autoInit": true })
    
  2. Create Project Structure

    # Push initial files
    mcp_github_push_files({
      "owner": "user",
      "repo": "auth-service",
      "branch": "main",
      "files": [
        {"path": "README.md", "content": "# Authentication Service\n\nService for user authentication."},
        {"path": ".gitignore", "content": "node_modules/\n.env\n"},
        {"path": "package.json", "content": "{\n  \"name\": \"auth-service\",\n  \"version\": \"1.0.0\"\n}"}
      ],
      "message": "Initial project structure"
    })
    
  3. Create Project Board

    # Voice command
    "Create a new project board for auth-service with columns To Do, In Progress, and Done"
    

Issue Creation Workflow

  1. Create Issue Template

    # Create issue template file
    mcp_github_create_or_update_file({
      "owner": "user",
      "repo": "auth-service",
      "path": ".github/ISSUE_TEMPLATE/feature.md",
      "content": "---\nname: Feature\ndescription: Feature request\n---\n\n## Description\n\n## Requirements\n\n## Acceptance Criteria",
      "message": "Add feature issue template",
      "branch": "main"
    })
    
  2. Create Issue

    # Voice command
    "Create a task to implement JWT authentication with requirements must support refresh tokens and assign to @security-team"
    
    # MCP command
    mcp_github_create_issue({
      "owner": "user",
      "repo": "auth-service",
      "title": "[BAD-001] Implement JWT Authentication",
      "body": "## Description\nImplement JWT authentication\n\n## Requirements\n- [ ] Support refresh tokens\n- [ ] Secure storage\n- [ ] Token expiration\n\n## Acceptance Criteria\n- [ ] Users can authenticate\n- [ ] Tokens can be refreshed\n- [ ] Expired tokens are rejected",
      "labels": ["enhancement", "security"],
      "assignees": ["security-team"]
    })
    
  3. Add to Project

    # Voice command
    "Add issue BAD-001 to the Authentication project board in To Do column"
    

Sprint Management Workflow

  1. Create Sprint

    # Voice command
    "Create sprint 1 with duration of 2 weeks and goal to complete authentication system"
    
  2. Add Issues to Sprint

    # Voice command
    "Add issues BAD-001, BAD-002, and BAD-003 to sprint 1"
    
  3. Start Sprint

    # Voice command
    "Start sprint 1 and notify the team"
    
  4. Track Progress

    # Voice command
    "Show progress on sprint 1"
    

šŸ“ Task Management Templates

Standard Issue Template

[BAD-XXX] šŸ”§ Task Title

## šŸš€ Feature Description
Detailed description of the feature or task.

## šŸ“‹ Requirements
- [ ] Requirement 1
- [ ] Requirement 2
- [ ] Requirement 3

## šŸ“ Implementation Steps
1. Step 1
2. Step 2
3. Step 3

## šŸŽØ UI/UX Requirements
- Design specification 1
- Design specification 2

## šŸ”— Related Components
- Component 1
- Component 2

## šŸ’» Technical Specifications
```code
// Code example

🧪 Testing Requirements

  • Test case 1
  • Test case 2

šŸ“š Documentation Requirements

  • Update API docs
  • Update user guide

⚔ Performance Specifications

  • Performance metric 1
  • Performance metric 2

šŸ”’ Security Considerations

  • Security requirement 1
  • Security requirement 2

āœ… Acceptance Criteria

  • Criterion 1
  • Criterion 2
  • Criterion 3

### Task ID Assignment

1. **Format**: `[BAD-XXX]` where XXX is a sequential number
2. **Check existing issues** to determine the next available number
3. **Never reuse** task IDs, even if an old task is closed/deleted

### Task Labeling System

| Category | Available Labels |
|----------|------------------|
| **Type** | `enhancement`, `bug`, `feature`, `documentation`, `refactor` |
| **Area** | `frontend`, `backend`, `design`, `devops`, `testing` |
| **Priority** | `high-priority`, `medium`, `low` |
| **Status** | `blocked`, `in-progress`, `ready-for-review` |

## šŸ”§ Advanced Automation

### GitHub Actions Integration

Create a workflow file for automated issue management:

```yaml
# .github/workflows/issue-automation.yml
name: Issue Automation
on:
  issues:
    types: [opened, edited, labeled, unlabeled, assigned, unassigned]

jobs:
  process_issue:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Process Issue
        uses: actions/github-script@v6
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          script: |
            const issue = context.payload.issue;
            
            // Add to project board
            if (issue.labels.some(label => label.name === 'feature')) {
              // Add to feature board
            }
            
            // Update task-log.md
            if (issue.title.startsWith('[BAD-')) {
              // Update task log
            }

Automated Documentation Updates

Create a script to update documentation based on issue changes:

// scripts/update-docs.js
async function updateTaskLog(issue) {
  const taskId = issue.title.match(/\[BAD-(\d+)\]/)[1];
  const status = getIssueStatus(issue);
  
  // Update task-log.md
  const taskLog = fs.readFileSync('task-log.md', 'utf8');
  const updatedTaskLog = updateTaskStatus(taskLog, taskId, status);
  fs.writeFileSync('task-log.md', updatedTaskLog);
  
  // Add comment to issue
  await github.issues.createComment({
    owner: context.repo.owner,
    repo: context.repo.repo,
    issue_number: issue.number,
    body: `Updated task-log.md with status: ${status}`
  });
}

ā— Troubleshooting

Common MCP Server Issues

  1. Connection Problems

    • Error: "Failed to create MCP server"
    • Solution: Check GitHub token permissions and expiration
  2. Command Execution Failures

    • Error: "Failed to execute command"
    • Solution: Verify parameter format and required fields
  3. Permission Issues

    • Error: "Resource not accessible by integration"
    • Solution: Update GitHub token with required permissions

Debugging Process

  1. Check MCP server logs
  2. Verify GitHub token permissions
  3. Test command with minimal parameters
  4. Check for rate limiting issues
  5. Verify repository access

Made with Power, Love, and AI • āš”ļøā¤ļøšŸ¤– • POWERBRIDGE.AI

Related Documents