Provides comprehensive access to GitHub's API, enabling management of repositories, issues, pull requests, commits, user profiles, and statistics. Supports repository search with advanced filters, issue and PR tracking, commit history browsing, and user analytics.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@GitHub MCP TypeScript SDK Servershow me the top 5 TypeScript repositories by stars"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
GitHub MCP TypeScript SDK Server
A comprehensive Model Context Protocol (MCP) server for GitHub that provides access to repositories, issues, pull requests, commits, and user information through a standardized interface. Built with TypeScript and the official MCP SDK.
π Features
π Available Tools (10 Total)
get_my_info- Get information about the authenticated GitHub userget_repo_info- Get detailed information about a GitHub repositorylist_repo_issues- List issues in a repository (with state filtering)list_repo_prs- List pull requests in a repositorylist_repo_commits- List recent commits in a repositorysearch_repositories- Search for repositories on GitHubget_user_info- Get information about any GitHub userlist_user_repos- List repositories belonging to a userget_my_repos- List repositories belonging to the authenticated userget_github_stats- Get comprehensive GitHub statistics for a user
π§ Capabilities
β Repository Information - Name, description, stars, forks, language, visibility
β Issue Management - List, filter, and view issue details
β Pull Request Tracking - View PR status, authors, and details
β Commit History - Browse recent commits with author and message info
β User Profiles - Access user information and statistics
β Repository Search - Advanced search with filters and sorting
β Statistics & Analytics - Comprehensive user and repository metrics
β Error Handling - Robust error handling with descriptive messages
β Natural Language Queries - Ask questions in plain English
π¦ Installation
Prerequisites
Node.js 18+
npm or yarn
GitHub Personal Access Token
Setup
Clone the repository:
git clone <your-repo-url> cd github-mcp-ts-sdkInstall dependencies:
npm installSet up environment variables:
cp env.example .env # Edit .env and add your GitHub tokenBuild the project:
npm run build
π GitHub Token Setup
Click "Generate new token (classic)"
Select the following scopes:
repo(Full control of private repositories)user(Read all user profile data)read:org(Read org and team membership)
Copy the generated token and add it to your
.envfile:
GITHUB_TOKEN=your_github_token_here
GITHUB_USERNAME=your_username_here # Optionalπ Usage
Development Mode
npm run devProduction Mode
npm run build
npm startWatch Mode (for development)
npm run build:watchTest the Server
npm test
npm run simple-test
npm run interactive-test
npm run demoπ Tool Examples
User Information
Get Your GitHub Profile
{
"tool": "get_my_info",
"arguments": {}
}Response:
π€ **My GitHub Profile**
**Username:** Om-Shree-0709
**Name:** Om Shree
**Bio:** Full Stack Developer
**Followers:** 25
**Following:** 50
**Public Repositories:** 15
**Profile URL:** https://github.com/Om-Shree-0709Get User Information
{
"tool": "get_user_info",
"arguments": {
"username": "microsoft"
}
}Repository Information
Get Repository Details
{
"tool": "get_repo_info",
"arguments": {
"owner": "microsoft",
"repo": "vscode"
}
}Response:
π **Repository: microsoft/vscode**
**Description:** Visual Studio Code
**Language:** TypeScript
**Visibility:** public
**Stars:** β 150000
**Forks:** π΄ 25000
**Watchers:** π 5000
**Created:** 1/1/2015
**Updated:** 12/15/2024
**URL:** https://github.com/microsoft/vscodeSearch Repositories
{
"tool": "search_repositories",
"arguments": {
"query": "language:typescript stars:>1000",
"limit": 10
}
}Advanced search examples:
language:javascript- Search by programming languagestars:>5000- Filter by minimum starsuser:octocat- Search within a specific user's repositorieslanguage:python stars:>1000 forks:>100- Combined filterscreated:>2023-01-01- Filter by creation datetopic:react- Search by topic tags
Issues and Pull Requests
List Repository Issues
{
"tool": "list_repo_issues",
"arguments": {
"owner": "facebook",
"repo": "react",
"state": "open"
}
}List Pull Requests
{
"tool": "list_repo_prs",
"arguments": {
"owner": "microsoft",
"repo": "vscode",
"state": "open"
}
}Commit History
List Recent Commits
{
"tool": "list_repo_commits",
"arguments": {
"owner": "nodejs",
"repo": "node",
"limit": 20
}
}Statistics
Get User Statistics
{
"tool": "get_github_stats",
"arguments": {
"username": "torvalds"
}
}Response:
π **GitHub Statistics for torvalds**
**User Info:**
β’ Followers: 50000
β’ Following: 0
β’ Public Repos: 1
**Repository Stats:**
β’ Total Repositories: 1
β’ Total Stars Received: β 200000
β’ Total Forks: π΄ 80000
β’ Average Stars per Repo: 200000.0
**Top Languages:**
C: 1π Resources
Repository Resource
Access repository data via URI: github://repository/{owner}/{repo}
Examples:
github://repository/microsoft/vscodegithub://repository/facebook/react
User Resource
Access user data via URI: github://user/{username}
Examples:
github://user/octocatgithub://user/Om-Shree-0709
π¬ Prompts
Natural Language Queries
Ask questions in natural language about GitHub data:
{
"prompt": "github_query",
"arguments": {
"query": "Show me my most starred repositories"
}
}Supported queries:
"Show me my most starred repositories"
"Search for TypeScript repositories"
"What are the open issues in microsoft/vscode?"
"List my repositories"
"Get statistics for user octocat"
π§ Configuration
Environment Variables
Create a .env file with:
# Required
GITHUB_TOKEN=your_github_token_here
# Optional
GITHUB_USERNAME=your_username_hereGitHub Token Scopes
Your GitHub token needs these scopes:
repo- Full control of private repositoriesuser- Read all user profile dataread:org- Read org and team membership
π Architecture
The server is built using:
TypeScript - Type-safe development
MCP SDK - Model Context Protocol framework
Octokit - Official GitHub API client
Zod - Schema validation
Stdio Transport - Standard input/output communication
Project Structure
src/
βββ server.ts # Main server implementation with all tools and resources
dist/ # Compiled JavaScript
node_modules/ # Dependenciesπ Integration
With Claude Desktop
Add to your Claude Desktop configuration:
{
"mcpServers": {
"github": {
"command": "node",
"args": ["/path/to/your/github-mcp-server/dist/server.js"],
"env": {
"GITHUB_TOKEN": "your_token_here"
}
}
}
}With Other MCP Clients
The server communicates via stdio and follows the MCP protocol specification. It works with any MCP-compatible client that can send JSON-RPC requests.
Direct JSON-RPC Usage
Send JSON-RPC 2.0 requests to your server:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "get_repo_info",
"arguments": {
"owner": "microsoft",
"repo": "vscode"
}
}
}π‘ Error Handling
The server includes comprehensive error handling:
β Authentication errors - Clear messages for invalid tokens
β Rate limiting - Handles GitHub API rate limits gracefully
β Network errors - Robust handling of connection issues
β Validation errors - Input validation with helpful error messages
β GitHub API errors - Detailed error reporting from GitHub
π Performance Features
Efficient API usage - Optimized requests with proper pagination
Caching-friendly - Responses designed for easy caching
Rate limit aware - Respects GitHub API rate limits
Batch operations - Efficient handling of multiple requests
π― Practical Use Cases
1. Repository Research
{"tool": "get_repo_info", "arguments": {"owner": "microsoft", "repo": "vscode"}}
{"tool": "list_repo_issues", "arguments": {"owner": "microsoft", "repo": "vscode", "state": "open"}}
{"tool": "list_repo_prs", "arguments": {"owner": "microsoft", "repo": "vscode", "state": "open"}}2. User Analysis
{"tool": "get_user_info", "arguments": {"username": "torvalds"}}
{"tool": "get_github_stats", "arguments": {"username": "torvalds"}}
{"tool": "list_user_repos", "arguments": {"username": "torvalds", "type": "all"}}3. Project Discovery
{"tool": "search_repositories", "arguments": {"query": "language:typescript stars:>1000"}}
{"tool": "search_repositories", "arguments": {"query": "topic:machine-learning created:>2023-01-01"}}4. Your Own Data
{"tool": "get_my_info", "arguments": {}}
{"tool": "get_my_repos", "arguments": {"type": "all"}}
{"tool": "get_github_stats", "arguments": {"username": "Om-Shree-0709"}}π Development
Available Scripts
npm run build- Build the TypeScript projectnpm run build:watch- Build with file watchingnpm run dev- Run in development modenpm start- Run the compiled servernpm test- Test the servernpm run setup- Run setup scriptnpm run demo- Run demo scriptnpm run interactive-test- Run interactive tests
Adding New Tools
Create a new function in
src/server.tsRegister the tool with
server.registerTool()Add proper error handling
Update this README
Testing
# Build and test
npm run build
npm start
# Test with various scripts
npm test
npm run simple-test
npm run interactive-test
npm run demoπ¨ Troubleshooting
Common Issues
"Cannot find module" errors
Run
npm installto install dependenciesRun
npm run buildto compile TypeScript
Authentication failures
Check your GitHub token is valid
Ensure token has required scopes
Verify
.envfile exists and is readable
Rate limit errors
Wait before making more requests
Consider using a token with higher rate limits
Repository not found
Check owner and repository names are correct
Ensure repository is public or you have access
Debug Mode
Run in development mode for detailed logging:
npm run devπ Response Format
All tools return responses in the MCP standard format with content arrays containing text blocks:
{
"content": [
{
"type": "text",
"text": "π **Repository: microsoft/vscode**\n\n**Description:** Visual Studio Code\n**Stars:** β 150000\n..."
}
]
}π€ Contributing
Fork the repository
Create a feature branch
Add your changes
Test thoroughly
Submit a pull request
π License
MIT License - see LICENSE file for details
π Support
Issues: Report bugs and feature requests via GitHub Issues
Documentation: Check the MCP specification for protocol details
GitHub API: Refer to GitHub's API documentation
π Related Links
Happy coding! π
Your GitHub MCP Server is ready with 10 powerful tools! You can:
β Get any repository information
β Search repositories with advanced filters
β List issues and pull requests
β Browse commit history
β Get user profiles and statistics
β Access your own GitHub data
β Use natural language queries