Skip to content
Back to search

Github_MCP

A Model Context Protocol (MCP) server that integrates with the GitHub REST API to retrieve repository information, issues, and pull requests through MCP tools.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/abhijit735--github-mcp/badge.svg)](/listings/abhijit735--github-mcp)

HTML

<a href="/listings/abhijit735--github-mcp"><img src="/api/listings/abhijit735--github-mcp/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

readme.md · README · 156 lines
  1. ```
  2. # GitHub MCP Server
  3. A Model Context Protocol (MCP) server that integrates with the GitHub REST API to retrieve repository information, issues, and pull requests through MCP tools.
  4. ## 1. Project Architecture
  5. The project follows a simple client-server architecture where an MCP client communicates with the GitHub MCP server, and the server interacts with the GitHub REST API.
  6. ## 2. Project Workflow
  7. 1. Initialize the MCP server using FastMCP.
  8. 2. Load environment variables from the `.env` file.
  9. 3. Define GitHub API request headers.
  10. 4. Register GitHub operations as MCP tools.
  11. 5. Receive tool requests from the MCP client.
  12. 6. Execute asynchronous HTTP requests using HTTPX.
  13. 7. Retrieve JSON responses from the GitHub REST API.
  14. 8. Process the API responses and return structured results to the MCP client.
  15. ## 3. Use Cases
  16. The GitHub MCP server allows AI applications to access GitHub information through a standardized tool interface.
  17. Practical use cases include:
  18. - **Repository Exploration:** Ask an AI assistant to list your public repositories.
  19. - **Repository Analysis:** Retrieve repository statistics, programming languages, stars, and forks.
  20. - **Issue Tracking:** Identify open or closed issues in a repository.
  21. - **Pull Request Monitoring:** Retrieve pull requests and their current states.
  22. - **Developer Productivity:** Access GitHub information through natural-language interactions with an MCP-compatible client.
  23. ```
  24. ```
  25. ## 4. Project Structure
  26. Github_MCP/
  27. │
  28. ├── github_mcp.py # Main MCP server implementation
  29. ├── pyproject.toml # Project configuration
  30. ├── uv.lock # Locked dependency versions
  31. ├── .env.example # Environment variable template
  32. ├── readme.md # Project documentation
  33. ```
  34. ```
  35. ## 5. Environment Configuration
  36. Create a `.env` file in the project root directory.
  37. GITHUB_USERNAME=your_github_username
  38. GITHUB_API=https://api.github.com
  39. GEMINI_API_KEY=
  40. ```
  41. Note: The current implementation accesses public repository endpoints without an authentication token. Private repository access and authenticated requests are not implemented. The Gemini API key is loaded but not currently used.
  42. ```
  43. ## 6. Installation and Execution
  44. ### Prerequisites
  45. - Python 3.11+
  46. - GitHub account
  47. - uv package manager
  48. - Node.js and npm
  49. ### Step 1: Clone the Repository
  50. ```bash
  51. git clone <YOUR_GITHUB_REPOSITORY_URL>
  52. ```
  53. ```
  54. ### Step 2: Navigate to the Project
  55. ```bash
  56. cd Github_MCP
  57. ```
  58. ```
  59. ### Step 3: Create a Virtual Environment
  60. ```bash
  61. uv venv
  62. ```
  63. ```
  64. ### Step 4: Install Dependencies
  65. ```bash
  66. uv sync
  67. ```
  68. ```
  69. ### Step 5: Configure Environment Variables
  70. Create a `.env` file in the project root and configure the required GitHub username and API URL.
  71. ### Step 6: Run MCP Inspector
  72. Execute the following command to launch MCP Inspector and connect your GitHub MCP server:
  73. ```powershell
  74. npx -y @modelcontextprotocol/inspector@0.16.2 "<PYTHON_EXECUTABLE_PATH>" "<PROJECT_PATH>\github_mcp.py"
  75. ```
  76. ```
  77. Replace the placeholders:
  78. - `<PYTHON_EXECUTABLE_PATH>`: Path to `.venv\Scripts\python.exe`.
  79. - `<PROJECT_PATH>`: Absolute path to your GitHub_MCP project directory.
  80. The MCP Inspector UI will open in your browser.
  81. ### Step 7: Test MCP Tools
  82. 1. Connect to the GitHub MCP server.
  83. 2. Navigate to the Tools section.
  84. 3. Select a tool and provide the required arguments.
  85. 4. Click Run Tool to execute.
  86. 5. Inspect the returned response.
  87. ## 7. Expected Output
  88. The MCP server exposes four tools:
  89. 1. `list_my_public_repositories`
  90. 2. `get_repo_info`
  91. 3. `list_issues`
  92. 4. `list_pull_requests`
  93. ### Example Output: Repository Information
  94. ```json
  95. {
  96. "name": "username/repository",
  97. "description": "Example GitHub project",
  98. "stars": 10,
  99. "forks": 2,
  100. "language": "Python",
  101. "open_issues": 3,
  102. "url": "https://github.com/username/repository"
  103. }
  104. ```
  105. ```
  106. *Example response structure for get_repo_info. Actual values depend on the selected repository.*
  107. ## 8. Application Screenshot
  108. **Screenshot Description:**
  109. The screenshot demonstrates the GitHub MCP server connected through MCP Inspector, displaying the registered tools and an example tool execution with a structured response from the GitHub API.
  110. ```
  111. <img width="947" height="402" alt="Screenshot 2026-11-21 134643" src="https://github.com/user-attachments/assets/e58b821e-30d8-4a7e-bf4a-597f1b968d60" />
  112. ```
  113. ## Conclusion
  114. This project demonstrates how to integrate GitHub REST API functionality with the Model Context Protocol (MCP).
  115. By exposing GitHub operations as MCP tools, AI applications can interact with repository information, issues, and pull requests through a standardized interface.
  116. ```

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.