Why does github-mcp-server get_file_contents fail on GitHub Enterprise with 'Path did not point to a file or directory'?
Using github-mcp-server (v0.10.0 through v0.17.1) against GitHub Enterprise Server (3.15.8, 3.16.2), the
get_file_contentstool returns: 'Path did not point to a file or directory, but resolved git ref to ...' even though the path exists. It happens with Claude and GPT models, in VS Code and Roo Code, and only on GHE — the same server image works fine against github.com. Is this a known bug and is there a fix?Originally asked on GitHub: https://github.com/github/github-mcp-server/issues/864
5 answers
This is a known bug specific to GitHub Enterprise Server, not a problem with the model or the client. It is caused by GHE subdomain isolation: the raw content endpoint used by
get_file_contentsgets a 406 and then an SSO redirect, so the server reports the path as not resolvable even though the ref and path are correct. The maintainers acknowledged the issue and the fix is in PR #1218, so update to a github-mcp-server image that includes that fix (the thread does not state the release version that shipped it).Did this work for you?What @planetf1 tried on GitHub (Worked)
A user ran the same github-mcp-server version against public github.com and could retrieve files normally, which narrowed the bug down to GHE.
Source: https://github.com/github/github-mcp-server/issues/864#issuecomment-3250923007 (opens external site)
Did this work for you?What @alfredolopezzz tried on GitHub (Partly worked)
A user debugged the raw content call and changed the Accept header to
*/*, which removed the 406 error but then hit an SSO login redirect that prevented file retrieval.Source: https://github.com/github/github-mcp-server/issues/864#issuecomment-3340362869 (opens external site)
Did this work for you?What a GitHub user tried on GitHub (Didn't work)
The reporter called
get_file_contentswith onlypath, then addedref: refs/heads/main, thensha, then bothshaandref; every variant returned the same 'Path did not point to a file or directory' error.Source: https://github.com/github/github-mcp-server/issues/864 (opens external site)
Did this work for you?What @jbittner-dimensional tried on GitHub (Partly worked)
A user reported that getting a directory's contents worked on GHE, but getting an individual file's contents did not.
Source: https://github.com/github/github-mcp-server/issues/864#issuecomment-3300575025 (opens external site)
Did this work for you?
Related questions
- Is there a remote GitHub MCP server I can use without Docker or a local build?
- Does github-mcp-server support GitHub Actions workflows and logs?
- How can the GitHub MCP server access a repository's wiki?
- GitHub remote MCP server fails with PAT: HTTP 404 or 400 in Claude Code and Cursor?
- Private org repos fail with 404 or Bad credentials in GitHub MCP Server even with PAT: how to fix?