Title: get_file_contents returns a broken resource URI for non-ASCII file names · Issue #3418 · github/github-mcp-server · GitHub
Open Graph Title: get_file_contents returns a broken resource URI for non-ASCII file names · Issue #3418 · github/github-mcp-server
X Title: get_file_contents returns a broken resource URI for non-ASCII file names · Issue #3418 · github/github-mcp-server
Description: Describe the bug For a file whose path contains non-ASCII characters, the uri of the embedded resource (and of the resource link for large files) is percent-encoded wrongly, and reading that URI back with resources/read fails (500 or 404...
Open Graph Description: Describe the bug For a file whose path contains non-ASCII characters, the uri of the embedded resource (and of the resource link for large files) is percent-encoded wrongly, and reading that URI ba...
X Description: Describe the bug For a file whose path contains non-ASCII characters, the uri of the embedded resource (and of the resource link for large files) is percent-encoded wrongly, and reading that URI ba...
Opengraph URL: https://github.com/github/github-mcp-server/issues/3418
X: @github
Domain: github.com
IPv4 address: 140.82.113.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"get_file_contents returns a broken resource URI for non-ASCII file names","articleBody":"### Describe the bug\n\nFor a file whose path contains non-ASCII characters, the `uri` of the embedded resource (and of the resource link for large files) is percent-encoded wrongly, and reading that URI back with `resources/read` fails (500 or 404).\n\nFor `Þfoo.go` the server returns `%DEfoo.go` (not valid UTF-8; the correct form is `%C3%9Efoo.go`), and for `ملف.txt` it returns `%06%45%06%44%06%41.txt` instead of `%D9%85%D9%84%D9%81.txt`. `expandRepoResourceURI` (`pkg/github/repository_resource.go:252`) uses `uritemplate.Template.Expand` from `github.com/yosida95/uritemplate/v3` v3.0.2, whose `pctEncode` writes the bytes of the rune's code point (U+0645 becomes `%06%45`) instead of its UTF-8 bytes. Non-ASCII branch and tag names are affected the same way. That library has had no commits since 2022.\n\n### Affected version\n\n```\nGitHub MCP Server\nVersion: 1.14.0\nCommit: f10e4e1f923d46b86f2e80e849aa74084c847184\nBuild Date: 2026-10-02T17:00:10Z\n```\n\nAlso reproduced on `main` at 71ef8266.\n\n### Steps to reproduce the behavior\n\n1. Run `github-mcp-server stdio --read-only` with a token.\n2. Call:\n ```json\n {\"method\":\"tools/call\",\"params\":{\"name\":\"get_file_contents\",\"arguments\":{\"owner\":\"golang\",\"repo\":\"go\",\"path\":\"test/fixedbugs/issue27836.dir/Þfoo.go\",\"sha\":\"a90c4a7a586c70f0de61f5507d5c347702432e39\"}}}\n ```\n3. Take the `uri` from the returned resource and call `resources/read` with it.\n\n### Expected vs actual behavior\n\nExpected: `uri` = `repo://golang/go/sha/a90c4a7a.../contents/test/fixedbugs/issue27836.dir/%C3%9Efoo.go`, and `resources/read` on it returns the file. (Reading that correctly encoded URI does work today.)\n\nActual: `uri` = `repo://golang/go/sha/a90c4a7a.../contents/test/fixedbugs/issue27836.dir/%DEfoo.go`, and `resources/read` on it fails with `failed to fetch raw content: 500: Internal Server Error`. For Arabic or CJK names the wrong bytes form a different path and the read returns `404 Not Found`.\n\nA Japanese name like `日本語 ファイル.md` comes out as `%65%E5%67%2C%8A%9E%20%30%D5%30%A1%30%A4%30%EB.md`.\n\n### Logs\n\nN/A\n\nI have a fix with a regression test ready and can open a PR: expand the repository resource templates with a small UTF-8 percent-encoder instead of `Expand`. ASCII output is byte-for-byte unchanged.\n","author":{"url":"https://github.com/jayhemnani9910","@type":"Person","name":"jayhemnani9910"},"datePublished":"2026-10-05T11:43:08Z","url":"https://github.com/github/github-mcp-server/issues/3418"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:809e1181-9b4a-12e7-cb15-3b9362a98238 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ADA0:A9D1F:1BBDBF:25E200:6B05D418 |
| html-safe-nonce | 728022de05e19f7bc723040871aaaef23075d9fbf604daf245fe66cad6f7f1cb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBREEwOkE5RDFGOjFCQkRCRjoyNUUyMDA6NkIwNUQ0MTgiLCJ2aXNpdG9yX2lkIjoiNDgwNTEyNTY3MzU4Mjk3Mzk3NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 241cfb8d9faea844d413e5c3a830344a19f8ee92c12c798dc038e0031fcd4c41 |
| hovercard-subject-tag | issue:5711374100 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/github/github-mcp-server/3418/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ac7390a5a8f1a0973208204ceae919d6e9f0da197262946aa9b4ff4c141983e1/github/github-mcp-server/issues/3418 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ac7390a5a8f1a0973208204ceae919d6e9f0da197262946aa9b4ff4c141983e1/github/github-mcp-server/issues/3418 |
| og:image:alt | Describe the bug For a file whose path contains non-ASCII characters, the uri of the embedded resource (and of the resource link for large files) is percent-encoded wrongly, and reading that URI ba... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jayhemnani9910 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7cc8361bc0396e5c33704280422dd7a38c5b91f6190589faea57461f56967249 |
| turbo-cache-control | no-preview |
| go-import | github.com/github/github-mcp-server git https://github.com/github/github-mcp-server.git |
| octolytics-dimension-user_id | 9919 |
| octolytics-dimension-user_login | github |
| octolytics-dimension-repository_id | 942771284 |
| octolytics-dimension-repository_nwo | github/github-mcp-server |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 942771284 |
| octolytics-dimension-repository_network_root_nwo | github/github-mcp-server |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ab4da203740f827015a12d36851c8de196e908bf |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width