Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 6, 2026

Summary

Rebuilds the list-scopes command from closed PR #1487 using the new inventory system. The command lists required OAuth scopes for enabled tools, helping users determine token permissions needed.

Why

PR #1487 was closed due to significant architectural changes (inventory refactor). This feature remains valuable for understanding scope requirements across toolsets.

What changed

  • Added cmd/github-mcp-server/list_scopes.go - command implementation using inventory API
  • Added script/list-scopes - convenience wrapper script
  • Extracted formatToolsetName helper to cmd/github-mcp-server/helpers.go (shared with generate_docs.go)

Implementation is 74 lines shorter than original (290 vs 364) - no mock clients needed, uses inventory filtering directly.

MCP impact

  • No tool or API changes - This is a CLI utility command, not an MCP tool

Prompts tested (tool changes only)

N/A - CLI command only

Security / limits

  • No security or limits impact - Read-only command that queries tool metadata

Tool renaming

  • I am not renaming tools as part of this PR

Lint & tests

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

Docs

  • Not needed - CLI utility, not user-facing tool

Usage

# Default toolsets
$ github-mcp-server list-scopes --output=summary
Required OAuth scopes for enabled tools:
  read:org
  repo
Total: 2 unique scope(s)

# All toolsets
$ github-mcp-server list-scopes --toolsets=all --output=summary
Total: 7 unique scope(s)

# JSON output for automation
$ github-mcp-server list-scopes --output=json

Supports all stdio command flags (--toolsets, --read-only, --tools) and three output formats (text, json, summary).

Original prompt

Please rebuild http://github.com/github/github-mcp-server/pull/1487 based on main with new scope handling features, it has changed a lot, but this could be a useful feature and I'd like a fresh PR that takes this approach and makes a simple solution, since the refactor makes it much cleaner with inventory and things.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI self-assigned this Jan 6, 2026
Copilot AI changed the title [WIP] Rebuild scope handling features based on main feat: Add list-scopes command using inventory architecture Jan 6, 2026
Copilot AI requested a review from SamMorrowDrums January 6, 2026 18:06
@JoannaaKL
Copy link
Contributor

@copilot create a stacked pr based on this one to:
pass a pat to script/list-scopes script and compare scopes in it vs required by tools. The command to list scopes in a PAT token:

curl -sI -H "Authorization: Bearer $GITHUB_PERSONAL_ACCESS_TOKEN" \
  https://api.github.com/user | grep -i x-oauth-scopes

@SamMorrowDrums SamMorrowDrums marked this pull request as ready for review January 8, 2026 10:52
@SamMorrowDrums SamMorrowDrums requested a review from a team as a code owner January 8, 2026 10:52
Copilot AI review requested due to automatic review settings January 8, 2026 10:52
@SamMorrowDrums SamMorrowDrums merged commit ff0e67e into main Jan 8, 2026
20 checks passed
@SamMorrowDrums SamMorrowDrums deleted the copilot/rebuild-scope-handling-features branch January 8, 2026 10:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new list-scopes CLI command that lists required OAuth scopes for enabled tools, helping users determine token permissions needed. The implementation leverages the new inventory architecture, resulting in a cleaner and more maintainable solution compared to the original closed PR #1487.

Key changes:

  • Adds new list-scopes command with three output formats (text, json, summary)
  • Extracts shared formatToolsetName helper function to avoid duplication
  • Provides convenience wrapper script for easy command execution

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
script/list-scopes Bash script wrapper that builds (if needed) and executes the list-scopes command
cmd/github-mcp-server/list_scopes.go Main implementation of the list-scopes command using inventory API
cmd/github-mcp-server/helpers.go New file containing extracted formatToolsetName helper function
cmd/github-mcp-server/generate_docs.go Refactored to use shared formatToolsetName helper from helpers.go

cd "$(dirname "$0")/.."

# Build the server if it doesn't exist or is outdated
if [ ! -f github-mcp-server ] || [ cmd/github-mcp-server/list_scopes.go -nt github-mcp-server ]; then
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build check only verifies if list_scopes.go is newer than the binary, but doesn't check helpers.go which is also a dependency. If helpers.go is modified, the script won't rebuild the binary automatically. Consider checking all dependencies or using a more comprehensive build condition.

Suggested change
if [ ! -f github-mcp-server ] || [ cmd/github-mcp-server/list_scopes.go -nt github-mcp-server ]; then
if [ ! -f github-mcp-server ] || find cmd/github-mcp-server -name '*.go' -newer github-mcp-server -print -quit | grep -q .; then

Copilot uses AI. Check for mistakes.
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.

3 participants