Skip to content

set user agent for client requests #61

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

Merged
merged 1 commit into from
Apr 1, 2025
Merged

set user agent for client requests #61

merged 1 commit into from
Apr 1, 2025

Conversation

mntlty
Copy link
Collaborator

@mntlty mntlty commented Apr 1, 2025

Set a User-Agent "github-mcp-server/1.0" for Client requests.

This overrides https://github.com/google/go-github/blob/0710d0b66118875dd853e35fdbeadf32f0264376/github/github.go#L36 and is set in https://github.com/google/go-github/blob/0710d0b66118875dd853e35fdbeadf32f0264376/github/github.go#L423

I wish there was a way to dynamically set the version, but I don't know of a sane way to pull the GitHub release version so starting with 1.0

With this being built directly in the command I don't have a good way to write a test in code, a future refactor could help with that.

@Copilot Copilot AI review requested due to automatic review settings April 1, 2025 14:39
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 sets a custom User-Agent for GitHub client requests in the github-mcp-server application.

  • Adds a hard-coded User-Agent ("github-mcp-server/1.0") to override the default from the go-github library.
  • Prepares groundwork for potential future refactoring to dynamically set the version.
Comments suppressed due to low confidence (1)

cmd/github-mcp-server/main.go:104

  • [nitpick] Consider defining a constant for the User-Agent string to centralize the version value and simplify future updates.
ghClient.UserAgent = "github-mcp-server/1.0"

Tip: Copilot only keeps its highest confidence comments to reduce noise and keep you focused. Learn more

Copy link
Collaborator

@SamMorrowDrums SamMorrowDrums left a comment

Choose a reason for hiding this comment

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

Thank you so much! I'll revisit the version once the SEMVER stuff is sorted.

@mntlty mntlty merged commit 84ec566 into main Apr 1, 2025
14 checks passed
@mntlty mntlty deleted the add_user_agent branch April 1, 2025 15:54
manian0430 pushed a commit to ChrisLally/github-mcp-server that referenced this pull request Apr 12, 2025
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.

2 participants