MCP Server for GitHub Pull Request Automation
LocalAbout MCP Server for GitHub Pull Request Automation
A Go server that automates GitHub pull request creation and merging in response to webhook events. It is intended for repository maintainers who want feature-branch pushes and pull request events to trigger these actions.
Key features
- 01Create PRs from `feature/` branches
- 02Merge PRs with merge, squash, or rebase
- 03React to push and pull request webhooks
Use cases
- 01Open a PR when a `feature/` branch is pushed
- 02Choose a merge strategy for a pull request
- 03Track webhook-triggered pull request activity
MCP support
The project is described as an MCP server, but the README focuses on GitHub webhook-driven pull request automation and does not specify tools or resources exposed to MCP clients.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEMCP Server for GitHub Pull Request Automation
MCP (Merge and Create Pull Request) Server is a Go-based application designed to automate GitHub pull requests (PRs). It listens for GitHub webhook events (such as push and PR events) and automatically creates or merges pull requests based on specific conditions.
Features
- Automate PR creation: Automatically create pull requests for branches that follow a
feature/naming convention. - Merge Pull Requests: Merge pull requests with a selected strategy (
merge,squash, orrebase). - Handle Webhooks: Listens for GitHub webhook events to trigger actions on push or pull request events.
Requirements
- Go 1.18+ (for building and running the server)
- GitHub account with access to repositories
- Ngrok (for tunneling your local server to a public URL, required for GitHub webhook testing)
Setup Instructions
1. Clone the Repository
Clone this repository to your local machine.
git clone https://github.com/your-username/github_mcp.git
cd github_mcp
2. Install Dependencies
Install the required dependencies using go get.
go mod tidy
3. Configure Environment Variables
Create the Env Variables file with your credentials.
GITHUB_TOKEN=your_github_personal_access_token
OWNER=your_github_username
REPO=your_github_repository
BASE_BRANCH=main
4. Install Ngrok
If you are testing GitHub webhooks locally, you can use Ngrok to expose your local server to the internet.
Download and install Ngrok from https://ngrok.com/download.
After installing Ngrok, run it on port 8080:
ngrok http 8080
This will give you a public URL that you can use to set up the webhook in your GitHub repository.(If you have something better to expose your app, go with it.)
5. Run the Server
Run the server using the following command:
go run main.go
This will start the server on http://localhost:8080.
6. Set Up GitHub Webhook
- Go to your GitHub repository.
- Navigate to Settings > Webhooks > Add webhook.
- In the Payload URL field, enter the Ngrok URL or your local server URL:
http://<ngrok-url>/webhook(e.g.,http://1234.ngrok.io/webhook). - Set the Content type to
application/json. - Choose the events that will trigger the webhook, typically Push and Pull request.
- Save the webhook.
7. Test
- Make a push to a branch that starts with
feature/(e.g.,feature/new-feature). - The server will automatically create a pull request from that branch to the base branch.
- If a pull request is closed and merged, it will be logged and the status will be updated.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is open-source and available under the MIT License. `
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.