Github-MCP-Server-Demo

jatinnahar15/Github-MCP-Server-Demo

3.1

If you are the rightful owner of Github-MCP-Server-Demo and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

This document provides a guide to setting up a Model Context Protocol (MCP) server using Python and Flask to interact with GitHub.

The Model Context Protocol (MCP) server is a custom server setup that allows users to interact with GitHub repositories through a Python-based server using Flask. This server is designed to handle specific commands sent via HTTP POST requests, enabling operations such as creating repositories on GitHub. The server uses a GitHub Personal Access Token for authentication and requires the installation of Python 3.x, Flask, and the requests library. Once set up, users can send JSON-formatted commands to the server, which processes these commands and interacts with GitHub accordingly.

Features

  • Custom Command Handling: The server processes specific commands sent via HTTP POST requests.
  • GitHub Integration: Allows interaction with GitHub repositories using a Personal Access Token.
  • Python and Flask Based: Utilizes Python 3.x and Flask for server setup and operation.
  • Secure Token Management: Requires secure setting of GitHub tokens for authentication.
  • Repository Management: Supports operations like creating repositories on GitHub.

Usages

usage with github

1. Install Python 3.x

2. Install Flask and requests:
      pip install flask requests

3. Create a GitHub Personal Access Token with repo scope

4. Create mcp server file. [mcp_github_server.py]

5. Set your GitHub token securely (in terminal):
   set GITHUB_TOKEN=ghp_YourTokenHere  # on Windows

6. Run it:
    python mcp_github_server.py

8. How to Send Post Request to Mcp Server,

      Send a POST request to http://localhost:5001/command with JSON like:

      BODY:
      {
        "name": "create-repo",
        "input": {
          "repo_name": "mcp-python-test",
          "private": true,
          "description": "Repository created via custom MCP Python server"
        }
      }