A Model Context Protocol (MCP) server that provides an LLM agent with tools to read and write to GitHub repositories. Built for the Flipkart Grid 8.0 application.
This server uses the official Python mcp SDK (FastMCP) to establish a standardized JSON-RPC communication channel over stdio. It securely integrates with the GitHub API using PyGithub and enforces strict input validation via Pydantic.
sequenceDiagram
participant LLM as LLM Client (e.g. Claude)
participant MCP as FastMCP Server (Python)
participant GitHub as GitHub API
LLM->>MCP: Request tool call (e.g., search_issues)
Note over MCP: Validates Inputs (Pydantic Schema)
MCP->>GitHub: Authenticated REST API Call
GitHub-->>MCP: Raw JSON Response
Note over MCP: Formats and limits data (Context saving)
MCP-->>LLM: JSON-RPC Tool Result
- Create a virtual environment and install dependencies:
python -m venv venv .\venv\Scripts\activate pip install -r requirements.txt
- Create a
.envfile and add your GitHub Personal Access Token (PAT):GITHUB_TOKEN=github_pat_xxxx
- Test locally using the official MCP Inspector:
.\start_inspector.bat
search_issues(repo, query): Search for open issues/PRs in a specific repository.get_issue_details(repo, issue_number): Get the full body and latest 5 comments of a specific issue.create_issue(repo, title, body): Create a new issue (requires write permissions). Strict validation enforces minimum character lengths.