bots-garden/mini-mepublic Fork
⑂ main
Commits
⬇ Clone ▾
git clone https://git.rickub.com/bots-garden/mini-me.git
git clone ssh://git@rickub.com/bots-garden/mini-me.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP
🛟 Updated. f854e27 · on main · k33g · Sep 23, 2026
mcp-use-github.md · 201 lines · 6.3 KBmarkdown
Blame HistoryOpen raw

Use GitHub for Code Access

This guide shows how to use the GitHub MCP server to interact with GitHub repositories, issues, pull requests, and more.

Prerequisites

  • MCP enabled in your mini-me configuration
  • GitHub MCP server configured
  • GitHub Personal Access Token with appropriate scopes

Configuration Example

Add this to your agent.yaml or custom config file:

mcp:
  enabled: true
  servers:
    - name: github
      transport: http
      url: https://api.githubcopilot.com/mcp/
      timeout: 60s
      auth:
        type: bearer
        tokenEnv: GITHUB_PERSONAL_ACCESS_TOKEN
      headers:
        Accept: "application/json, text/event-stream"
      # Optional: Filter which tools to expose
      tools:
        - get_me
        - list_repositories
        - list_issues
        - list_pull_requests
        - get_file_contents
        - search_code
        - search_repositories
        - create_pull_request
        - add_issue_comment

Authentication Setup

  1. Get a GitHub PAT:

  2. Required Scopes:

    • For repository access: repo (full control of private repositories)
    • For reading user profile: user (read:user)
    • For reading organizations: read:org
    • For issues and pull requests: repo or public_repo
    • For code search: repo
  3. Set the environment variable:

    export GITHUB_PERSONAL_ACCESS_TOKEN=ghp_your_token_here
    

Available Tools

The GitHub MCP server provides many tools organized by category:

Repository Information

  • github_get_me - Get authenticated user profile
  • github_list_repositories - List user repositories
  • github_get_repository - Get repository details

Code Access

  • github_get_file_contents - Get file content from a repository
  • github_list_branches - List repository branches
  • github_list_commits - List repository commits
  • github_get_commit - Get commit details

Issues and Pull Requests

  • github_list_issues - List repository issues
  • github_get_issue_details - Get issue details (using issue_read method)
  • github_list_pull_requests - List repository pull requests
  • github_get_pull_request - Get pull request details (using pull_request_read method)
  • github_create_pull_request - Create a new pull request
  • github_add_issue_comment - Add a comment to an issue
  • github_update_issue_comment - Update an existing comment
  • github_search_code - Search code across repositories
  • github_search_issues - Search issues using semantic matching
  • github_search_pull_requests - Search pull requests
  • github_search_repositories - Search for repositories
  • github_search_commits - Search for commits
  • github_search_users - Search for users

Repository Management

  • github_create_repository - Create a new repository
  • github_create_branch - Create a new branch
  • github_fork_repository - Fork a repository
  • github_merge_pull_request - Merge a pull request
  • github_delete_file - Delete a file from a repository

Advanced

  • github_run_secret_scanning - Scan content for secrets
  • github_assign_copilot_to_issue - Assign GitHub Copilot to an issue
  • github_get_copilot_job_status - Get Copilot job status
  • github_create_pull_request_with_copilot - Create PR with Copilot agent
  • github_request_copilot_review - Request Copilot code review

Usage Examples

Get Your Profile

Use the github_get_me tool to get my GitHub user information

List Your Repositories

Use the github_list_repositories tool to list all my repositories

Search for Code

Use the github_search_code tool to find references to "context" in the golang/go repository

Get File Contents

Use the github_get_file_contents tool to get the README.md file from owner/repo on the main branch

Create a Pull Request

Use the github_create_pull_request tool to create a PR in owner/repo with title "Fix bug", head "feature-branch", base "main"

Add Comment to Issue

Use the github_add_issue_comment tool to add a comment "Thanks for reporting!" to issue #123 in owner/repo

Tool Parameters

Most GitHub tools require these common parameters:

  • owner - Repository owner (username or organization)
  • repo - Repository name
  • Often both are marked with x-mcp-header to indicate they should be passed as headers

For example:

{
  "owner": "octocat",
  "repo": "Hello-World"
}

Tips

  1. Be specific with owner/repo: Always verify the owner and repository name before proceeding
  2. Use filters: When searching, use GitHub's search qualifiers like language:go, org:, user:
  3. Handle large responses: Some tools return large amounts of data; consider filtering or limiting results
  4. Check scopes: If a tool fails with authentication error, your PAT may lack the required scope

Common Issues

Missing Required Parameters

Many GitHub tools require specific parameters. Check the tool description for required fields.

Authentication Errors

If you see "missing bearer token" or "401 Unauthorized":

  • Verify GITHUB_PERSONAL_ACCESS_TOKEN environment variable is set
  • Check your token has the required scopes
  • Ensure the token hasn't expired

Rate Limiting

GitHub has rate limits. If you hit them:

  • Wait before making more requests
  • Consider using a fine-grained PAT with specific repository access
  • Check your rate limit status at https://api.github.com/rate_limit

Troubleshooting

If GitHub tools are not appearing:

  1. Verify MCP is enabled in your configuration
  2. Check that GITHUB_PERSONAL_ACCESS_TOKEN is exported in your environment
  3. Look for warnings about GitHub server at startup
  4. Test your token: curl -H "Authorization: Bearer $GITHUB_PERSONAL_ACCESS_TOKEN" https://api.github.com/user
  5. Test the MCP endpoint: curl -X POST https://api.githubcopilot.com/mcp/ -H "Authorization: Bearer $GITHUB_PERSONAL_ACCESS_TOKEN" -H "Accept: application/json, text/event-stream" -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'

See Also

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# Use GitHub for Code Access

This guide shows how to use the GitHub MCP server to interact with GitHub repositories, issues, pull requests, and more.

## Prerequisites

- MCP enabled in your mini-me configuration
- GitHub MCP server configured
- **GitHub Personal Access Token** with appropriate scopes

## Configuration Example

Add this to your `agent.yaml` or custom config file:

```yaml
mcp:
  enabled: true
  servers:
    - name: github
      transport: http
      url: https://api.githubcopilot.com/mcp/
      timeout: 60s
      auth:
        type: bearer
        tokenEnv: GITHUB_PERSONAL_ACCESS_TOKEN
      headers:
        Accept: "application/json, text/event-stream"
      # Optional: Filter which tools to expose
      tools:
        - get_me
        - list_repositories
        - list_issues
        - list_pull_requests
        - get_file_contents
        - search_code
        - search_repositories
        - create_pull_request
        - add_issue_comment
```

## Authentication Setup

1. **Get a GitHub PAT:**
   - Go to [https://github.com/settings/tokens](https://github.com/settings/tokens)
   - Click "Generate new token"
   - Select "Classic" token type

2. **Required Scopes:**
   - For repository access: `repo` (full control of private repositories)
   - For reading user profile: `user` (read:user)
   - For reading organizations: `read:org`
   - For issues and pull requests: `repo` or `public_repo`
   - For code search: `repo`

3. **Set the environment variable:**
   ```bash
   export GITHUB_PERSONAL_ACCESS_TOKEN=ghp_your_token_here
   ```

## Available Tools

The GitHub MCP server provides many tools organized by category:

### Repository Information
- `github_get_me` - Get authenticated user profile
- `github_list_repositories` - List user repositories
- `github_get_repository` - Get repository details

### Code Access
- `github_get_file_contents` - Get file content from a repository
- `github_list_branches` - List repository branches
- `github_list_commits` - List repository commits
- `github_get_commit` - Get commit details

### Issues and Pull Requests
- `github_list_issues` - List repository issues
- `github_get_issue_details` - Get issue details (using `issue_read` method)
- `github_list_pull_requests` - List repository pull requests
- `github_get_pull_request` - Get pull request details (using `pull_request_read` method)
- `github_create_pull_request` - Create a new pull request
- `github_add_issue_comment` - Add a comment to an issue
- `github_update_issue_comment` - Update an existing comment

### Search
- `github_search_code` - Search code across repositories
- `github_search_issues` - Search issues using semantic matching
- `github_search_pull_requests` - Search pull requests
- `github_search_repositories` - Search for repositories
- `github_search_commits` - Search for commits
- `github_search_users` - Search for users

### Repository Management
- `github_create_repository` - Create a new repository
- `github_create_branch` - Create a new branch
- `github_fork_repository` - Fork a repository
- `github_merge_pull_request` - Merge a pull request
- `github_delete_file` - Delete a file from a repository

### Advanced
- `github_run_secret_scanning` - Scan content for secrets
- `github_assign_copilot_to_issue` - Assign GitHub Copilot to an issue
- `github_get_copilot_job_status` - Get Copilot job status
- `github_create_pull_request_with_copilot` - Create PR with Copilot agent
- `github_request_copilot_review` - Request Copilot code review

## Usage Examples

### Get Your Profile

```
Use the github_get_me tool to get my GitHub user information
```

### List Your Repositories

```
Use the github_list_repositories tool to list all my repositories
```

### Search for Code

```
Use the github_search_code tool to find references to "context" in the golang/go repository
```

### Get File Contents

```
Use the github_get_file_contents tool to get the README.md file from owner/repo on the main branch
```

### Create a Pull Request

```
Use the github_create_pull_request tool to create a PR in owner/repo with title "Fix bug", head "feature-branch", base "main"
```

### Add Comment to Issue

```
Use the github_add_issue_comment tool to add a comment "Thanks for reporting!" to issue #123 in owner/repo
```

## Tool Parameters

Most GitHub tools require these common parameters:

- `owner` - Repository owner (username or organization)
- `repo` - Repository name
- Often both are marked with `x-mcp-header` to indicate they should be passed as headers

For example:
```json
{
  "owner": "octocat",
  "repo": "Hello-World"
}
```

## Tips

1. **Be specific with owner/repo:** Always verify the owner and repository name before proceeding
2. **Use filters:** When searching, use GitHub's search qualifiers like `language:go`, `org:`, `user:`
3. **Handle large responses:** Some tools return large amounts of data; consider filtering or limiting results
4. **Check scopes:** If a tool fails with authentication error, your PAT may lack the required scope

## Common Issues

### Missing Required Parameters

Many GitHub tools require specific parameters. Check the tool description for required fields.

### Authentication Errors

If you see "missing bearer token" or "401 Unauthorized":
- Verify `GITHUB_PERSONAL_ACCESS_TOKEN` environment variable is set
- Check your token has the required scopes
- Ensure the token hasn't expired

### Rate Limiting

GitHub has rate limits. If you hit them:
- Wait before making more requests
- Consider using a fine-grained PAT with specific repository access
- Check your rate limit status at https://api.github.com/rate_limit

## Troubleshooting

If GitHub tools are not appearing:
1. Verify MCP is enabled in your configuration
2. Check that `GITHUB_PERSONAL_ACCESS_TOKEN` is exported in your environment
3. Look for warnings about GitHub server at startup
4. Test your token: `curl -H "Authorization: Bearer $GITHUB_PERSONAL_ACCESS_TOKEN" https://api.github.com/user`
5. Test the MCP endpoint: `curl -X POST https://api.githubcopilot.com/mcp/ -H "Authorization: Bearer $GITHUB_PERSONAL_ACCESS_TOKEN" -H "Accept: application/json, text/event-stream" -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'`

## See Also

- [Getting Started with MCP](tutorials/getting-started.md)
- [Use Context7 for documentation](use-context7.md)
- [Use Wikipedia for research](use-wikipedia.md)
- [MCP Configuration Reference](reference/configuration.md)