How to Fix “Failed to Connect to MCP Server” Errors with github-mcp-server
Diagnose github-mcp-server connection errors with entry checks, logs, auth tests, and cautious fixes for Copilot CLI and Codex.
Short answer: “Failed to connect to MCP server ‘github-mcp-server’” is a symptom, not a diagnosis. In GitHub Copilot CLI, start with /mcp show github-mcp-server, record the entry’s type, URL, status, and error, then read the client log. Check whether a workspace server named github and a built-in github-mcp-server are both present, and verify the credential environment variable used by the client that actually launches the server.
The available evidence is mostly user-reported GitHub issue data. It documents several configurations and a Windows fetch failed report, but it does not establish one universal cause or confirmed fix for every client.
1. Identify the failing entry first
Run the command named by the Copilot CLI error:
/mcp show github-mcp-server
Record the exact entry name, scope or source, transport/type, endpoint URL, reported status, and complete error text. A March 2026 Copilot CLI report showed an HTTP entry at https://api.business.githubcopilot.com/mcp/readonly with status failed and error fetch failed. Treat that as an example of what to inspect, not as the endpoint every account should use. [Issue #2282]
2. Build an entry inventory when names are confusing
Clients can show more than one GitHub MCP entry. One Copilot CLI report described a workspace entry named github at https://api.githubcopilot.com/mcp/ alongside a separate built-in github-mcp-server entry at an enterprise read-only endpoint. The author reported that the workspace entry failed while the built-in one appeared operational. Compare entries by all five fields below; the generic label “GitHub MCP” is not enough. [Issue #1807]
| Field | What to compare | Why it matters |
|---|---|---|
| Name | github vs github-mcp-server |
The error may identify only one entry. |
| Scope | Workspace, user, or built-in | Different scopes can load different configuration. |
| URL | Exact host, path, and read-only suffix | Enterprise and public endpoints are not interchangeable assumptions. |
| Transport/type | HTTP, stdio, or displayed type | Each transport has different logs and credentials. |
| Status/error | Failed, unauthorized, timeout, or another value | Use the precise error to choose the next check. |
3. Read the full client log
The short banner hides useful context. Look for lines around server startup, transport closure, HTTP status, and credential loading. A Windows report against Copilot CLI 1.0.51 recorded the remote client starting, the transport closing, and then TypeError: fetch failed. The report does not prove whether the failure was authentication, TLS, a client regression, or another condition. [Issue #3455]
Keep the client version, operating system, entry name, endpoint path, and timestamp with the excerpt. Remove tokens before sharing logs.
4. Check authentication in the configuration actually loaded
Inspect the environment of the process that launches your MCP client. A documented Codex report failed because the configured bearer-token environment variable was unset; its sample configuration used bearer_token_env_var. This is a concrete example of a missing variable in one client setup, not proof that every Copilot CLI fetch failed has the same cause. [GitHub MCP Server issue #1633]
# POSIX shells: replace GITHUB_TOKEN_ENV with the variable your client names
printf 'set=%s\n' "${GITHUB_TOKEN_ENV:+yes}"
[ -n "$GITHUB_TOKEN_ENV" ] && echo "token is available" || echo "token is missing"
# PowerShell
if ($env:GITHUB_TOKEN_ENV) { 'token is available' } else { 'token is missing' }
Do not print the token value. If the variable is set in a shell profile, IDE, or service manager, restart the client from that same environment after changing it.
5. Separate reachability from authentication
In the Windows 1.0.51 report, the author said curl and ordinary Node fetch requests returned HTTP 401 and treated that as evidence that the endpoint was reachable. They also reported trying a fresh login and Node’s system-CA option without resolving the CLI error. Those are the reporter’s observations, not an official diagnostic guarantee or complete test of the CLI request path. [Issue #3455]
# Reachability probe only; do not put secrets in shell history
curl -i https://YOUR-OBSERVED-ENDPOINT
node -e "fetch('https://YOUR-OBSERVED-ENDPOINT').then(r=>console.log(r.status)).catch(e=>{console.error(e); process.exit(1)})"
An HTTP response, including 401, shows that some request reached a server. It does not validate the MCP client’s headers, token, URL path, TLS settings, or transport negotiation. Compare the probe URL with the URL printed by /mcp show.
6. Check version and issue status before changing versions
Record the client version and platform. The Windows case was filed against Copilot CLI 1.0.51 on May 21, 2026 and remained open in the reviewed material. It does not confirm a regression or name a maintainer-confirmed fix. Check the current issue and release notes before recommending an upgrade or downgrade. [Issue #3455]
7. Decision tree
- Entry not found: inspect workspace and built-in configuration, then use the exact name reported by the client.
- Wrong URL or scope: compare the configured endpoint character by character with the entry shown by
/mcp show. - Variable missing: define the variable named by that client’s configuration and restart it from the same environment.
- HTTP 401/403: verify the credential source and account context; do not assume a relogin or different endpoint is universally required.
- TLS or network error: compare logs with a reachability probe, proxy settings, and the operating system certificate path.
fetch failedwith no clear cause: preserve the full log, version, OS, entry details, and timestamp; check the current upstream issue status.
8. Common errors and fixes
| Symptom | Evidence scope | Action |
|---|---|---|
Failed to connect ... github-mcp-server |
Banner is insufficient. | Run /mcp show github-mcp-server and read logs. |
fetch failed on Windows |
Reported with Copilot CLI 1.0.51; cause unconfirmed. | Record version, endpoint, full error, and check the open issue. |
| One GitHub entry fails while another works | Reported with workspace and built-in entries. | Compare name, scope, URL, type, and status separately. |
| Environment variable was not set | Documented in a Codex configuration report. | Set the exact variable expected by that client and restart it. |
| Probe returns 401 | Reporter observed this while testing reachability. | Use it only to show a response arrived; verify client auth independently. |
9. Prepare a safe issue report
- Client name and exact version.
- Operating system and launch context.
- Entry name, scope, type, and endpoint path, without secrets.
- Output of the server-inspection command.
- Relevant log lines, including nested error causes.
- Whether a separate entry works.
- What changed immediately before the failure.
GitHub’s official project is github/github-mcp-server. Use its current documentation and issue tracker for client-specific configuration; the reports above are case evidence, not universal support policy.
10. Or skip the browser setup
If your goal is to capture a page for an agent, visual regression check, or issue report rather than debug the MCP connection, ScreenshotNeo provides a direct screenshot API and an MCP server. One GET request returns PNG, JPEG, WebP, or PDF. Before capture it accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be disabled.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
See the ScreenshotNeo API documentation for request options. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed; response headers identify the page verdict and whether the request was billed. Its MCP server includes take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000.
Create a free ScreenshotNeo account and start with the 1,000 no-card screenshots.
11. Performance, reliability, and cost notes
- Keep diagnostics small: one entry, one endpoint, one timestamp, and surrounding log lines.
- A successful curl response does not prove the MCP transport, headers, or token are correct.
- Do not rotate credentials or change endpoints blindly; preserve the failing configuration for comparison.
- ScreenshotNeo caching can avoid repeat work, and cache hits are not billed. Choose a TTL that matches page-change frequency.
- ScreenshotNeo bills only clean shots; bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing. Responses include
X-Page-VerdictandX-Billed.
FAQ
Does “fetch failed” prove the GitHub server is down?
No. The reviewed report records the client symptom but does not establish whether the cause was network, TLS, authentication, endpoint configuration, or a client defect.
Should I always log out and back in?
A reporter said a fresh login did not resolve the Windows case. Verify the loaded credential and endpoint first, then check current upstream guidance.
Why can two GitHub MCP entries appear?
A Copilot CLI report describes separate workspace and built-in entries. Inspect each entry instead of assuming the names refer to the same server.
Is the Codex token-variable fix valid for Copilot CLI?
It is evidence for that Codex configuration example only. Every client’s credential keys and loading rules must be checked in its own configuration.


