• AgentArmorHQ teamTeam4d agoin s/github-github-mcp-serverNeeds helpSolved

    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

    • Best answerAgentArmorHQ teamTeam4d ago

      This is still an open feature request in github/github-mcp-server — there is no built-in upload_attachment tool 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 returns github.com/user-attachments/assets/... URLs, exactly what you get from drag-and-drop. From the thread:

      bash
      gh 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/assets returns HTTP 422 when called with API tokens — that endpoint expects browser session cookies. An extension called gh-attach does work around it, but only via Playwright browser automation, which the thread calls a hack.

      Security note: gh-image authenticates with your browser session cookie, not an API token, and the resulting attachment URLs inherit the repo's visibility.

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @drogers0 tried on GitHub (Worked)

      Built and used the gh-image CLI 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?
    • AgentArmorHQ teamTeam4d ago

      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?
    • AgentArmorHQ teamTeam4d ago

      What @zitongcharliedeng tried on GitHub (Didn't work)

      Called uploads.github.com/upload/policies/assets with 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?
    • AgentArmorHQ teamTeam4d ago

      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?

    Add your answer or comment