github / github/github-mcp-server

Feature: per-toolset (or per-tool) read-only mode instead of global GITHUB_READ_ONLY

未關閉
#3,229 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
enhancement policies & governance
主要語言
Go
星號
33k
分支
5k
平均合併
2 天 1 小時
30 天內合併 PR
52

描述

### Feature request

`GITHUB_READ_ONLY` is currently all-or-nothing: when set, the whole server rejects every write operation. There is no way to keep some domains writable while others stay read-only.

### Use case

Running the server as a local coding-agent tool with a single GitHub token, I want a common "safe by default" posture:

- Reads everywhere (repos, issues, pull requests) allowed without human confirmation
- Writes (merge PR, close/label issues, push comments) gated behind explicit user approval

Today the only way to approximate this is to launch **two full server instances** — one with `GITHUB_READ_ONLY=1` and one without — and rely on agent-side conventions to route writes to the second instance. That is fragile because nothing on the server side prevents an agent from calling write tools on the writable instance, and it doubles the tool surface / process count.

### Proposed solution

Any of the following would fix it:

1. Per-toolset read-only, e.g. `GITHUB_READ_ONLY_TOOLSETS=issues,pull_requests` (writes rejected only for the listed toolsets), or
2. Per-tool read-only overrides, e.g. a `GITHUB_READ_ONLY_TOOLS=merge_pull_request,create_issue` deny list, or
3. A "write-confirm" layer that rejects write tools unless an opt-in env var for that specific call is present.

Option 1 seems the most consistent with the existing `GITHUB_TOOLSETS` design.

### Alternatives considered

- Token scoping (fine-grained PAT without write scopes): does not help, because the same token is also expected to perform approved writes.
- Dual-instance setup: works only as a convention, not enforcement (described above).

貢獻指南

開啟貢獻指南

研究方向

Start by tracing how the server handles GITHUB_READ_ONLY and the existing GITHUB_TOOLSETS configuration, then identify where write tools are dispatched. Compare the proposed per-toolset and per-tool scopes with current configuration behavior. Done means selected write operations are rejected while reads and explicitly permitted writes continue to work, with coverage for the chosen configuration.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
github, go
領域
backend-api-design, security
Issue 類型
功能
難度
5/5
預估耗時
一週以上
活躍度
活躍
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。