Load GitHub token from environment or set manually

by jatinnahar15

153 downloads
Not rated
GitHub

About

Repository created via custom MCP Python server

Details

Author
jatinnahar15
Downloads
153
Categories
Developer Tools

- Requires Python 3, Flask, and requests libraries.
- GitHub token loaded from environment variable for security.
- Runs a local HTTP server on port 5001.
- Accepts JSON commands to create GitHub repositories.
- Supports public and private repository creation.

Install Python 3.x, Flask, and requests. Create a GitHub Personal Access Token with repo scope, set it as the environment variable GITHUB_TOKEN, then run the server script mcp_github_server.py. Send a POST request to http://localhost:5001/command with a JSON body specifying the create-repo command and repository details.

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

image

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"
}
}

image

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.