Skip to content

feat: enterprise host support - #28

Merged
SamMorrowDrums merged 4 commits into
mainfrom
enterprise
Mar 24, 2025
Merged

feat: enterprise host support#28
SamMorrowDrums merged 4 commits into
mainfrom
enterprise

Conversation

@SamMorrowDrums

@SamMorrowDrumsSamMorrowDrums commented Mar 20, 2025

Copy link
Copy Markdown
Collaborator

Adds support for a gh-host param so that enterprises work. Tested it out with failing attempt to call localhost:

go run cmd/github-mcp-server/main.go stdio --gh-host github.localhost

GitHub MCP Server running on stdio
{
"jsonrpc": "2.0",
"id": 3,
"error": {
"code": -32603,
"message": "failed to get user: Get \"https://api.github.localhost/user\": dial tcp [::1]:443: connect: connection refused"
}
}

So the override is working well.

CopilotAI review requested due to automatic review settings March 20, 2025 16:06

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 PR adds rudimentary enterprise support by introducing a new "gh-host" parameter, allowing the GitHub MCP server to direct API calls to GitHub Enterprise endpoints.

  • Added the "gh-host" persistent flag.
  • Bound "gh-host" to viper.
  • Updated the GitHub client to use enterprise-specific base and upload URLs when provided.

Tip: Copilot code review supports C#, Go, Java, JavaScript, Markdown, Python, Ruby and TypeScript, with more languages coming soon. Learn more

Comment threadcmd/github-mcp-server/main.go Outdated
@SamMorrowDrumsSamMorrowDrums changed the title Rudimentary enterprise supportfeat: enterprise host supportMar 20, 2025
@toby

toby commented Mar 20, 2025

Copy link
Copy Markdown
Member

Awesome! Do think it would make sense to support an env var (in addition to or instead of the flag)? Just because we're using them elsewhere.

Comment threadcmd/github-mcp-server/main.go Outdated
Comment on lines +98 to +127
if host := viper.GetString("gh-host"); host != "" {
parsedURL, err := url.Parse(fmt.Sprintf("https://api.%s/", host))
if err != nil {
return fmt.Errorf("failed to parse provided GitHub host URL: %w", err)
}

uploadURL, err := url.Parse(fmt.Sprintf("https://uploads.%s/", host))
if err != nil {
return fmt.Errorf("failed to parse provided GitHub host URL: %w", err)
}

ghClient.BaseURL = parsedURL
ghClient.UploadURL = uploadURL
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe we can use the WithEnterpriseURLs() function in the gogithub.Client instead?

@SamMorrowDrums

Copy link
Copy Markdown
CollaboratorAuthor

Awesome! Do think it would make sense to support an env var (in addition to or instead of the flag)? Just because we're using them elsewhere.

Yeah, that's easy. I was considering doing so too. Just didn't 😅

@juruenjuruen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🚀

Comment threadREADME.md Outdated
@SamMorrowDrums
SamMorrowDrums merged commit 647a5e5 into mainMar 24, 2025
DaleSeo pushed a commit to DaleSeo/github-mcp-server that referenced this pull request Oct 24, 2025
* fix: remove github auth token requirement
imfromfuture3000-Android pushed a commit to imfromfuture3000-Android/github-mcp-server that referenced this pull request Mar 12, 2026
…ons/goreleaser/goreleaser-action-7.0.0
build(deps): bump goreleaser/goreleaser-action from 6.4.0 to 7.0.0
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.

4 participants

@SamMorrowDrums@toby@juruen