confluence_upload_attachment always fails on Confluence Data Center
Using mcp-atlassian (v0.21.0/v0.21.1 via uvx mcp-atlassian) with VS Code Copilot Chat against a Confluence Data Center instance, upload_attachment and upload_attachments always return success:false with "Failed to upload attachment to content ", even though get_page, update_page, and get_attachments work and manual UI upload succeeds. Why does this happen and how can I fix it?
Originally asked on GitHub: https://github.com/sooperset/mcp-atlassian/issues/1163
6 answers
Status: closed as completed after a fix landed in the community fork (Troubladore/mcp-atlassian PR #295, integrating #1202). The official mcp-atlassian v0.21.0 and v0.21.1 are byte-for-byte identical in the attachment upload code, so upgrading alone does not fix it.
Root cause (confirmed by direct code comparison in the thread):
_upload_attachment_direct()insrc/mcp_atlassian/confluence/attachments.pyuses HTTP PUT to upload attachments. Theatlassian-python-apilibrary (v4.0.7), already a dependency of mcp-atlassian, implements the same operation with POST in itsattach_content()method. The real HTTP error fromresponse.raise_for_status()is logged and then swallowed (lines 504-506), so the caller convertsNoneinto the generic "Failed to upload attachment ..." message. That is why the outer JSON says "Attachment uploaded successfully" while the inner payload hassuccess: false.Recommended fix from the thread: among the open PRs, #1253 is described as the most thorough — it changes PUT to POST, corrects the
X-Atlassian-Tokenheader value from"nocheck"to"no-check", and handles the re-upload case. The community fork already contains an integrated fix. Comment 4 notes this may be related to #1207, a Server/DC-specific problem with that sameX-Atlassian-Tokenheader value.Workaround that worked for the reporter: upload the file manually through the Confluence web UI with the same user/page, then reference the attachment in page content via
update_page. Another commenter confirmed a direct POST through the Confluence API works where the tool fails.Did this work for you?What a GitHub user tried on GitHub (Didn't work)
The reporter tried upload_attachment and upload_attachments with PNG (39-175KB) and SVG (4-10KB) files across multiple editable pages; every attempt returned the same success:false error.
Source: https://github.com/sooperset/mcp-atlassian/issues/1163 (opens external site)
Did this work for you?What @erickalmeidaptc tried on GitHub (Didn't work)
A commenter did a byte-for-byte diff of src/mcp_atlassian/confluence/attachments.py between v0.21.0 and v0.21.1, found them identical, and concluded upgrading to v0.21.1 does not fix the bug.
Source: https://github.com/sooperset/mcp-atlassian/issues/1163#issuecomment-4288944544 (opens external site)
Did this work for you?What @SecsAndCyber tried on GitHub (Didn't work)
A later commenter reproduced the identical failure on another Confluence Server/DC instance: reads, updates, attachment listing, and UI upload all succeeded; confluence_upload_attachment still failed.
Source: https://github.com/sooperset/mcp-atlassian/issues/1163#issuecomment-4847813344 (opens external site)
Did this work for you?What @koekaverna tried on GitHub (Worked)
A commenter with the same problem confirmed the tool fails but a direct POST through the Confluence API works fine.
Source: https://github.com/sooperset/mcp-atlassian/issues/1163#issuecomment-4259496231 (opens external site)
Did this work for you?What @Troubladore tried on GitHub (Worked)
A contributor reported the issue is fixed in the community fork (Troubladore/mcp-atlassian PR #295, integrating #1202).
Source: https://github.com/sooperset/mcp-atlassian/issues/1163#issuecomment-4130426681 (opens external site)
Did this work for you?
Related questions
- mcp-atlassian: 'JiraConfig' object has no attribute 'read_only' when calling create_issue
- mcp-atlassian Docker fails on startup with 'ValueError: I/O operation on closed file' — fixed?
- OAuth 2.0 for Confluence Data Center (on-prem) in mcp-atlassian?
- mcp-atlassian crashes with Pydantic 2.12.0: 'cannot specify both default and default_factory'
- mcp-atlassian Jira search_issues: 'requested API has been removed' error and total -1