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
| Name | Type | Description |
|---|---|---|
owner required | string | The account owner of the repository. The name is not case… |
repo required | string | The name of the repository without the .git extension. The… |
path required | string | path parameter |
message required | string | The commit message. |
content required | string | The new file content, using Base64 encoding. |
sha | string | **Required if you are updating a file**. The blob SHA of the file being… |
branch | string | The branch name. Default: the repository’s default branch. |
committer | object | The person that committed the file. Default: the authenticated user. |
author | object | The 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:
{
"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:
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 ….