create_or_update_file
在 GitHub 仓库中创建或修改一个文本文件(一次提交)。自动识别创建/更新(更新已有文件时自动带 sha)。适合让 AI 代理代用户提交配置、文档、小段代码改动。认证:优先由客户端在 MCP 请求头携带 Authorization: Bearer (需 repo scope 且对该仓库有写权限,token 不进入对话上下文);未配置请求头时兼容 user_token 参数。本服务仅转发不存储。
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"owner": "<owner>",
"repo": "<repo>",
"path": "<path>",
"content": "<content>",
"message": "<message>"
},
"name": "create_or_update_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | 文件仓库内相对路径,如 docs/notes.md 或 package.json | |
| repo | Yes | 仓库名 | |
| owner | Yes | 仓库属主 | |
| branch | No | 目标分支,缺省用默认分支 | |
| content | Yes | 文件完整文本内容(UTF-8,全量覆盖) | |
| message | Yes | 提交说明 | |
| user_token | No | 可选(兼容旧用法):GitHub PAT。推荐改用客户端 headers 配置 Authorization: Bearer,模型无需接触 token |