Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 11, 2025

This PR implements comprehensive starred repository functionality for the GitHub MCP server, addressing the feature request to enable agents to search and manage starred repositories.

Also removes the github-mcp-server binary, which prob was accidentally commited.

What's Added

New Tools

list_starred_repositories - Lists starred repositories for the authenticated user or a specified user

  • Optional username parameter to list starred repos for any user
  • Sorting options by created (when starred) or updated (when repo was last pushed)
  • Standard pagination support
  • Returns repositories in MinimalRepository format with additional starred_at field

star_repository - Stars a repository

  • Requires owner and repo parameters
  • Returns success confirmation message

unstar_repository - Unstars a repository

  • Requires owner and repo parameters
  • Returns success confirmation message

Implementation Details

  • All tools follow existing patterns and use the same error handling approach
  • Added starred_at field to MinimalRepository struct to track when repositories were starred 🔴
  • Tools are registered in the repos toolset (read-only for listing, write tools for starring/unstarring)
  • Comprehensive test coverage with mocked HTTP clients following existing test patterns
  • Updated README documentation with complete parameter descriptions

Use Cases

This enables powerful agent workflows like:

"Show me my starred Python projects that have been updated recently"
"Star the facebook/react repository for future reference"
"List repositories that @transitive-bullshit has starred, sorted by star count"
"Find my starred machine learning repositories with more than 1000 stars"

API Coverage

Implements GitHub's starred repository REST API endpoints:

  • GET /user/starred - List starred repositories for authenticated user
  • GET /users/{username}/starred - List starred repositories for specific user
  • PUT /user/starred/{owner}/{repo} - Star a repository
  • DELETE /user/starred/{owner}/{repo} - Unstar a repository

The implementation enables agents to leverage users' curated collections of starred repositories as a high-quality signal for dependency selection and project discovery, as mentioned in the original issue.


Additional instructions:

Please take the comments as example and find suitable api endpoints to build the tool from.

  • write tests
  • update the readme doc

Fixes #414


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 4 commits September 11, 2025 14:23
- Add ListStarredRepositories tool for listing starred repos
- Add StarRepository tool for starring repositories
- Add UnstarRepository tool for unstarring repositories
- Update MinimalRepository struct with StarredAt field
- Add comprehensive test coverage for all new functionality
- Register new tools in the repos toolset

Co-authored-by: tonytrg <[email protected]>
- Add list_starred_repositories tool documentation
- Add star_repository tool documentation
- Add unstar_repository tool documentation
- Include comprehensive parameter descriptions for all new tools

Co-authored-by: tonytrg <[email protected]>
@Copilot Copilot AI changed the title [WIP] Starred repo support Add starred repository support to GitHub MCP server Sep 11, 2025
@Copilot Copilot AI requested a review from tonytrg September 11, 2025 14:35
Copilot finished work on behalf of tonytrg September 11, 2025 14:35
@nshaikh99
Copy link

Preparing review...

8 similar comments
@nshaikh99
Copy link

Preparing review...

@nshaikh99
Copy link

Preparing review...

@nshaikh99
Copy link

Preparing review...

@nshaikh99
Copy link

Preparing review...

@nshaikh99
Copy link

Preparing review...

@nshaikh99
Copy link

Preparing review...

@nshaikh99
Copy link

Preparing review...

@nshaikh99
Copy link

Preparing review...

@tonytrg tonytrg marked this pull request as ready for review September 12, 2025 12:49
@tonytrg tonytrg requested a review from a team as a code owner September 12, 2025 12:49
@Copilot Copilot AI review requested due to automatic review settings September 12, 2025 12:49
Copy link
Contributor

@Copilot Copilot AI left a 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 implements comprehensive starred repository functionality for the GitHub MCP server, enabling agents to search and manage starred repositories through natural language interactions.

  • Adds three new tools: list_starred_repositories, star_repository, and unstar_repository
  • Enables listing starred repositories for authenticated users or specific users with pagination and sorting options
  • Provides tools to star and unstar repositories with proper error handling
  • Updates the MinimalRepository struct with starred_at field for tracking when repositories were starred

Reviewed Changes

Copilot reviewed 7 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/github/tools.go Registers the new starred repository tools in the repos toolset
pkg/github/repositories.go Implements the three new starred repository functions with GitHub API integration
pkg/github/repositories_test.go Adds comprehensive test coverage for all three new tools
pkg/github/toolsnaps/*.snap Creates tool snapshots for testing and validation
README.md Documents the new tools with parameter descriptions

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +1771 to +1796
// Convert to minimal format
minimalRepos := make([]MinimalRepository, 0, len(repos))
for _, starredRepo := range repos {
repo := starredRepo.Repository
minimalRepo := MinimalRepository{
ID: repo.GetID(),
Name: repo.GetName(),
FullName: repo.GetFullName(),
Description: repo.GetDescription(),
HTMLURL: repo.GetHTMLURL(),
Language: repo.GetLanguage(),
Stars: repo.GetStargazersCount(),
Forks: repo.GetForksCount(),
OpenIssues: repo.GetOpenIssuesCount(),
Private: repo.GetPrivate(),
Fork: repo.GetFork(),
Archived: repo.GetArchived(),
DefaultBranch: repo.GetDefaultBranch(),
}

if repo.UpdatedAt != nil {
minimalRepo.UpdatedAt = repo.UpdatedAt.Format("2006-01-02T15:04:05Z")
}

minimalRepos = append(minimalRepos, minimalRepo)
}
Copy link
Preview

Copilot AI Sep 12, 2025

Choose a reason for hiding this comment

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

The MinimalRepository struct is missing a StarredAt field that should be populated from starredRepo.StarredAt. The PR description mentions adding a starred_at field to track when repositories were starred, but this field is not being set in the conversion logic.

Copilot uses AI. Check for mistakes.

@tonytrg
Copy link
Contributor

tonytrg commented Sep 12, 2025

I removed the starred_at attribute from the minimal struct as i dont think this field is really needed often in 99% of all cases.

@tonytrg tonytrg merged commit 010cf9b into main Sep 12, 2025
16 checks passed
@tonytrg tonytrg deleted the copilot/fix-8d6e5df9-0eeb-4cf4-8638-d63fe34060bb branch September 12, 2025 14:11
@khowhom172-del
Copy link

This PR implements comprehensive starred repository functionality for the GitHub MCP server, addressing the feature request to enable agents to search and manage starred repositories.

Also removes the github-mcp-server binary, which prob was accidentally commited.

What's Added

New Tools

list_starred_repositories - Lists starred repositories for the authenticated user or a specified user

  • Optional username parameter to list starred repos for any user
  • Sorting options by created (when starred) or updated (when repo was last pushed)
  • Standard pagination support
  • Returns repositories in MinimalRepository format with additional starred_at field

star_repository - Stars a repository

  • Requires owner and repo parameters
  • Returns success confirmation message

unstar_repository - Unstars a repository

  • Requires owner and repo parameters
  • Returns success confirmation message

Implementation Details

  • All tools follow existing patterns and use the same error handling approach
  • Added starred_at field to MinimalRepository struct to track when repositories were starred 🔴
  • Tools are registered in the repos toolset (read-only for listing, write tools for starring/unstarring)
  • Comprehensive test coverage with mocked HTTP clients following existing test patterns
  • Updated README documentation with complete parameter descriptions

Use Cases

This enables powerful agent workflows like:

"Show me my starred Python projects that have been updated recently"
"Star the facebook/react repository for future reference"
"List repositories that @transitive-bullshit has starred, sorted by star count"
"Find my starred machine learning repositories with more than 1000 stars"

API Coverage

Implements GitHub's starred repository REST API endpoints:

  • GET /user/starred - List starred repositories for authenticated user
  • GET /users/{username}/starred - List starred repositories for specific user
  • PUT /user/starred/{owner}/{repo} - Star a repository
  • DELETE /user/starred/{owner}/{repo} - Unstar a repository

The implementation enables agents to leverage users' curated collections of starred repositories as a high-quality signal for dependency selection and project discovery, as mentioned in the original issue.

Additional instructions:

Please take the comments as example and find suitable api endpoints to build the tool from.

  • write tests
  • update the readme doc

Fixes #414

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@khowhom172-del
Copy link

vf

nickytonline pushed a commit to nickytonline/github-mcp-http that referenced this pull request Oct 4, 2025
* Initial plan

* Initial exploration and planning for starred repository support

Co-authored-by: tonytrg <[email protected]>

* Implement starred repository functionality with comprehensive tests

- Add ListStarredRepositories tool for listing starred repos
- Add StarRepository tool for starring repositories
- Add UnstarRepository tool for unstarring repositories
- Update MinimalRepository struct with StarredAt field
- Add comprehensive test coverage for all new functionality
- Register new tools in the repos toolset

Co-authored-by: tonytrg <[email protected]>

* Update README documentation with starred repository tools

- Add list_starred_repositories tool documentation
- Add star_repository tool documentation
- Add unstar_repository tool documentation
- Include comprehensive parameter descriptions for all new tools

Co-authored-by: tonytrg <[email protected]>

* Add starred repository support to GitHub MCP server

Co-authored-by: tonytrg <[email protected]>

* remove starredat from minimal view

* update descriptions

* remove bin

* dont commit the binary

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: tonytrg <[email protected]>
Co-authored-by: tonytrg <[email protected]>
Sign up for free to 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.

Starred repo support
4 participants