-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Add GitHub Docs search MCP endpoint #1338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
@crwaters16 from SFO |
Co-authored-by: colindembovsky <1932561+colindembovsky@users.noreply.github.com>
Co-authored-by: colindembovsky <1932561+colindembovsky@users.noreply.github.com>
Co-authored-by: colindembovsky <1932561+colindembovsky@users.noreply.github.com>
|
@sarahs - did Copilot pull in the right docs API to do this? |
|
@copilot make sure the API is using the correct endpoints like this: Examples & reference General REST search overview and guidance: https://docs.github.com/en/rest/search/search |
I implemented a tool that searches GitHub's documentation content at docs.github.com using their search API endpoint ( The current implementation searches the actual documentation articles/guides (similar to the remote-only Did you want me to:
The REST API endpoints you referenced are already implemented in this codebase as |
|
@copilot the doc check is failing: The generated documentation differs from what's committed. go run ./cmd/github-mcp-server generate-docs Then commit the changes. |
Co-authored-by: colindembovsky <1932561+colindembovsky@users.noreply.github.com>
Fixed in commit 93a13ee. Added a case in the Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot the go_lint command is failing in the build: Error: pkg/github/docs_test.go:130:31: Error return value of
Please fix |
Co-authored-by: colindembovsky <1932561+colindembovsky@users.noreply.github.com>
Fixed in commit 8658c22. All linting errors resolved:
The code now passes all lint checks with 0 issues. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new MCP endpoint that wraps the GitHub Docs API, enabling users to search GitHub's official documentation at docs.github.com directly through the MCP server.
Key Changes:
- Adds
search_github_docstool with support for query, version, language, and max_results parameters - Creates new
github_docstoolset (read-only) with comprehensive test coverage - Updates documentation and toolset formatting to properly display "GitHub Docs"
Reviewed Changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/github/docs.go | Implements the search_github_docs tool with API integration and parameter validation |
| pkg/github/docs_test.go | Adds comprehensive unit tests for the new docs search functionality |
| pkg/github/tools.go | Registers the new github_docs toolset and integrates it into the toolset group |
| pkg/github/instructions.go | Adds usage instructions for the github_docs toolset |
| pkg/github/instructions_test.go | Adds test coverage for github_docs toolset instructions |
| pkg/github/toolsnaps/search_github_docs.snap | Snapshot file for tool definition validation |
| cmd/github-mcp-server/generate_docs.go | Adds formatting rule to display "GitHub Docs" instead of "Github Docs" |
| docs/remote-server.md | Documents the new github_docs toolset with installation links |
| README.md | Updates toolset list and adds detailed tool documentation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // #nosec G107 - URL is constructed from validated parameters with proper escaping | ||
| resp, err := http.Get(searchURL) |
Copilot
AI
Oct 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The nosec comment justifies URL construction with proper escaping, but the URL concatenation in line 99-104 uses url.QueryEscape which is intended for query parameter values. For the entire URL construction, consider using url.Values with Encode() or ensure each component is escaped with the appropriate function (e.g., url.PathEscape for path segments if needed).
Create MCP endpoint to wrap GitHub Docs API
Summary
This PR adds a new MCP endpoint that wraps the GitHub Docs API to allow searching GitHub's official documentation at docs.github.com.
Changes Made
New Tool:
search_github_docsquery(required): Search query stringversion(optional): GitHub version (dotcom, ghec, or GHES version like 3.12)language(optional): Language code (en, es, ja, pt, zh, ru, fr, ko, de)max_results(optional): Maximum results to return (1-100, default 10)New Toolset:
github_docs--toolsets=github_docsTests
Documentation
Linting
__Implementation Details
https://docs.github.com/api/search/v1Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.