A powerful Node.js application that enables natural language exploration and analysis of GitHub repositories through the Model Context Protocol (MCP).
- π£οΈ Natural Language Interface: Ask questions about repositories in plain English
- π Comprehensive Analysis: Explore issues, pull requests, repository activity, and code statistics
- π― Interactive UI: User-friendly interface with example queries and custom input
- π MCP Integration: Leverages the Model Context Protocol to interact with GitHub's API
- β‘ Real-time Results: Get immediate insights on repository activity and health
- π Repository Search: Search for repositories across GitHub
- π Statistics Dashboard: View detailed repository statistics and metrics
- π οΈ Available Tools: Explore all available MCP tools and their capabilities
Before you begin, ensure you have the following:
- Node.js (v18 or higher) and npm installed
- GitHub Personal Access Token with the following permissions:
repo(for private repositories)public_repo(for public repositories)read:org(for organization information)read:user(for user information)
- OpenAI API Key for natural language processing
# Using nvm (recommended)
nvm install 18
nvm use 18
# Or download from https://nodejs.org/-
Clone the repository:
git clone <repository-url> cd ai_github_analysis
-
Install backend dependencies:
npm install
-
Install frontend dependencies:
cd frontend npm install cd ..
-
Create environment variables: Create a
.envfile in the root directory:GITHUB_TOKEN=your_github_personal_access_token_here OPENAI_API_KEY=your_openai_api_key_here PORT=3001
Start both the backend and frontend simultaneously:
npm startThis will start:
- Backend API server on
http://localhost:3001 - Frontend React app on
http://localhost:3000
Start the backend server:
npm run serverStart the frontend (in a new terminal):
cd frontend
npm startRun the MCP server as a CLI tool:
npm run mcp-serverExample CLI usage:
# Analyze a repository
node server/mcpServer.js analyze_repository '{"owner":"facebook","repo":"react","query":"What are the recent trends in this repository?"}'
# Search repositories
node server/mcpServer.js search_repositories '{"query":"react ui components"}'
# Get repository stats
node server/mcpServer.js get_repo_stats '{"owner":"facebook","repo":"react"}'The backend provides several REST API endpoints:
GET /api/health- Health checkGET /api/tools- List available MCP tools
POST /api/query- Analyze repository with natural language queryPOST /api/execute- Execute specific MCP tool
GET /api/repository/:owner/:repo/stats- Get comprehensive repository statisticsGET /api/repository/:owner/:repo/issues- List repository issuesGET /api/repository/:owner/:repo/pulls- List pull requestsGET /api/repository/:owner/:repo/contents/*- Get file contents
GET /api/search/repositories- Search repositories
The application includes several MCP tools for GitHub analysis:
- analyze_repository - Comprehensive repository analysis with AI insights
- get_file_contents - Retrieve file or directory contents
- search_repositories - Search GitHub repositories
- list_issues - List repository issues with filtering
- list_pull_requests - List repository pull requests
- get_repo_stats - Get detailed repository statistics
- Go to GitHub Settings > Developer settings > Personal access tokens
- Click "Generate new token (classic)"
- Select the following scopes:
repo(Full control of private repositories)public_repo(Access public repositories)read:org(Read org and team membership)read:user(Read user profile data)
- Copy the token and add it to your
.envfile
- Go to OpenAI API Keys
- Create a new API key
- Copy the key and add it to your
.envfile
To use this MCP server with Claude Desktop, add the following to your Claude Desktop configuration:
{
"mcpServers": {
"github-analysis": {
"command": "node",
"args": ["path/to/ai_github_analysis/server/mcpServer.js"],
"env": {
"GITHUB_TOKEN": "your_github_token_here",
"OPENAI_API_KEY": "your_openai_api_key_here"
}
}
}
}Try these example queries in the web interface:
- "What programming languages are used in this repository?"
- "How active is this repository? Show me recent activity."
- "What are the most common issues in this repository?"
- "Analyze the code quality and suggest improvements."
- "Show me the top contributors and their contributions."
- "What are the recent pull requests and their status?"
- "How well maintained is this project?"
- "What dependencies does this project use?"
ai_github_analysis/
βββ server/
β βββ index.js # Main Express server
β βββ mcpServer.js # MCP GitHub server implementation
βββ frontend/
β βββ src/
β β βββ App.tsx # Main React application
β βββ package.json # Frontend dependencies
βββ package.json # Backend dependencies
βββ README.md # This file
βββ .env # Environment variables (create this)
npm start- Start both backend and frontendnpm run server- Start backend onlynpm run mcp-server- Run MCP server in CLI modenpm run dev- Start backend with nodemon (development)npm test- Run testsnpm run lint- Run linter
- Node.js Version Error: Ensure you're using Node.js v18 or higher
- GitHub API Rate Limits: Make sure you have a valid GitHub token
- OpenAI API Errors: Verify your OpenAI API key and account has credits
- Port Conflicts: Change the PORT in your
.envfile if 3001 is already in use
Set environment variable DEBUG=true for verbose logging:
DEBUG=true npm run server- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
ISC
For issues and questions, please open a GitHub issue or contact the development team.