mcp-server

snehaapratap/mcp-server

3.2

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

This project implements a Model Context Protocol (MCP) server using FastAPI for GitHub interactions.

šŸš€ GitHub MCP Server - FastAPI Implementation

🌟 Overview

This project implements a Model Context Protocol (MCP) server using FastAPI, enabling AI assistants like Claude to interact with GitHub. The server provides API endpoints to fetch user details, manage repositories, create issues, and automate GitHub workflows.

✨ Features

  • āœ… Fetch GitHub user details and repositories
  • āœ… Create and manage issues in repositories
  • āœ… List all issues in a repository
  • āœ… Star a repository
  • āœ… AI-powered GitHub Issue Summarization (Optional)
  • āœ… Secure API with GitHub OAuth Token
  • āœ… Asynchronous FastAPI implementation

šŸ› ļø Setup & Installation

1ļøāƒ£ Clone the Repository

git clone https://github.com/snehaapratap/mcp-server.git
cd mcp-server

2ļøāƒ£ Create & Activate a Virtual Environment

python3 -m venv venv
source venv/bin/activate  

3ļøāƒ£ Install Dependencies

pip install -r requirements.txt

4ļøāƒ£ Set Up Environment Variables

Create a .env file in the root directory and add your GitHub Personal Access Token (PAT):

GITHUB_TOKEN=your_personal_access_token

5ļøāƒ£ Run the FastAPI Server

uvicorn server:app --reload

The server will start on http://127.0.0.1:8000.


šŸ”„ API Endpoints

MethodEndpointDescription
GET/Health check for MCP server
GET/github/userFetch GitHub user details
GET/github/reposGet all repositories of the authenticated user
POST/github/create-issueCreate an issue in a repository
GET/github/list-issuesList all issues in a repository
PUT/github/star-repoStar a repository
POST/github/summarize-issuesAI-powered issue summarization (Optional)

⚔ Usage Examples (cURL)

šŸ”¹ Get User Details

curl -X GET "http://127.0.0.1:8000/github/user"

šŸ”¹ Fetch Repositories

curl -X GET "http://127.0.0.1:8000/github/repos"

šŸ”¹ Create an Issue

curl -X POST "http://127.0.0.1:8000/github/create-issue?owner=your-username&repo=your-repo&title=New%20Issue&body=This%20is%20a%20test%20issue"

šŸ”¹ Star a Repository

curl -X PUT "http://127.0.0.1:8000/github/star-repo?owner=your-username&repo=your-repo"

šŸŽ„ Slides

šŸ“Œ View the Slides


šŸ›”ļø Error Handling

The API handles errors gracefully and returns meaningful messages:

{
  "error": "Invalid GitHub Token",
  "hint": "Ensure your token has the 'repo' scope."
}

šŸŽÆ Future Enhancements

  • šŸ”¹ Support for pull requests management
  • šŸ”¹ Implement WebSockets for real-time GitHub notifications
  • šŸ”¹ Deploy on AWS/GCP with CI/CD pipeline

šŸ’” Contributing

Want to improve this project? Feel free to open a pull request or file an issue!


šŸ‘Øā€šŸ’» Author

šŸ”¹ Sneha P Pratap
šŸ”¹ GitHub: @snehaapratap
šŸ”¹ LinkedIn: Sneha Prem Pratap