@ebowwa/github-search-mcp
v1.0.1
Published
MCP server for comprehensive GitHub search capabilities
Maintainers
Readme
@mcp/github-search
Comprehensive GitHub Search MCP server for code search, repository discovery, and issue tracking.
Overview
This MCP server provides powerful GitHub search capabilities by leveraging the official GitHub REST API via Octokit. It enables intelligent code search, repository discovery, issue tracking, and pull request management directly through the Model Context Protocol.
Features
Search Tools
search_code- Search for code across all GitHub repositoriessearch_repositories- Find repositories by name, description, topics, or contentsearch_issues- Search issues and pull requests across repositoriessearch_users- Find GitHub users by username, email, or namesearch_commits- Search commits within repositories
Repository Tools
get_repository- Get detailed repository informationlist_repositories- List repositories for a user or organizationget_repository_contents- Get contents of a repository directory or fileget_repository_readme- Fetch the README from a repository
Issue & PR Tools
get_issue- Get detailed issue informationlist_issues- List issues in a repositorycreate_issue- Create a new issueget_pull_request- Get detailed PR informationlist_pull_requests- List PRs in a repository
Code Tools
get_file_content- Get raw content of any fileget_commit_info- Get detailed commit informationlist_branches- List branches in a repository
Installation
cd /MCP/packages/github-search
bun installConfiguration
The GitHub Search MCP server supports multiple authentication methods with the following priority:
1. CLI Arguments (Highest Priority)
# Direct token specification
mcp-github-search --github-token ghp_xxxxxxxxxxxx
# Or using Doppler
mcp-github-search --doppler-project my-project --doppler-config prd2. Doppler Integration
Fetch the GitHub token from a Doppler project:
# Using default config (prd)
mcp-github-search --doppler-project my-project
# Using custom config
mcp-github-search --doppler-project my-project --doppler-config devThe server executes: doppler secrets get GITHUB_TOKEN --project <project> --config <config> --plain
3. Environment Variable (Fallback)
# Required: GitHub Personal Access Token
export GITHUB_TOKEN="ghp_..."Configuration Priority
- CLI argument
--github-token(highest priority) - Doppler
--doppler-project(with optional--doppler-config) - Environment variable
GITHUB_TOKEN(fallback)
GitHub Token Permissions:
public_repo- For public repositoriesrepo- For private repositories (full control)read:org- For organization access
Usage
As MCP Server
Add to your Claude Desktop configuration:
{
"mcpServers": {
"github-search": {
"command": "node",
"args": ["/path/to/@mcp/github-search/dist/index.js"],
"env": {
"GITHUB_TOKEN": "ghp_your_token_here"
},
"description": "GitHub search and repository management"
}
}
}Or with CLI arguments:
{
"mcpServers": {
"github-search": {
"command": "node",
"args": ["/path/to/@mcp/github-search/dist/index.js", "--github-token", "ghp_your_token_here"],
"description": "GitHub search and repository management"
}
}
}Or with Doppler:
{
"mcpServers": {
"github-search": {
"command": "node",
"args": ["/path/to/@mcp/github-search/dist/index.js", "--doppler-project", "my-project", "--doppler-config", "prd"],
"description": "GitHub search and repository management"
}
}
}Programmatic Usage
import { GitHubSearchClient } from "./client.js";
// Initialize the client
const client = new GitHubSearchClient({
token: process.env.GITHUB_TOKEN,
});
// Search for code
const codeResults = await client.searchCode({
query: "useState in:file language:typescript",
perPage: 10,
});
// Find repositories
const repos = await client.searchRepositories({
query: "topic:mcp-server stars:>10",
sort: "stars",
order: "desc",
});
// Get repository details
const repo = await client.getRepository({
owner: "microsoft",
repo: "typescript",
});
// Search issues
const issues = await client.searchIssues({
query: "label:bug state:open",
owner: "facebook",
repo: "react",
});
// Get file content
const content = await client.getFileContent({
owner: "vercel",
repo: "next.js",
path: "README.md",
});Architecture
@mcp/github-search
├── src/
│ ├── index.ts # MCP server entry point
│ ├── client.ts # GitHub API client (Octokit wrapper)
│ ├── search.ts # Search-specific implementations
│ └── types.ts # TypeScript types and Zod schemas
├── dist/ # Compiled JavaScript
├── package.json
├── tsconfig.json
└── README.mdTool Definitions
search_code
Search for code across GitHub repositories with advanced filtering.
Parameters:
query(required): Search query (e.g., "useState in:file language:typescript")perPage(optional): Results per page (1-100, default: 30)page(optional): Page number (default: 1)
search_repositories
Find repositories matching criteria.
Parameters:
query(required): Search query (e.g., "topic:react stars:>1000")perPage(optional): Results per page (1-100, default: 30)page(optional): Page numbersort(optional): Sort by stars, forks, help-wanted-issues, updatedorder(optional): asc or desc
search_issues
Search issues and pull requests.
Parameters:
query(required): Search query (e.g., "label:bug state:open")perPage(optional): Results per page (1-100, default: 30)page(optional): Page numbersort(optional): Sort by comments, created, updatedorder(optional): asc or desc
get_repository
Get detailed information about a repository.
Parameters:
owner(required): Repository ownerrepo(required): Repository name
get_file_content
Get raw content of a file.
Parameters:
owner(required): Repository ownerrepo(required): Repository namepath(required): File pathref(optional): Git reference (branch, tag, commit)
Development
# Build the package
bun run build
# Run in watch mode (development)
bun run dev
# Start the MCP server
bun run startSearch Query Syntax
Code Search
useState # Simple keyword
useState in:file # Search in file content
language:typescript # Language filter
repo:facebook/react # Repository filter
org:facebook # Organization filter
filename:useState.ts # Filename filter
extension:ts # Extension filterRepository Search
topic:mcp # Topic filter
stars:>1000 # Stars greater than
forks:true # Forks only
pushed:>2024-01-01 # Last push date
language:typescript # Primary language
size:>1000 # Repository sizeIssue Search
state:open # State filter
label:bug # Label filter
author:username # Author filter
assignee:username # Assignee filter
comments:>5 # Comment count
created:>2024-01-01 # Creation dateRate Limits
GitHub API has rate limits:
- Authenticated requests: 5,000 requests/hour
- Search API: 30 requests/minute
The client automatically handles rate limiting and respects the X-RateLimit-Remaining headers.
Requirements
- Node.js 20+
- GitHub Personal Access Token
- Bun (for development)
Composability
This MCP server is designed to be composable with other MCP servers:
- Use with
@mcp/registryfor package discovery - Combine with
@mcp/tailscalefor private GitHub Enterprise - Integrate with
@mcp/dev-nodefor development workflows
License
MIT
Use Case Examples
See EXAMPLES.md for a comprehensive analysis of the Polymarket & Kalshi prediction market ecosystem using this GitHub Search MCP server.
