Skip to content

Update mcp server with latest google/go-github API - #1358

Merged
kerobbi merged 17 commits into
mainfrom
stephenotalora/update-mcp-api
Nov 7, 2025
Merged

Update mcp server with latest google/go-github API#1358
kerobbi merged 17 commits into
mainfrom
stephenotalora/update-mcp-api

Conversation

@stephenotalora

@stephenotalorastephenotalora commented Nov 4, 2025

Copy link
Copy Markdown
Contributor

Towards https://github.com/github/memex/issues/20995
Depends on #1357

Overview

This PR updates the MCP server to utilize the latest google/go-github API for interacting with GitHub projects, more specifically the ability to perform CRUD operations introduced in google/go-github@V77.

Details

  • Most API integrations have been refactored to use the google/go-github library, replacing previous implementations.
  • The migration was applied across all relevant endpoints and toolsets to ensure consistent usage of the new API client.

Outstanding Work

The only toolsets that have not yet been migrated to use google/go-github are:

  • GetProjectItem and
  • UpdateProjectItem.

This is due to notable differences in parameter handling between the google/go-github library 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-github to support these use cases.

Update:

I have opened google/go-github#3809 to resolve issues with GetProjectItem and UpdateProjectItem that came up during integration. The PR is ready for review and currently waiting on maintainers’ input.

Next Steps

  • Complete functional parity for GetProjectItem and UpdateProjectItem by contributing necessary changes upstream.
  • Monitor for any new breaking changes as GitHub's API evolves.

@stephenotalora
stephenotaloraforce-pushed the stephenotalora/update-mcp-api branch from e7f625a to a6d80e1CompareNovember 4, 2025 21:22
@stephenotalora
stephenotaloraforce-pushed the stephenotalora/mcp-projects-v77 branch 2 times, most recently from 0a402d8 to fc1471dCompareNovember 4, 2025 21:27
@stephenotalora
stephenotaloraforce-pushed the stephenotalora/update-mcp-api branch from a6d80e1 to fcf7fd5CompareNovember 4, 2025 21:30
@stephenotalora
stephenotaloraforce-pushed the stephenotalora/mcp-projects-v77 branch from fc1471d to fce10aeCompareNovember 4, 2025 21:31
@stephenotalora
stephenotaloraforce-pushed the stephenotalora/update-mcp-api branch from fcf7fd5 to 5a4a278CompareNovember 4, 2025 21:32
@stephenotalora
stephenotaloraforce-pushed the stephenotalora/update-mcp-api branch from 5a4a278 to 4d6a90aCompareNovember 4, 2025 22:09
@stephenotalorastephenotalora changed the title Stephenotalora/update mcp apiUpdate mcp server with latest google/go-github APINov 5, 2025
@stephenotalora
stephenotaloraforce-pushed the stephenotalora/mcp-projects-v77 branch from 4c97a67 to b1183b4CompareNovember 5, 2025 18:55
@stephenotalora
stephenotaloraforce-pushed the stephenotalora/update-mcp-api branch from eac7899 to 3e3ab15CompareNovember 5, 2025 19:13
@stephenotalorastephenotalora self-assigned this Nov 5, 2025
@stephenotalora
stephenotalora marked this pull request as ready for review November 6, 2025 17:56
@stephenotalora
stephenotalora requested a review from a team as a code ownerNovember 6, 2025 17:56
CopilotAI review requested due to automatic review settings November 6, 2025 17:56

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

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 RequiredBigInt and OptionalBigIntArrayParam helper 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 []string to []int64 with comma-separated URL encoding

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

FileDescription
pkg/github/server.goAdds helper functions for handling large integers (RequiredBigInt, OptionalBigIntArrayParam) and conversion utilities for string-to-int64 conversion
pkg/github/projects.goMigrates 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.goUpdates 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.

Comment threadpkg/github/server.go Outdated
Comment threadpkg/github/server.go Outdated
Comment threadpkg/github/server.go Outdated
Comment threadpkg/github/projects.go Outdated
Comment threadpkg/github/server.go Outdated
@stephenotalora
stephenotalora marked this pull request as draft November 6, 2025 18:48
}
projectItems := []projectV2Item{}
var resp *github.Response
var projectItems []*github.ProjectV2Item

@stephenotalorastephenotaloraNov 6, 2025

Copy link
Copy Markdown
ContributorAuthor

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-querystring library using the ,comma tag option
  • Eliminates manual URL encoding complexity in our code
  • Better aligns with Go's standard query parameter handling patterns
  • Our tests in projects_test.go confirm 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).typeListProjectItemsOptionsstruct {
// 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" {

Copy link
Copy Markdown
ContributorAuthor

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.

@stephenotalora
stephenotalora marked this pull request as ready for review November 6, 2025 19:56
@stephenotalora
stephenotaloraforce-pushed the stephenotalora/mcp-projects-v77 branch from b1183b4 to fab59ebCompareNovember 6, 2025 20:02
@stephenotalora
stephenotaloraforce-pushed the stephenotalora/update-mcp-api branch from 0743dcb to fd09a4aCompareNovember 6, 2025 20:03
Base automatically changed from stephenotalora/mcp-projects-v77 to mainNovember 7, 2025 16:06
@stephenotalora
stephenotaloraforce-pushed the stephenotalora/update-mcp-api branch from fd09a4a to 7cb55a6CompareNovember 7, 2025 17:01

@kerobbikerobbi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm!

@kerobbi
kerobbi merged commit b68bec0 into mainNov 7, 2025
16 checks passed
@kerobbi
kerobbi deleted the stephenotalora/update-mcp-api branch November 7, 2025 17:31
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@stephenotalora@kerobbi