npx skills add https://skills.volces.com/skills/clawhub/byungkyu通过托管的 OAuth 认证访问 GitHub REST API。管理仓库、议题、拉取请求、提交、分支、用户等。
# Get authenticated user
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/github/user')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
https://gateway.maton.ai/github/{native-api-path}
将 {native-api-path} 替换为实际的 GitHub API 端点路径。网关将请求代理到 api.github.com 并自动注入您的 OAuth 令牌。
所有请求都需要在 Authorization 请求头中包含 Maton API 密钥:
Authorization: Bearer $MATON_API_KEY
环境变量: 将您的 API 密钥设置为 MATON_API_KEY:
export MATON_API_KEY="YOUR_API_KEY"
Access the GitHub REST API with managed OAuth authentication. Manage repositories, issues, pull requests, commits, branches, users, and more.
# Get authenticated user
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/github/user')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
https://gateway.maton.ai/github/{native-api-path}
Replace {native-api-path} with the actual GitHub API endpoint path. The gateway proxies requests to api.github.com and automatically injects your OAuth token.
All requests require the Maton API key in the Authorization header:
Authorization: Bearer $MATON_API_KEY
Environment Variable: Set your API key as :
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
在 https://ctrl.maton.ai 管理您的 GitHub OAuth 连接。
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections?app=github&status=ACTIVE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
python <<'EOF'
import urllib.request, os, json
data = json.dumps({'app': 'github'}).encode()
req = urllib.request.Request('https://ctrl.maton.ai/connections', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
响应:
{
"connection": {
"connection_id": "83e7c665-60f6-4a64-816c-5e287ea8982f",
"status": "ACTIVE",
"creation_time": "2026-02-06T03:00:43.860014Z",
"last_updated_time": "2026-02-06T03:01:06.027323Z",
"url": "https://connect.maton.ai/?session_token=...",
"app": "github",
"metadata": {}
}
}
在浏览器中打开返回的 url 以完成 OAuth 授权。
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}', method='DELETE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
如果您有多个 GitHub 连接,可以使用 Maton-Connection 请求头指定使用哪一个:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/github/user')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Maton-Connection', '83e7c665-60f6-4a64-816c-5e287ea8982f')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
如果省略,网关将使用默认(最旧的)活动连接。
GET /github/user
GET /github/users/{username}
GET /github/users?since={user_id}&per_page=30
GET /github/user/repos?per_page=30&sort=updated
查询参数:type (all, owner, public, private, member), sort (created, updated, pushed, full_name), direction (asc, desc), per_page, page
GET /github/orgs/{org}/repos?per_page=30
GET /github/repos/{owner}/{repo}
POST /github/user/repos
Content-Type: application/json
{
"name": "my-new-repo",
"description": "A new repository",
"private": true,
"auto_init": true
}
POST /github/orgs/{org}/repos
Content-Type: application/json
{
"name": "my-new-repo",
"description": "A new repository",
"private": true
}
PATCH /github/repos/{owner}/{repo}
Content-Type: application/json
{
"description": "Updated description",
"has_issues": true,
"has_wiki": false
}
DELETE /github/repos/{owner}/{repo}
GET /github/repos/{owner}/{repo}/contents/{path}
GET /github/repos/{owner}/{repo}/contents/{path}?ref={branch}
PUT /github/repos/{owner}/{repo}/contents/{path}
Content-Type: application/json
{
"message": "Create new file",
"content": "SGVsbG8gV29ybGQh",
"branch": "main"
}
注意:content 必须是 Base64 编码。
DELETE /github/repos/{owner}/{repo}/contents/{path}
Content-Type: application/json
{
"message": "Delete file",
"sha": "{file_sha}",
"branch": "main"
}
GET /github/repos/{owner}/{repo}/branches?per_page=30
GET /github/repos/{owner}/{repo}/branches/{branch}
POST /github/repos/{owner}/{repo}/branches/{branch}/rename
Content-Type: application/json
{
"new_name": "new-branch-name"
}
POST /github/repos/{owner}/{repo}/merges
Content-Type: application/json
{
"base": "main",
"head": "feature-branch",
"commit_message": "Merge feature branch"
}
GET /github/repos/{owner}/{repo}/commits?per_page=30
查询参数:sha (分支名称或提交 SHA), path (文件路径), author, committer, since, until, per_page, page
GET /github/repos/{owner}/{repo}/commits/{ref}
GET /github/repos/{owner}/{repo}/compare/{base}...{head}
GET /github/repos/{owner}/{repo}/issues?state=open&per_page=30
查询参数:state (open, closed, all), labels, assignee, creator, mentioned, sort, direction, since, per_page, page
GET /github/repos/{owner}/{repo}/issues/{issue_number}
POST /github/repos/{owner}/{repo}/issues
Content-Type: application/json
{
"title": "Found a bug",
"body": "Bug description here",
"labels": ["bug"],
"assignees": ["username"]
}
PATCH /github/repos/{owner}/{repo}/issues/{issue_number}
Content-Type: application/json
{
"state": "closed",
"state_reason": "completed"
}
PUT /github/repos/{owner}/{repo}/issues/{issue_number}/lock
Content-Type: application/json
{
"lock_reason": "resolved"
}
DELETE /github/repos/{owner}/{repo}/issues/{issue_number}/lock
GET /github/repos/{owner}/{repo}/issues/{issue_number}/comments?per_page=30
POST /github/repos/{owner}/{repo}/issues/{issue_number}/comments
Content-Type: application/json
{
"body": "This is a comment"
}
PATCH /github/repos/{owner}/{repo}/issues/comments/{comment_id}
Content-Type: application/json
{
"body": "Updated comment"
}
DELETE /github/repos/{owner}/{repo}/issues/comments/{comment_id}
GET /github/repos/{owner}/{repo}/labels?per_page=30
POST /github/repos/{owner}/{repo}/labels
Content-Type: application/json
{
"name": "priority:high",
"color": "ff0000",
"description": "High priority issues"
}
GET /github/repos/{owner}/{repo}/milestones?state=open&per_page=30
POST /github/repos/{owner}/{repo}/milestones
Content-Type: application/json
{
"title": "v1.0",
"state": "open",
"description": "First release",
"due_on": "2026-03-01T00:00:00Z"
}
GET /github/repos/{owner}/{repo}/pulls?state=open&per_page=30
查询参数:state (open, closed, all), head, base, sort, direction, per_page, page
GET /github/repos/{owner}/{repo}/pulls/{pull_number}
POST /github/repos/{owner}/{repo}/pulls
Content-Type: application/json
{
"title": "New feature",
"body": "Description of changes",
"head": "feature-branch",
"base": "main",
"draft": false
}
PATCH /github/repos/{owner}/{repo}/pulls/{pull_number}
Content-Type: application/json
{
"title": "Updated title",
"state": "closed"
}
GET /github/repos/{owner}/{repo}/pulls/{pull_number}/commits?per_page=30
GET /github/repos/{owner}/{repo}/pulls/{pull_number}/files?per_page=30
GET /github/repos/{owner}/{repo}/pulls/{pull_number}/merge
PUT /github/repos/{owner}/{repo}/pulls/{pull_number}/merge
Content-Type: application/json
{
"commit_title": "Merge pull request",
"merge_method": "squash"
}
合并方法:merge, squash, rebase
GET /github/repos/{owner}/{repo}/pulls/{pull_number}/reviews?per_page=30
POST /github/repos/{owner}/{repo}/pulls/{pull_number}/reviews
Content-Type: application/json
{
"body": "Looks good!",
"event": "APPROVE"
}
事件:APPROVE, REQUEST_CHANGES, COMMENT
GET /github/search/repositories?q={query}&per_page=30
查询示例:
tetris+language:python - 包含 "tetris" 的 Python 仓库react+stars:>10000 - 包含 "react" 且星标数超过 10k 的仓库GET /github/search/issues?q={query}&per_page=30
查询示例:
bug+is:open+is:issue - 包含 "bug" 的开放议题author:username+is:pr - 指定作者创建的拉取请求GET /github/search/code?q={query}&per_page=30
查询示例:
addClass+repo:facebook/react - 在特定仓库中搜索 "addClass"function+extension:js - JavaScript 函数注意:广泛的代码搜索可能会超时。
GET /github/search/users?q={query}&per_page=30
GET /github/user/orgs?per_page=30
注意:需要 read:org 权限范围。
GET /github/orgs/{org}
GET /github/orgs/{org}/members?per_page=30
GET /github/rate_limit
响应:
{
"rate": {
"limit": 5000,
"remaining": 4979,
"reset": 1707200000
},
"resources": {
"core": { "limit": 5000, "remaining": 4979 },
"search": { "limit": 30, "remaining": 28 }
}
}
GitHub 使用基于页面和基于链接的分页:
GET /github/repos/{owner}/{repo}/issues?per_page=30&page=2
响应头包含分页链接:
Link: <url>; rel="next", <url>; rel="last"常用分页参数:
per_page: 每页结果数(最大 100,默认 30)page: 页码(默认 1)某些端点使用基于游标的分页,带有 since 参数(例如,列出用户)。
const response = await fetch(
'https://gateway.maton.ai/github/repos/owner/repo/issues?state=open&per_page=10',
{
headers: {
'Authorization': `Bearer ${process.env.MATON_API_KEY}`
}
}
);
const issues = await response.json();
import os
import requests
response = requests.get(
'https://gateway.maton.ai/github/repos/owner/repo/issues',
headers={'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'},
params={'state': 'open', 'per_page': 10}
)
issues = response.json()
read:org)。如果您收到范围错误,请联系 Maton 支持 support@maton.ai,并提供您需要的具体操作/API 以及您的使用场景curl -g 来禁用通配符解析jq 或其他命令时,在某些 shell 环境中,像 $MATON_API_KEY 这样的环境变量可能无法正确展开| 状态码 | 含义 |
|---|---|
| 400 | 缺少 GitHub 连接 |
| 401 | Maton API 密钥无效或缺失 |
| 403 | 禁止访问 - 权限或范围不足 |
| 404 | 资源未找到 |
| 408 | 请求超时(复杂搜索时常见) |
| 422 | 验证失败 |
| 429 | 达到速率限制 |
| 4xx/5xx | 来自 GitHub API 的透传错误 |
MATON_API_KEY 环境变量是否已设置:echo $MATON_API_KEY
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
github 开头。例如:https://gateway.maton.ai/github/userhttps://gateway.maton.ai/api.github.com/user每周安装数
137
来源
首次出现
13 天前
安全审计
安装于
openclaw135
opencode4
gemini-cli4
github-copilot4
amp4
cline4
MATON_API_KEYexport MATON_API_KEY="YOUR_API_KEY"
Manage your GitHub OAuth connections at https://ctrl.maton.ai.
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections?app=github&status=ACTIVE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
python <<'EOF'
import urllib.request, os, json
data = json.dumps({'app': 'github'}).encode()
req = urllib.request.Request('https://ctrl.maton.ai/connections', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
Response:
{
"connection": {
"connection_id": "83e7c665-60f6-4a64-816c-5e287ea8982f",
"status": "ACTIVE",
"creation_time": "2026-02-06T03:00:43.860014Z",
"last_updated_time": "2026-02-06T03:01:06.027323Z",
"url": "https://connect.maton.ai/?session_token=...",
"app": "github",
"metadata": {}
}
}
Open the returned url in a browser to complete OAuth authorization.
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}', method='DELETE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
If you have multiple GitHub connections, specify which one to use with the Maton-Connection header:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/github/user')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Maton-Connection', '83e7c665-60f6-4a64-816c-5e287ea8982f')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
If omitted, the gateway uses the default (oldest) active connection.
GET /github/user
GET /github/users/{username}
GET /github/users?since={user_id}&per_page=30
GET /github/user/repos?per_page=30&sort=updated
Query parameters: type (all, owner, public, private, member), sort (created, updated, pushed, full_name), direction (asc, desc), per_page, page
GET /github/orgs/{org}/repos?per_page=30
GET /github/repos/{owner}/{repo}
POST /github/user/repos
Content-Type: application/json
{
"name": "my-new-repo",
"description": "A new repository",
"private": true,
"auto_init": true
}
POST /github/orgs/{org}/repos
Content-Type: application/json
{
"name": "my-new-repo",
"description": "A new repository",
"private": true
}
PATCH /github/repos/{owner}/{repo}
Content-Type: application/json
{
"description": "Updated description",
"has_issues": true,
"has_wiki": false
}
DELETE /github/repos/{owner}/{repo}
GET /github/repos/{owner}/{repo}/contents/{path}
GET /github/repos/{owner}/{repo}/contents/{path}?ref={branch}
PUT /github/repos/{owner}/{repo}/contents/{path}
Content-Type: application/json
{
"message": "Create new file",
"content": "SGVsbG8gV29ybGQh",
"branch": "main"
}
Note: content must be Base64 encoded.
DELETE /github/repos/{owner}/{repo}/contents/{path}
Content-Type: application/json
{
"message": "Delete file",
"sha": "{file_sha}",
"branch": "main"
}
GET /github/repos/{owner}/{repo}/branches?per_page=30
GET /github/repos/{owner}/{repo}/branches/{branch}
POST /github/repos/{owner}/{repo}/branches/{branch}/rename
Content-Type: application/json
{
"new_name": "new-branch-name"
}
POST /github/repos/{owner}/{repo}/merges
Content-Type: application/json
{
"base": "main",
"head": "feature-branch",
"commit_message": "Merge feature branch"
}
GET /github/repos/{owner}/{repo}/commits?per_page=30
Query parameters: sha (branch name or commit SHA), path (file path), author, committer, since, until, per_page, page
GET /github/repos/{owner}/{repo}/commits/{ref}
GET /github/repos/{owner}/{repo}/compare/{base}...{head}
GET /github/repos/{owner}/{repo}/issues?state=open&per_page=30
Query parameters: state (open, closed, all), labels, assignee, creator, mentioned, sort, direction, since, per_page, page
GET /github/repos/{owner}/{repo}/issues/{issue_number}
POST /github/repos/{owner}/{repo}/issues
Content-Type: application/json
{
"title": "Found a bug",
"body": "Bug description here",
"labels": ["bug"],
"assignees": ["username"]
}
PATCH /github/repos/{owner}/{repo}/issues/{issue_number}
Content-Type: application/json
{
"state": "closed",
"state_reason": "completed"
}
PUT /github/repos/{owner}/{repo}/issues/{issue_number}/lock
Content-Type: application/json
{
"lock_reason": "resolved"
}
DELETE /github/repos/{owner}/{repo}/issues/{issue_number}/lock
GET /github/repos/{owner}/{repo}/issues/{issue_number}/comments?per_page=30
POST /github/repos/{owner}/{repo}/issues/{issue_number}/comments
Content-Type: application/json
{
"body": "This is a comment"
}
PATCH /github/repos/{owner}/{repo}/issues/comments/{comment_id}
Content-Type: application/json
{
"body": "Updated comment"
}
DELETE /github/repos/{owner}/{repo}/issues/comments/{comment_id}
GET /github/repos/{owner}/{repo}/labels?per_page=30
POST /github/repos/{owner}/{repo}/labels
Content-Type: application/json
{
"name": "priority:high",
"color": "ff0000",
"description": "High priority issues"
}
GET /github/repos/{owner}/{repo}/milestones?state=open&per_page=30
POST /github/repos/{owner}/{repo}/milestones
Content-Type: application/json
{
"title": "v1.0",
"state": "open",
"description": "First release",
"due_on": "2026-03-01T00:00:00Z"
}
GET /github/repos/{owner}/{repo}/pulls?state=open&per_page=30
Query parameters: state (open, closed, all), head, base, sort, direction, per_page, page
GET /github/repos/{owner}/{repo}/pulls/{pull_number}
POST /github/repos/{owner}/{repo}/pulls
Content-Type: application/json
{
"title": "New feature",
"body": "Description of changes",
"head": "feature-branch",
"base": "main",
"draft": false
}
PATCH /github/repos/{owner}/{repo}/pulls/{pull_number}
Content-Type: application/json
{
"title": "Updated title",
"state": "closed"
}
GET /github/repos/{owner}/{repo}/pulls/{pull_number}/commits?per_page=30
GET /github/repos/{owner}/{repo}/pulls/{pull_number}/files?per_page=30
GET /github/repos/{owner}/{repo}/pulls/{pull_number}/merge
PUT /github/repos/{owner}/{repo}/pulls/{pull_number}/merge
Content-Type: application/json
{
"commit_title": "Merge pull request",
"merge_method": "squash"
}
Merge methods: merge, squash, rebase
GET /github/repos/{owner}/{repo}/pulls/{pull_number}/reviews?per_page=30
POST /github/repos/{owner}/{repo}/pulls/{pull_number}/reviews
Content-Type: application/json
{
"body": "Looks good!",
"event": "APPROVE"
}
Events: APPROVE, REQUEST_CHANGES, COMMENT
GET /github/search/repositories?q={query}&per_page=30
Example queries:
tetris+language:python - Repositories with "tetris" in Pythonreact+stars:>10000 - Repositories with "react" and 10k+ starsGET /github/search/issues?q={query}&per_page=30
Example queries:
bug+is:open+is:issue - Open issues containing "bug"author:username+is:pr - Pull requests by authorGET /github/search/code?q={query}&per_page=30
Example queries:
addClass+repo:facebook/react - Search for "addClass" in a specific repofunction+extension:js - JavaScript functionsNote: Code search may timeout on broad queries.
GET /github/search/users?q={query}&per_page=30
GET /github/user/orgs?per_page=30
Note: Requires read:org scope.
GET /github/orgs/{org}
GET /github/orgs/{org}/members?per_page=30
GET /github/rate_limit
Response:
{
"rate": {
"limit": 5000,
"remaining": 4979,
"reset": 1707200000
},
"resources": {
"core": { "limit": 5000, "remaining": 4979 },
"search": { "limit": 30, "remaining": 28 }
}
}
GitHub uses page-based and link-based pagination:
GET /github/repos/{owner}/{repo}/issues?per_page=30&page=2
Response headers include pagination links:
Link: <url>; rel="next", <url>; rel="last"Common pagination parameters:
per_page: Results per page (max 100, default 30)page: Page number (default 1)Some endpoints use cursor-based pagination with since parameter (e.g., listing users).
const response = await fetch(
'https://gateway.maton.ai/github/repos/owner/repo/issues?state=open&per_page=10',
{
headers: {
'Authorization': `Bearer ${process.env.MATON_API_KEY}`
}
}
);
const issues = await response.json();
import os
import requests
response = requests.get(
'https://gateway.maton.ai/github/repos/owner/repo/issues',
headers={'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'},
params={'state': 'open', 'per_page': 10}
)
issues = response.json()
read:org for organization operations). If you receive a scope error, contact Maton support at support@maton.ai with the specific operations/APIs you need and your use-casecurl -g when URLs contain brackets to disable glob parsingjq or other commands, environment variables like $MATON_API_KEY may not expand correctly in some shell environments| Status | Meaning |
|---|---|
| 400 | Missing GitHub connection |
| 401 | Invalid or missing Maton API key |
| 403 | Forbidden - insufficient permissions or scope |
| 404 | Resource not found |
| 408 | Request timeout (common for complex searches) |
| 422 | Validation failed |
| 429 | Rate limited |
| 4xx/5xx | Passthrough error from GitHub API |
MATON_API_KEY environment variable is set:echo $MATON_API_KEY
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
github. For example:https://gateway.maton.ai/github/userhttps://gateway.maton.ai/api.github.com/userWeekly Installs
137
Source
First Seen
13 days ago
Security Audits
Installed on
openclaw135
opencode4
gemini-cli4
github-copilot4
amp4
cline4
通过 LiteLLM 代理让 Claude Code 对接 GitHub Copilot 运行 | 高级变通方案指南
36,300 周安装