GitHub MCP Server - Quick Usage Guide
- `github_search_repositories` - Search for repositories
GitHub MCP Server - Quick Usage Guide
🎯 Available Tools (16 Total)
Repositories (3 tools)
github_search_repositories- Search for repositoriesgithub_list_repositories- List user/org repositoriesgithub_get_repository- Get repository details
Issues (4 tools)
github_list_issues- List repository issuesgithub_get_issue- Get issue detailsgithub_create_issue- Create a new issuegithub_update_issue- Update an existing issue
Pull Requests (4 tools)
github_list_pull_requests- List repository PRsgithub_get_pull_request- Get PR detailsgithub_create_pull_request- Create a new PRgithub_merge_pull_request- Merge a PR
Search (2 tools)
github_search_code- Search code across all repositoriesgithub_search_issues- Search issues across all repositories
Users (1 tool)
github_get_user- Get user profile
Commits (2 tools)
github_list_commits- List repository commitsgithub_get_commit- Get commit details
📝 Usage Examples
Example 1: Search Popular React Repositories
Tool: github_search_repositories
Params: {
query: "stars:>10000 language:react",
per_page: 10,
response_format: "markdown"
}
Example 2: List Issues in a Repository
Tool: github_list_issues
Params: {
owner: "facebook",
repo: "react",
state: "open",
per_page: 20,
response_format: "markdown"
}
Example 3: Create a New Issue
Tool: github_create_issue
Params: {
owner: "owner",
repo: "repo",
title: "Fix authentication bug",
body: "Users cannot login after timeout...",
labels: ["bug", "high-priority"],
assignees: ["developer"]
}
Example 4: List Pull Requests
Tool: github_list_pull_requests
Params: {
owner: "microsoft",
repo: "vscode",
state: "open",
base: "main",
per_page: 10,
response_format: "markdown"
}
Example 5: Search Code
Tool: github_search_code
Params: {
query: "language:typescript useEffect",
per_page: 20,
response_format: "markdown"
}
Example 6: Get User Profile
Tool: github_get_user
Params: {
username: "torvalds",
response_format: "markdown"
}
Example 7: List Commits
Tool: github_list_commits
Params: {
owner: "facebook",
repo: "react",
sha: "main",
per_page: 20,
response_format: "markdown"
}
🔧 Setup Instructions
1. Install Dependencies
cd github-mcp-server
npm install
2. Build Project
npm run build
3. Configure GitHub Token
Create a .env file:
GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxx
Get your token from: https://github.com/settings/tokens
4. Start Server
# stdio mode (for MCP clients)
npm start
# HTTP mode (for web access)
TRANSPORT=http PORT=3000 npm start
5. Test with Inspector
npx @modelcontextprotocol/inspector node dist/index.js
🎨 Response Format Options
All tools support two output formats:
Markdown (default)
- Human-readable formatted text
- Headers, lists, and formatting
- Good for reading by humans
- Example:
response_format: "markdown"
JSON
- Machine-readable structured data
- Complete data objects
- Good for programmatic processing
- Example:
response_format: "json"
⚠️ Common Errors and Solutions
401 - Invalid Token
Error: "Error: Invalid GitHub token"
Solution: Check GITHUB_TOKEN in .env file, ensure it's valid and not expired.
403 - Permission Denied
Error: "Error: Permission denied"
Solution: Your token lacks required permissions. Ensure token has repo scope.
404 - Not Found
Error: "Error: Resource not found" Solution: Check owner, repository name, or issue/PR number for typos.
422 - Validation Error
Error: "Error: Validation failed" Solution: Check input parameters - field lengths, enum values, etc.
429 - Rate Limit
Error: "Error: Rate limit exceeded" Solution: Wait for the reset time shown in the error message. Authenticated requests get 5000/hour.
📊 Rate Limits
| Authentication Type | Limit |
|---|---|
| Authenticated | 5,000 requests/hour |
| Unauthenticated | 60 requests/hour |
| Search API | 30 requests/minute |
🎓 Best Practices
- Use Authentication: Always use a GitHub token for higher rate limits
- Filter Results: Use
per_pageparameter to limit response size - Use Qualifiers: In search queries, use qualifiers like
language:,stars:, etc. - Handle Pagination: Check
has_morefield to determine if more results available - Cache Responses: Cache read-only responses to reduce API calls
- Use JSON Format: For programmatic processing, use
response_format: "json"
🔍 GitHub Search Qualifiers
Repository Search
stars:>1000- Repos with 1000+ starslanguage:typescript- TypeScript repositoriesuser:facebook- Repos by Facebookfork:true- Only forked reposis:public- Only public repos
Issue Search
is:open- Only open issuesis:pr- Only pull requestslabel:bug- Issues with bug labelauthor:username- Issues by specific authorcreated:>2024-01-01- Issues created after date
Code Search
language:python- Python code onlyfilename:package.json- Only package.json filesrepo:facebook/react- Search in specific repoorg:microsoft- Search in Microsoft org repos
Ready to use! Start the server and connect with your MCP client.
Related Documents
Character Persona
**Name:** (set during character creation; must be said like it’s a brand)
DiffusionDB
annotations_creators:
coding: utf-8
from openai import OpenAI
Claude Tool Use (Function Calling) Documentation
Tool use (formerly called function calling) allows Claude to interact with external tools, APIs, and functions. Released on April 4, 2024, and made generally available on May 30, 2024, this feature enables Claude to perform actions beyond text generation.