Skip to content

Commit 0724ae4

Browse files
Merge pull request #103 from 0xRaduan/add-search-for-github
feat(github): Add GitHub Search to Github MCP
2 parents ef1fd93 + 75e7fce commit 0724ae4

File tree

5 files changed

+708
-189
lines changed

5 files changed

+708
-189
lines changed

package-lock.json

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/github/README.md

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
# GitHub MCP Server
22

3-
MCP Server for the GitHub API, enabling file operations, repository management, and more.
3+
MCP Server for the GitHub API, enabling file operations, repository management, search functionality, and more.
44

55
### Features
66

77
- **Automatic Branch Creation**: When creating/updating files or pushing changes, branches are automatically created if they don't exist
88
- **Comprehensive Error Handling**: Clear error messages for common issues
99
- **Git History Preservation**: Operations maintain proper Git history without force pushing
1010
- **Batch Operations**: Support for both single-file and multi-file operations
11+
- **Advanced Search**: Support for searching code, issues/PRs, and users
1112

1213

1314
## Tools
@@ -102,6 +103,60 @@ MCP Server for the GitHub API, enabling file operations, repository management,
102103
- `from_branch` (optional string): Source branch (defaults to repo default)
103104
- Returns: Created branch reference
104105

106+
10. `search_code`
107+
- Search for code across GitHub repositories
108+
- Inputs:
109+
- `q` (string): Search query using GitHub code search syntax
110+
- `sort` (optional string): Sort field ('indexed' only)
111+
- `order` (optional string): Sort order ('asc' or 'desc')
112+
- `per_page` (optional number): Results per page (max 100)
113+
- `page` (optional number): Page number
114+
- Returns: Code search results with repository context
115+
116+
11. `search_issues`
117+
- Search for issues and pull requests
118+
- Inputs:
119+
- `q` (string): Search query using GitHub issues search syntax
120+
- `sort` (optional string): Sort field (comments, reactions, created, etc.)
121+
- `order` (optional string): Sort order ('asc' or 'desc')
122+
- `per_page` (optional number): Results per page (max 100)
123+
- `page` (optional number): Page number
124+
- Returns: Issue and pull request search results
125+
126+
12. `search_users`
127+
- Search for GitHub users
128+
- Inputs:
129+
- `q` (string): Search query using GitHub users search syntax
130+
- `sort` (optional string): Sort field (followers, repositories, joined)
131+
- `order` (optional string): Sort order ('asc' or 'desc')
132+
- `per_page` (optional number): Results per page (max 100)
133+
- `page` (optional number): Page number
134+
- Returns: User search results
135+
136+
## Search Query Syntax
137+
138+
### Code Search
139+
- `language:javascript`: Search by programming language
140+
- `repo:owner/name`: Search in specific repository
141+
- `path:app/src`: Search in specific path
142+
- `extension:js`: Search by file extension
143+
- Example: `q: "import express" language:typescript path:src/`
144+
145+
### Issues Search
146+
- `is:issue` or `is:pr`: Filter by type
147+
- `is:open` or `is:closed`: Filter by state
148+
- `label:bug`: Search by label
149+
- `author:username`: Search by author
150+
- Example: `q: "memory leak" is:issue is:open label:bug`
151+
152+
### Users Search
153+
- `type:user` or `type:org`: Filter by account type
154+
- `followers:>1000`: Filter by followers
155+
- `location:London`: Search by location
156+
- Example: `q: "fullstack developer" location:London followers:>100`
157+
158+
For detailed search syntax, see [GitHub's searching documentation](https://docs.github.com/en/search-github/searching-on-github).
159+
105160
## Setup
106161

107162
### Personal Access Token

0 commit comments

Comments
 (0)