highlight github mcp
Extracts diffs from GitHub Pull Requests, allowing users to retrieve and analyze changes between branches in a repository.
Extracts diffs from GitHub Pull Requests, allowing users to retrieve and analyze changes between branches in a repository.
The GitHub MCP server provides functionality to extract diffs from Pull Requests.
Retrieves the diff content from a GitHub Pull Request.
Parameters:
- owner
: Repository owner/organization name
- repo
: Repository name
- pr_number
: Pull Request number
Returns: Object containing:
- content
: String containing the PR diff
Required: Set the GitHub Personal Access Token as an environment variable:
export GITHUB_TOKEN=<your-github-token>
The token needs at least repo
scope permissions to access private repositories. For public repositories, a token with public_repo
scope is sufficient.
The server implements standard error handling:
- Missing/invalid token returns ErrorCode.AuthenticationError
- Invalid repository details return ErrorCode.InvalidParams
- Non-existent PR returns ErrorCode.NotFound
- Failed diff fetches return formatted error messages
- Graceful shutdown on SIGINT