-
Notifications
You must be signed in to change notification settings - Fork 3k
Update mcp server with latest google/go-github API #1358
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
Conversation
e7f625a to
a6d80e1
Compare
0a402d8 to
fc1471d
Compare
a6d80e1 to
fcf7fd5
Compare
fc1471d to
fce10ae
Compare
fcf7fd5 to
5a4a278
Compare
5a4a278 to
4d6a90a
Compare
4c97a67 to
b1183b4
Compare
eac7899 to
3e3ab15
Compare
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 pull request refactors GitHub Projects V2 API integration by migrating from manual HTTP request construction to using the go-github SDK's native client methods, and updates field ID handling to use int64 instead of strings.
- Introduces
RequiredBigIntandOptionalBigIntArrayParamhelper functions to handle large integer field/item IDs - Migrates multiple project-related functions to use go-github SDK methods (ListProjectFields, GetProjectField, ListProjectItems, AddProjectItem, DeleteProjectItem)
- Updates field ID representation from
[]stringto[]int64with comma-separated URL encoding
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| pkg/github/server.go | Adds helper functions for handling large integers (RequiredBigInt, OptionalBigIntArrayParam) and conversion utilities for string-to-int64 conversion |
| pkg/github/projects.go | Migrates project API calls to use go-github SDK methods, updates data structures to use int64 for IDs, and removes obsolete custom types now replaced by SDK types |
| pkg/github/projects_test.go | Updates test assertions to check for comma-separated field parameters instead of array-style parameters |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
| projectItems := []projectV2Item{} | ||
| var resp *github.Response | ||
| var projectItems []*github.ProjectV2Item |
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.
Standardized field parameters has changed from array notation (fields[]=123&fields[]=456) to comma-separated format (fields=123,456,789).
Why this change was needed:
- The comma-separated format is handled natively by the
github.com/google/go-querystringlibrary using the,commatag option - Eliminates manual URL encoding complexity in our code
- Better aligns with Go's standard query parameter handling patterns
- Our tests in
projects_test.goconfirm the comma format works correctly:fieldParams == "123,456,789"
Technical details: The fieldSelectionOptions struct now uses url:"fields,omitempty,comma" which leverages go-querystring's built-in comma support rather than custom array parameter logic.
See ListProjectItemsOptions struct
// ListProjectItemsOptions specifies optional parameters when listing project items.
// Note: Pagination uses before/after cursor-style pagination similar to ListProjectsOptions.
// "Fields" can be used to restrict which field values are returned (by their numeric IDs).
type ListProjectItemsOptions struct {
// Embed ListProjectsOptions to reuse pagination and query parameters.
ListProjectsOptions
// Fields restricts which field values are returned by numeric field IDs.
Fields []int64 `url:"fields,omitempty,comma"`
}I have also updated this internally to align the MCP server with the underlying google/go-github dependency since we're not quite ready to migrate GetProjectItem yet as per this PR's description.
| fieldParams := q["fields"] | ||
| if len(fieldParams) == 3 && fieldParams[0] == "123" && fieldParams[1] == "456" && fieldParams[2] == "789" { | ||
| fieldParams := q.Get("fields") | ||
| if fieldParams == "123,456,789" { |
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.
see this comment in relation to this change.
b1183b4 to
fab59eb
Compare
0743dcb to
fd09a4a
Compare
…of Update and Delete items
… underlying library implementation
fd09a4a to
7cb55a6
Compare
kerobbi
left a comment
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.
Lgtm!
Towards https://github.com/github/memex/issues/20995
Depends on #1357
Overview
This PR updates the MCP server to utilize the latest
google/go-githubAPI for interacting with GitHub projects, more specifically the ability to perform CRUD operations introduced ingoogle/go-github@V77.Details
google/go-githublibrary, replacing previous implementations.Outstanding Work
The only toolsets that have not yet been migrated to use
google/go-githubare:GetProjectItemandUpdateProjectItem.This is due to notable differences in parameter handling between the
google/go-githublibrary and GitHub's RESTful API. Specifically, the way parameters must be passed for these endpoints does not fully align with the current library's abstractions, making a straightforward migration infeasible.I am actively working to resolve these discrepancies and plan to make further adjustments within
google/go-githubto support these use cases.Update:
I have opened google/go-github#3809 to resolve issues with
GetProjectItemandUpdateProjectItemthat came up during integration. The PR is ready for review and currently waiting on maintainers’ input.Next Steps
GetProjectItemandUpdateProjectItemby contributing necessary changes upstream.