CodeQL / Analyze (actions) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Docker / build (push) Has been cancelled
Build and Test Go Project / build (macos-latest) (push) Has been cancelled
Build and Test Go Project / build (ubuntu-latest) (push) Has been cancelled
Build and Test Go Project / build (windows-latest) (push) Has been cancelled
GoReleaser Release / release (push) Has been cancelled
MCP Server Diff / mcp-diff (push) Has been cancelled
MCP Server Diff / mcp-diff-http (push) Has been cancelled
Publish to MCP Registry / publish (push) Has been cancelled
* Add repo-scoped support to list_issue_types tool
* Render multi-scope tools as "any of" in generated docs
* Clarify issue type field description for repo-scoped list_issue_types
* errors: improve rate limit error messages for AI agents
When the GitHub API returns a rate limit error, replace the raw Go HTTP
error string with a clean, actionable message so agents know exactly
how long to wait before retrying.
Before:
search code: GET https://api.github.com/search/code: 403 API rate
limit exceeded for user ID 12345. [rate reset in 2m59s]
After:
search code: GitHub API rate limit exceeded. Retry after 2m59s.
create issue: GitHub secondary rate limit exceeded. Retry after 47s.
create issue: GitHub secondary rate limit exceeded. Wait before retrying.
Edge cases: expired/zero reset time, nil RetryAfter, and errors
wrapped with errors.As all produce "Wait before retrying." rather
than a negative or confusing duration.
The original error is stored in context via addGitHubAPIErrorToContext
before the rate-limit check, so middleware is unaffected.
Fixes#2385.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* errors: fix flaky rate limit tests
Compute expectedRetryIn before calling the function under test,
and use larger reset time offsets (20-30 min), so a 1s boundary
during time.Duration.Round cannot cause spurious mismatches.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* errors: extract requireErrorText and assertContextHasError test helpers
Reduces repetition in TestNewGitHubAPIErrorResponse_RateLimits subtests.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix edge cases: sub-second rate limit durations and UTF-8 BOM
- Primary rate limit: compute time.Until(resetTime) once and check the
rounded result is >0 before showing 'Retry after X'. This avoids a
TOCTOU race between the After(time.Now()) guard and the subsequent
time.Until call, and prevents showing 'Retry after 0s.' when the
reset time is imminent.
- Secondary rate limit: round RetryAfter first, then check >0.
Previously, a RetryAfter of e.g. 200ms would pass the >0 guard
but format as 'Retry after 0s.' after rounding.
- Add tests for both sub-second edge cases.
- Remove UTF-8 BOM accidentally introduced in error_test.go by
.NET WriteAllText with the default UTF8 encoding.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Breaking changes addressed:
- raw.NewClient: Use WithHTTPClient/WithEnterpriseURLs options, pass ctx to
NewRequest, return (*Client, error)
- internal/ghmcp/server.go: Use functional options for REST client creation,
replace UserAgent field mutation with UserAgentTransport wrapper, add
restUATransp field to githubClients struct
- pkg/github/dependencies.go: Use functional options for REST client creation,
handle raw.NewClient error return
- pkg/github/actions.go: Handle new WorkflowDispatchRunDetails return value
from CreateWorkflowDispatchEventByID/ByFileName
- pkg/github/issues.go: Replace IssueListOptions with ListOptions for
SubIssue.ListByIssue
- pkg/github/notifications.go: MarkThreadDone now takes string instead of
int64; remove ParseInt and strconv import
- pkg/github/projects.go: Remove pointer indirection from
ListProjectsPaginationOptions and ListProjectsOptions fields
- pkg/github/issues_granular.go: Pass ctx to NewRequest, remove ctx from Do
- Test files: Add mustNewGHClient helper, replace all NewClient calls,
fix stubClientFnFromHTTP signature, fix lockdown_test.go BaseURL handling,
fix raw_test.go, remove invalid threadID test case
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Bump google/go-github
* chore: regenerate license files
Auto-generated by license-check workflow
* Fix required block
* Go mod vendor and tidy again
* Remove unused fatih/color dependency to fix CI (#2005)
* Initial plan
* Remove unused github.com/fatih/color dependency
The fatih/color package was listed in go.mod but not actually imported
or used anywhere in the codebase. This caused the CI "go mod tidy -diff"
check to fail. Running go mod tidy removed:
- github.com/fatih/color v1.18.0
- github.com/mattn/go-colorable v0.1.13 (transitive)
- github.com/mattn/go-isatty v0.0.20 (transitive)
Fixes the failing ubuntu-latest workflow build.
Co-authored-by: JoannaaKL <67866556+JoannaaKL@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: JoannaaKL <67866556+JoannaaKL@users.noreply.github.com>
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
* Add raw client error annotation and annotate GetFileContents
* Track response.
* add raw errors to context
* add raw api error test
* Update pkg/errors/error.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Add blank line after Error() method for readability
* add NewGitHubRawAPIErrorResponse back
---------
Co-authored-by: Matt Holloway <mattdholloway@pm.me>
Co-authored-by: Matt Holloway <mattdholloway@github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Add NewGitHubAPIStatusErrorResponse helper function to properly track
GitHub API errors when the API call succeeds but returns an unexpected
HTTP status code (e.g., 404, 422, 500).
Previously, these errors were returned via utils.NewToolResultError which
bypasses the context-based error tracking used by the remote server's
error_categorizer.go for observability metrics. This resulted in 100%
tool call success rates in observability even when errors occurred.
The fix adds a new helper function that:
1. Creates a synthetic error from the status code and response body
2. Records the error in context via NewGitHubAPIErrorResponse
3. Returns the MCP error result to the client
Updated all tool files to use the new pattern for status code errors:
- pullrequests.go: 12 fixes
- repositories.go: 18 fixes
- issues.go: 10 fixes
- notifications.go: 6 fixes
- projects.go: 5 fixes
- search.go: 3 fixes
- search_utils.go: 1 fix
- gists.go: 4 fixes
- code_scanning.go: 2 fixes
- dependabot.go: 2 fixes
- secret_scanning.go: 2 fixes
- security_advisories.go: 4 fixes
Total: ~69 error paths now properly tracked.
Note: Parameter validation errors (RequiredParam failures) and internal
I/O errors (io.ReadAll failures) intentionally continue to use
utils.NewToolResultError as they are not GitHub API errors.
* updates github-mcp-server to go-github/v76
* updates license files
* refactors ListProjects to make use of
google/go-github ProjectsService
* refactors GetProject to make use of google/go-github ProjectsService
* declaring commit without a pointer
* cleanup additional commit pointer
---------
Co-authored-by: Tommaso Moro <37270480+tommaso-moro@users.noreply.github.com>