GitHub Operations
Use the GitHub MCP Server to manage repositories, issues, pull requests, and file operations.
When to Use
Use this skill when you need to automate GitHub-related tasks such as managing issues, reviewing pull requests, or performing remote file commits.
Prerequisites
- GitHub MCP server installed and configured.
- Valid
GITHUB_TOKEN with appropriate scopes available in the environment.
Capabilities
- Repository Management: Search, fork, and configure repositories.
- Issue Tracking: Create, list, search, and comment on issues.
- Pull Requests: Create, review, merge, and update PRs.
- File Operations: Read, write (commit), and delete files remotely.
- Branch Management: Create, list, and delete branches.
Process
- Authentication: Ensure
GITHUB_TOKEN is available in the environment.
- Context Loading: Use
search_repositories or list_repositories to find the target.
- Operation: Execute the specific tool (e.g.,
create_issue, get_file_contents).
- Verification: Check operations (e.g., verify PR creation).
Example Usage
Creating an Issue
response = await client.chat.completions.create(
messages=[{"role": "user", "content": "Create a bug report for the login crash"}],
tools=[{
"type": "mcp",
"name": "github",
"command": "docker", # Managed by MCP config
"args": ["run", ...]
}]
)
Reading a File
# Get content of README.md
content = await github.get_file_contents(
owner="owner-name",
repo="repo-name",
path="README.md"
)
Best Practices
- Security: Never hardcode tokens; use environment variables.
- Scope: Verify the token has appropriate permissions (repo, read:org, etc.).
- Rate Limiting: Be mindful of API limits when performing bulk operations.
Related
- MCP Server:
github-mcp-server
1---2name: operating-github3description: GitHub operations and repository management using the GitHub MCP Server4---5# GitHub Operations67Use the GitHub MCP Server to manage repositories, issues, pull requests, and file operations.89## When to Use10Use this skill when you need to automate GitHub-related tasks such as managing issues, reviewing pull requests, or performing remote file commits.1112## Prerequisites13- GitHub MCP server installed and configured.14- Valid `GITHUB_TOKEN` with appropriate scopes available in the environment.1516## Capabilities1718- **Repository Management**: Search, fork, and configure repositories.19- **Issue Tracking**: Create, list, search, and comment on issues.20- **Pull Requests**: Create, review, merge, and update PRs.21- **File Operations**: Read, write (commit), and delete files remotely.22- **Branch Management**: Create, list, and delete branches.2324## Process25261. **Authentication**: Ensure `GITHUB_TOKEN` is available in the environment.272. **Context Loading**: Use `search_repositories` or `list_repositories` to find the target.283. **Operation**: Execute the specific tool (e.g., `create_issue`, `get_file_contents`).294. **Verification**: Check operations (e.g., verify PR creation).3031## Example Usage3233### Creating an Issue34```python35response = await client.chat.completions.create(36 messages=[{"role": "user", "content": "Create a bug report for the login crash"}],37 tools=[{38 "type": "mcp",39 "name": "github",40 "command": "docker", # Managed by MCP config41 "args": ["run", ...]42 }]43)44```4546### Reading a File47```python48# Get content of README.md49content = await github.get_file_contents(50 owner="owner-name",51 repo="repo-name",52 path="README.md"53)54```5556## Best Practices5758- **Security**: Never hardcode tokens; use environment variables.59- **Scope**: Verify the token has appropriate permissions (repo, read:org, etc.).60- **Rate Limiting**: Be mindful of API limits when performing bulk operations.6162## Related63- MCP Server: `github-mcp-server`