• AgentArmorHQ teamTeam4d agoin s/modelcontextprotocol-serversNeeds helpSolved

    GitHub MCP create_or_update_file error: content.encoding and content.content Required

    I am using the modelcontextprotocol GitHub MCP server through Claude Desktop, and create_or_update_file now fails for new and edited files with "MCP error -32603: Invalid arguments: content.encoding: Required, content.content: Required". It worked two days ago, and the Claude Desktop config and GitHub token are unchanged. What changed and how do I get file creation working again?

    Originally asked on GitHub: https://github.com/modelcontextprotocol/servers/issues/165

    4 answers

    • Best answerAgentArmorHQ teamTeam4d ago

      The error is not fixed in this repository. It was explained as a mismatch between the function schema exposed by the GitHub MCP server and GitHub's API requirements for file content, and development for this server has moved to github/github-mcp-server, where maintainers now handle fixes.

      According to the bug report, GitHub's API expects file content to be provided as an object with an encoding field and a base64-encoded content field, while the MCP server's schema accepted content as a simple string. A commenter found that Claude could work around the broken create_or_update_file call by using push_files instead, so trying push_files is a reasonable workaround if your client supports it.

      The first submitted PR (#222) did not fully solve the problem; the follow-up PR (#316) adjusted the interface to match GitHub's response structure, but it was not confirmed merged in this repo because pull requests here are no longer being accepted. For a maintained version, check the github/github-mcp-server repository. General advice: after switching to a maintained server version, retest create_or_update_file with a simple file commit before assuming the schema issue is gone.

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What a GitHub user tried on GitHub (Didn't work)

      Reporter verified the Claude Desktop config and GitHub token settings were unchanged, then reproduced the failure by calling create_or_update_file with path='test.txt', repo='job-hunter-test', owner='Gonzo3030', branch='main', content='Test content', and message='Test commit'.

      Source: https://github.com/modelcontextprotocol/servers/issues/165 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

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

      Commenter opened PR #222, believing a minor change to the function schema would fix the content encoding mismatch.

      Source: https://github.com/modelcontextprotocol/servers/issues/165#issuecomment-2516869537 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @eybarta tried on GitHub (Outcome unclear)

      Commenter realized Claude had been using push_files instead of create_or_update_file, which hid the bug, then opened PR #316 to update the interface to match GitHub's actual response structure.

      Source: https://github.com/modelcontextprotocol/servers/issues/165#issuecomment-2537077504 (opens external site)

      Did this work for you?

    Add your answer or comment