Skip to content

Route github.localhost to split-host URLs for local dotcom dev#2672

Draft
owenniblock wants to merge 1 commit into
mainfrom
owenniblock/local-dev-host
Draft

Route github.localhost to split-host URLs for local dotcom dev#2672
owenniblock wants to merge 1 commit into
mainfrom
owenniblock/local-dev-host

Conversation

@owenniblock

Copy link
Copy Markdown
Member

What

Adds a fourth branch to parseAPIHost in pkg/utils/api.go for hostnames matching github.localhost (or any subdomain of it). It mirrors the dotcom split-host layout — REST at api.github.localhost, GraphQL at api.github.localhost/graphql, uploads/raw on their own subdomains, oauth at the apex.

Why

A local dotcom checkout serves its APIs from the same split-host shape as production. But github.localhost doesn't match the github.com or *.ghe.com branches in parseAPIHost, so today it falls through to newGHESHost, which tries /api/v3 and /api/graphql against the apex and gets 404/422 back.

Hit this while testing the multi_select issue field PR (#2659) against local dotcom — without this patch the MCP server can't talk to the local stack at all without modifying parseAPIHost by hand.

Notes

  • Tests cover the new branch and the not-a-subdomain edge case (e.g. notgithub.localhost still routes through GHES).
  • Only handles github.localhost — not bare localhost:port style dev setups. Happy to broaden if anyone is using something different.
  • Draft because I'd like a sanity check from someone closer to local dev tooling before marking ready.
A local dotcom checkout serves its APIs from api.github.localhost,
uploads.github.localhost and raw.github.localhost — the same split-host shape
as production. github.localhost didn't match the github.com or *.ghe.com
branches in parseAPIHost though, so it fell through to newGHESHost, which then
tried /api/v3 and /api/graphql against the apex and got 404/422.

Add a github.localhost branch that mirrors the dotcom layout so the MCP server
can talk to a local dotcom stack without anyone patching parseAPIHost by hand.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@msmahirkingkhan-tech

Copy link
Copy Markdown

"github": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"GITHUB_PERSONAL_ACCESS_TOKEN",
"-e",
"GITHUB_HOST",
"ghcr.io/github/github-mcp-server"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github_token}",
"GITHUB_HOST": "https://"
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants