Sponsored by Deepsite.site

MCP Server for GitHub Pull Request Automation

Created By
pratik-mahalle8 months ago
Content

MCP 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, or rebase).
  • 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

  1. Go to your GitHub repository.
  2. Navigate to Settings > Webhooks > Add webhook.
  3. 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).
  4. Set the Content type to application/json.
  5. Choose the events that will trigger the webhook, typically Push and Pull request.
  6. 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. `

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Playwright McpPlaywright MCP server
DeepChatYour AI Partner on Desktop
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
CursorThe AI Code Editor
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Amap Maps高德地图官方 MCP Server
Tavily Mcp
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
WindsurfThe new purpose-built IDE to harness magic
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
ChatWiseThe second fastest AI chatbot™
Serper MCP ServerA Serper MCP Server
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.