How to upload image attachments to GitHub PRs/issues from Claude Code via github-mcp-server?
When I ask Claude Code (with github-mcp-server) to add screenshots to a PR description, it can't upload image files, so the description ends up with placeholder URLs that don't exist. The GitHub upload endpoint uploads.github.com/upload/policies/assets also returns 422 when called with an API token. Is there a way to attach images to issues/PRs from an agent, or is this still unsupported?
Originally asked on GitHub: https://github.com/github/github-mcp-server/issues/738
5 answers
This is still an open feature request in github/github-mcp-server — there is no built-in
upload_attachmenttool as of the latest activity, and no maintainer has announced a plan. The thread does contain two working community workarounds, both standalone CLIs an agent like Claude Code can shell out to.Option 1:
gh-image(gh CLI extension) — replicates the browser's own upload flow and returnsgithub.com/user-attachments/assets/...URLs, exactly what you get from drag-and-drop. From the thread:bashgh extension install drogers0/gh-image IMG=$(gh image banner.png --repo github/github-mcp-server) gh issue comment 738 --repo github/github-mcp-server --body "$IMG"It pulls your browser's session cookie, so no token or OAuth setup is needed. The author notes images on private repos stay private, since the URLs inherit repo visibility.
Option 2:
gitshot— a zero-config, agent-ready CLI that uploads images to issues, PRs, and comments, with no Playwright or browser automation.Why the direct API route fails: a commenter reports that
uploads.github.com/upload/policies/assetsreturns HTTP 422 when called with API tokens — that endpoint expects browser session cookies. An extension calledgh-attachdoes work around it, but only via Playwright browser automation, which the thread calls a hack.Security note:
gh-imageauthenticates with your browser session cookie, not an API token, and the resulting attachment URLs inherit the repo's visibility.Did this work for you?What @drogers0 tried on GitHub (Worked)
Built and used the
gh-imageCLI extension (gh extension install drogers0/gh-image), which replicates the browser upload flow using the browser session cookie, then posted the returned user-attachments URL to an issue comment. The image rendered successfully.Source: https://github.com/github/github-mcp-server/issues/738#issuecomment-4140271408 (opens external site)
Did this work for you?What @vipulgupta2048 tried on GitHub (Worked)
Built and used
gitshot, a zero-config, agent-ready CLI that uploads images to GitHub issues, PRs, and comments without Playwright or browser automation; the image posted to the thread rendered correctly.Source: https://github.com/github/github-mcp-server/issues/738#issuecomment-4134892107 (opens external site)
Did this work for you?What @zitongcharliedeng tried on GitHub (Didn't work)
Called
uploads.github.com/upload/policies/assetswith API tokens, which returned HTTP 422. The endpoint requires browser session cookies, so token-based API calls are rejected.Source: https://github.com/github/github-mcp-server/issues/738#issuecomment-4020255430 (opens external site)
Did this work for you?What a GitHub user tried on GitHub (Didn't work)
Instructed Claude Code to create a PR and reference screenshot files in the description. It inserted placeholder github.com/user-attachments URLs that don't exist because github-mcp-server cannot upload files.
Source: https://github.com/github/github-mcp-server/issues/738 (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?