Implementing a GitHub MCP server for streamlined repository, issue, and code management with LLM integration
GitHub MCP Server is an implementation of Model Context Protocol (MCP) designed to enable AI applications like Claude Desktop, Continue, Cursor, and others to interact with specific data sources and tools through a standardized protocol. This enhances the interoperability and performance of AI workflows by abstracting complex interactions into simpler, more predictable API calls.
GitHub MCP Server provides essential capabilities for AI applications that need to perform common GitHub operations such as code search, issue management, and repository manipulation. By leveraging MCP, developers can create robust and flexible AI-driven solutions without deep diving into the intricacies of GitHub's APIs.
The GitHub MCP Server employs a modern, scalable architecture designed to handle complex requests from AI applications. The core protocol is implemented in JavaScript using Node.js, ensuring compatibility with various environments.
graph TD
A[AI Application] -->|MCP Client| B[MCP Protocol]
B --> C[MCP Server]
C --> D[Data Source/Tool]
This diagram illustrates the interaction flow:
graph TB
subgraph MCP Protocol Stack
A[AI Application]
B[MCP Client]
C[MCP Server]
D[Databases]
C -->|API| D
A -->|MCP| B -->|API| C -->|Data Operations| D
end
This diagram illustrates the stack architecture:
To set up the GitHub MCP Server, follow these steps:
Clone Repository:
git clone https://github.com/tomo-cps/mcp-test.git
cd mcp-test
Install Dependencies:
npm install # or yarn install
Configure Environment Variables:
Create a .env
file and add the following variables:
GITHUB_TOKEN=your_github_personal_access_token
PORT=3000
Generate GitHub Personal Access Token:
Run Development Server:
npm run dev # or yarn dev
Run Production Server:
npm start # or yarn start
The server will now be running at http://localhost:3000
.
Scenario: An AI application needs to identify bugs within code repositories.
Implementation:
fetch('http://localhost:3000/mcp/execute', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
command: 'search_code',
params: { repoOwner: 'octocat', query: 'error handling' }
})
}).then(response => response.json()).then(data => console.log(data));
Scenario: Automating issue creation and management in large development teams.
Implementation:
fetch('http://localhost:3000/mcp/execute', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
command: 'create_issue',
params: { owner: 'your-username', repo: 'your-repo', title: 'Bug in Login', body: 'Detailed description here...', labels: ['bug', 'priority:high'] }
})
}).then(response => response.json()).then(data => console.log(data));
The GitHub MCP Server supports the following clients:
MCP Client | Resources | Tools | Prompts |
---|---|---|---|
Claude Desktop | ✅ | ✅ | ✅ |
Continue | ✅ | ✅ | ✅ |
Cursor | ❌ | ✅ | ❌ |
{
"mcpServers": {
"[server-name]": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-[name]"],
"env": {
"API_KEY": "your-api-key"
}
}
}
}
Implement secure authentication mechanisms, handle rate limits, and manage CORS policy to ensure a robust security posture.
Q: How do I configure environment variables?
A: Create a .env
file in the root directory of your project with the following:
GITHUB_TOKEN=your_github_personal_access_token
PORT=3000
Q: What are the supported MCP clients?
A: The server supports Claude Desktop and Continue; Cursor only provides tools.
Q: Can I customize command execution flow?
A: Yes, you can handle custom command executions by modifying logic in mcp-commands.js
.
Q: How do I manage GitHub API rate limits?
A: Implement mechanisms to handle rate limitations and avoid hitting the caps.
Q: What security measures are in place?
A: The system includes secure authentication, rate limiting, and CORS handling for enhanced security.
https://github.com/tomo-cps/mcp-test
and click ‘Fork’ to create a copy.git clone <forked-repo-url>
cd mcp-test
git checkout -b feature/amazing-feature
git add .
git commit -m 'Add amazing feature'
git push origin feature/amazing-feature
This comprehensive documentation positions the GitHub MCP Server as a robust solution for AI applications seeking to integrate seamlessly with GitHub's vast ecosystem of tools and resources.
Learn to connect to MCP servers over HTTP with Python SDK using SSE for efficient protocol communication
Next-generation MCP server enhances documentation analysis with AI-powered neural processing and multi-language support
Build a local personal knowledge base with Markdown files for seamless AI conversations and organized information.
Integrate AI with GitHub using MCP Server for profiles repos and issue creation
Python MCP client for testing servers avoid message limits and customize with API key
Explore MCP servers for weather data and DigitalOcean management with easy setup and API tools