Skip to content

Add per-toolset read-only configuration - #3282

Open
adbcodes wants to merge 1 commit into
github:mainfrom
adbcodes:fix/3229-read-only-toolsets
Open

adbcodes wants to merge 1 commit into
github:mainfrom
adbcodes:fix/3229-read-only-toolsets

Conversation

@adbcodes

@adbcodes adbcodes commented Sep 15, 2026

Copy link
Copy Markdown

Summary

Adds --read-only-toolsets and GITHUB_READ_ONLY_TOOLSETS to restrict writes in selected toolsets while keeping other enabled toolsets writable. Supports stdio, self-hosted HTTP, and list-scopes.

Why

Global read-only mode blocks every write tool, preventing mixed configurations such as writable repositories with read-only issues and pull requests.

Fixes #3229

What changed

  • Added configuration parsing, toolset validation, and centralized read-only filtering.
  • Preserved HTTP request toolset selection while preventing requests from restoring blocked writes.
  • Added regression tests and documentation.

MCP impact

  • No tool or API changes
  • Tool schema or behavior changed

Configured toolsets omit write tools from registration, so those tools cannot be listed or called. Tool schemas and default behavior remain unchanged.

  • New tool added

Prompts tested (tool changes only)

Tested in Codex with the locally built server connected as github_3229_local, using --toolsets=repos,issues,pull_requests --read-only-toolsets=issues,pull_requests:

  • “Using only github_3229_local, read github/github-mcp-server issue Feature: per-toolset (or per-tool) read-only mode instead of global GITHUB_READ_ONLY #3229 and summarize it.” — Issue read succeeded.
  • “Using only github_3229_local, check whether you can post an issue comment or merge a PR. Don’t use shell commands or other connectors.” — Comment and merge tools were unavailable.
  • “Check whether push_files is available through github_3229_local, without executing it.” — Repository write tool remained available; no write was performed.

Direct MCP tools/list and blocked tools/call requests were also tested using both CLI and environment configuration.

Security / limits

  • No security or limits impact
  • Auth / permissions considered

Global read-only remains authoritative. This setting does not alter GitHub token permissions.

  • Data exposure, filtering, or token/size limits considered

Explicit tool selection and HTTP request configuration cannot restore restricted writes. Unknown policy names fail validation; tools without read-only annotations are blocked in restricted toolsets.

Tool renaming

  • I am renaming tools as part of this PR
    • I have added the new tool aliases in deprecated_tool_aliases.go
  • I am not renaming tools as part of this PR

Existing tool names remain unchanged.

Lint & tests

  • Linted locally with ./script/lint
  • Tested locally with ./script/test

Ran the checks directly with Go 1.25.12: golangci-lint run reported zero issues; go test ./... passed. Fresh focused tests and race tests for inventory, HTTP, and CLI packages also passed, as did git diff --check.

Docs

  • Not needed
  • Updated (README / docs / examples)

Updated README.md and docs/server-configuration.md with configuration examples, precedence rules, validation, and HTTP behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants