The Github MCP Server enables Language Learning Models (LLMs) to interact with Github repositories, issues, pull requests, and more through the Model Context Protocol. This integration allows AI assistants like Claude to search and retrieve information directly from Github's vast ecosystem.
Add the server configuration to Claude Desktop:
For MacOS:
Edit the file at: ~/Library/Application Support/Claude/claude_desktop_config.json
For Windows: Follow the configuration guide here
Add the following JSON configuration:
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "github-mcp-server"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "your_personal_github_access_token"
}
}
}
}
Be sure to replace your_personal_github_access_token
with your actual Github token.
search_repositories
Search Github for repositories matching specific criteria.
Required inputs:
query
(string): The search query for repositoriespage
(number, default: 30, max: 100): Page number for paginationper_page
(number, default: 30, max: 100): Number of results per pagesearch_issues
Search for issues across Github repositories.
Required inputs:
query
(string): The search query for issuespage
(number, default: 1): Page number for paginationper_page
(number, default: 30, max: 100): Number of results per pageorder
(optional string, default: desc
): Sort order (asc
or desc
)sort
(optional string): Sort field (options include: comments
, reactions
, created
, updated
, etc.)search_commits
Search for commits across Github repositories.
Required inputs:
query
(string): The search query for commitspage
(number, default: 1): Page number for paginationper_page
(number, default: 30, max: 100): Results per pageorder
(optional string, default: desc
): Sort order (asc
or desc
)sort
(optional string): Sort field (committer-date
or author-date
)search_code
Search for code across Github repositories.
Required inputs:
query
(string): The search query for code snippetspage
(number, default: 1): Page number for paginationper_page
(number, default: 30, max: 100): Results per pagesearch_users
Search for Github users.
Required inputs:
query
(string): The search query for userspage
(number, default: 1): Page number for paginationper_page
(number, default: 30, max: 100): Results per pageorder
(optional string, default: desc
): Sort order (asc
or desc
)sort
(optional string): Sort field (options: followers
, repositories
, or joined
)search_topics
Search for topics on Github.
Required inputs:
query
(string): The search query for topicspage
(number, default: 1): Page number for paginationper_page
(number, default: 30, max: 100): Results per pagesearch_labels
Search for labels in repositories.
Required inputs:
query
(string): The search query for labelspage
(number, default: 1): Page number for paginationper_page
(number, default: 30, max: 100): Results per pageorder
(optional string, default: desc
): Sort order (asc
or desc
)sort
(optional string): Sort field (options: created
or updated
)list_repositories_issues
List issues from a specific repository.
Required inputs:
owner
(string): The repository ownerrepo
(string): The repository namepage
(optional number, default: 1): Page number for paginationper_page
(optional number, default: 30, max: 100): Results per pagedirection
(optional string, default: desc
): Sort directionsort
(optional string, default: created
): Sort fieldsince
, labels
, milestone
, assignee
, creator
, mentioned
get_issue
Get detailed information about a specific issue.
Required inputs:
owner
(string): The repository ownerrepo
(string): The repository nameissue_number
(number): The issue numberlist_repositories_pull_requests
List pull requests from a specific repository.
Required inputs:
owner
(string): The repository ownerrepo
(string): The repository namepage
(optional number, default: 1): Page number for paginationper_page
(optional number, default: 30, max: 100): Results per pagedirection
(optional string, default: desc
): Sort directionsort
(optional string, default: created
): Sort fieldhead
(optional string): Filter by head user/org and branchbase
(optional string): Filter by base branch nameget_pull_request
Get detailed information about a specific pull request.
Required inputs:
owner
(string): The repository ownerrepo
(string): The repository namepull_request_number
(number): The pull request numberHere are some example prompts you can use with Claude after setting up the Github MCP server:
Search for repositories: "Find repositories related to modelcontextprotocol"
Get issue details: "What is issue #739 on the modelcontextprotocol servers repo?"
Examine pull requests: "Show me details about PR #717 on the modelcontextprotocol servers repo"
Search for code: "Find code examples that use the Github API in Javascript"
Find users: "Search for Github users who contribute to AI repositories"
These prompts will trigger the appropriate tools to fetch information directly from Github and present it within your conversation.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.