Home / Servers / GitHub API / repos_create_or_update_file_contents

Create or update file contents

An MCP tool from the GitHub API server, hosted on mcp.hjlabs.in.

Create or update file contents Creates a new file or replaces an existing file in a repository. > [!NOTE] > If you use this endpoint and the "Delete a file" endpoint in parallel, the concurrent requests will conflict and you will… [PUT /repos/{owner}/{repo}/contents/{path}]

Name on the gateway: github_api__repos_create_or_update_file_contents · may change things.

Parameters

NameTypeDescription
owner requiredstringThe account owner of the repository. The name is not case…
repo requiredstringThe name of the repository without the .git extension. The…
path requiredstringpath parameter
message requiredstringThe commit message.
content requiredstringThe new file content, using Base64 encoding.
shastring**Required if you are updating a file**. The blob SHA of the file being…
branchstringThe branch name. Default: the repository’s default branch.
committerobjectThe person that committed the file. Default: the authenticated user.
authorobjectThe author of the file. Default: The committer or the authenticated user if…

How to call it

Through the Smart Gateway, any client can run it by name with call_tool, or let the gateway find it with search_tools:

call_tool arguments
{
  "name": "github_api__repos_create_or_update_file_contents",
  "arguments": {
    "owner": "…",
    "repo": "…",
    "path": "…",
    "message": "…",
    "content": "…"
  }
}

Or connect the GitHub API server directly, which lists 1,221 tools including this one:

Run in your terminal
claude mcp add --transport http hj-github-api https://mcp.hjlabs.in/mcp/github-api \
  --header "Authorization: Bearer YOUR_API_KEY"

Try asking

Use the create or update file contents tool with owner set to ….

More from GitHub API