Skip to content

Configure GitHub MCP defaults: read-only=true, toolset=default, wildcard tools#2041

Merged
pelikhan merged 8 commits intomainfrom
copilot/configure-github-mcp-default-toolset
Oct 20, 2025
Merged

Configure GitHub MCP defaults: read-only=true, toolset=default, wildcard tools#2041
pelikhan merged 8 commits intomainfrom
copilot/configure-github-mcp-default-toolset

Conversation

Copy link
Contributor

Copilot AI commented Oct 20, 2025

Overview

Updates the GitHub MCP server configuration to use more secure and appropriate defaults:

  • read-only: true by default (prevents accidental write operations)
  • toolset: [default] by default (provides recommended tools for common use cases)
  • Uses ["*"] wildcard for tools instead of maintaining long explicit lists
  • Copilot CLI automatically includes --allow-tool github when no tools are specified
  • Dev workflow dynamically discovers and tests all GitHub MCP tools

Motivation

Previously, the GitHub MCP server defaulted to:

  • read-only: false - allowing write operations by default (security concern)
  • toolset: all - enabling all toolsets when none were specified (often unnecessary)
  • Automatically adding ~50 default tools to the allowed list, creating verbose configurations
  • Copilot CLI would not add --allow-tool github when no allowed field was present, preventing access to GitHub MCP server

These defaults could lead to workflows accidentally modifying repository data or including unnecessary API permissions. The new defaults provide a more secure baseline while still allowing users to explicitly opt into write operations and additional toolsets when needed.

Changes

Core Logic

  • Modified getGitHubReadOnly() to return true by default (was false)
  • Modified getGitHubToolsets() to return "default" by default (was empty string → "all")
  • Simplified rendering logic in all three engines (Copilot, Claude, Codex) to remove conditional checks
  • Removed automatic addition of default GitHub tools list - now uses ["*"] wildcard instead
  • Added --allow-tool github to Copilot CLI when no allowed field is specified
  • Updated dev.md workflow to dynamically discover and test all available GitHub MCP tools with Copilot engine

Tools Configuration Simplification

Before (no configuration specified):

tools:
  github:

Generated:

"tools": [
  "download_workflow_run_artifact",
  "get_job_logs",
  ... 45+ more tools
]

Copilot CLI: No --allow-tool github argument (broken)

After (no configuration specified):

tools:
  github:

Generated:

"tools": ["*"]

Copilot CLI: --allow-tool github (allows access to GitHub MCP server)

This change reduces compiled workflow file size by ~7KB each and simplifies the configuration.

Copilot CLI Tool Arguments

When no allowed field is specified, Copilot CLI now automatically includes --allow-tool github to grant access to the GitHub MCP server:

  • No allowed field: --allow-tool github (allow all GitHub tools via MCP)
  • allowed: ["*"]: --allow-tool github (explicit wildcard)
  • allowed: [tool1, tool2]: --allow-tool github(tool1) --allow-tool github(tool2) (specific tools)
  • allowed: []: No arguments (no GitHub tools allowed)

Dev Workflow Testing

Updated .github/workflows/dev.md to validate the GitHub MCP configuration:

  • Switched from Claude to Copilot engine
  • Dynamically discovers and tests all available GitHub MCP tools rather than testing a fixed list
  • Instructs the LLM to explore and identify all tools available from the GitHub MCP server
  • Tests tools with sensible arguments across multiple categories:
    • Context tools (e.g., get_me)
    • Repository tools (e.g., get_file_contents, list_branches, list_commits, search_repositories)
    • Issues tools (e.g., list_issues, search_issues)
    • Pull Request tools (e.g., list_pull_requests, search_pull_requests)
    • Actions tools (e.g., list_workflows, list_workflow_runs)
    • Release tools (e.g., list_releases)
    • And any other tools discovered from the GitHub MCP server
  • Verifies tools are callable and properly configured
  • Detects and fails on permission issues
  • Provides comprehensive summary of tool invocation results

This approach makes the test workflow more flexible and future-proof, automatically adapting to changes in the GitHub MCP server's available tools.

Examples

Before (no configuration specified):

tools:
  github:

Generated: GITHUB_TOOLSETS=all (no read-only protection), plus 50+ tool names, no Copilot CLI arguments

After (no configuration specified):

tools:
  github:

Generated: GITHUB_READ_ONLY=1, GITHUB_TOOLSETS=default, "tools": ["*"], --allow-tool github

Explicit override (still works):

tools:
  github:
    read-only: false
    toolset: [all]
    allowed: [get_issue, list_issues]  # Explicit tool list still respected

Backward Compatibility

This is a breaking change for workflows that relied on the implicit read-only: false or toolset: all defaults. Users who need write access or all toolsets must now explicitly specify:

tools:
  github:
    read-only: false  # Enable write operations
    toolset: [all]    # Enable all toolsets

Explicit allowed tool lists are still preserved when specified. Only the automatic addition of default tools has been removed.

This trade-off prioritizes security, simplicity, and better defaults over implicit backward compatibility.

Testing

  • All unit tests updated and passing (100+ tests)
  • Integration tests verified for all three engines (Copilot, Claude, Codex)
  • Manual testing confirmed correct behavior for:
    • Default configuration (read-only + default toolset + wildcard tools + Copilot CLI tool arguments)
    • Explicit read-only: false override
    • Custom toolset configurations
    • Explicit allowed tool lists (still preserved)
    • Both local (Docker) and remote (hosted) modes
    • File size reduction: ~7KB per workflow (89.5 KB → 82.5 KB)
    • Copilot CLI --allow-tool github is correctly added when no allowed field is present
  • Dev workflow dynamically validates GitHub MCP tool accessibility by exploring all available tools

Migration Guide

Workflows that need write access should add:

tools:
  github:
    read-only: false

Workflows that need all toolsets should add:

tools:
  github:
    toolset: [all]

Workflows that previously relied on the automatic default tools list and need to restrict tools should add:

tools:
  github:
    allowed: [specific, tools, list]  # Explicitly specify allowed tools
Original prompt

The github mcp should be configured to use the default toolset + readonly and allow all tools instead of maintaining a list of tools.

  • read only true by default
  • default toolset is "default"

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Configure GitHub MCP to use default toolset and readonly Configure GitHub MCP defaults: read-only=true, toolset=default Oct 20, 2025
Copilot AI requested a review from pelikhan October 20, 2025 21:23
@pelikhan
Copy link
Contributor

@copilot remove the default list of tools for github (remote/local) as they are not needed

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Oct 20, 2025

@copilot remove the default list of tools for github (remote/local) as they are not needed

Done in commit 28dd843. Removed the automatic addition of default GitHub tools list. The MCP config now uses "tools": ["*"] wildcard instead of listing 50+ tools explicitly.

This reduces compiled workflow file size by ~7KB each and simplifies the configuration. Explicit allowed lists are still preserved when users specify them.

Copilot AI changed the title Configure GitHub MCP defaults: read-only=true, toolset=default Configure GitHub MCP defaults: read-only=true, toolset=default, wildcard tools Oct 20, 2025
Copy link
Contributor

@pelikhan pelikhan left a comment

Choose a reason for hiding this comment

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

@copilot when no tools are specified, copilot must have --allow-tool github

@pelikhan
Copy link
Contributor

@copilot update dev.md to use copilot, go through each tool of the github mcp and try to invoke it with sensible arguments, check that the tools are configured property (they might fail because of args but at least they got called). Fail on permission issues.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Oct 20, 2025

@copilot when no tools are specified, copilot must have --allow-tool github

Fixed in commit. When no allowed field is specified, Copilot CLI now includes --allow-tool github to grant access to the GitHub MCP server.

The logic handles three cases:

  • No allowed field → --allow-tool github
  • allowed: ["*"]--allow-tool github
  • Explicit list → --allow-tool github(tool1) etc.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Oct 20, 2025

@copilot update dev.md to use copilot, go through each tool of the github mcp and try to invoke it with sensible arguments, check that the tools are configured property (they might fail because of arg...

Updated dev.md in commit. The workflow now:

  • Uses Copilot engine (changed from Claude)
  • Tests 13+ GitHub MCP tools with sensible arguments across categories: context, repos, issues, PRs, actions, and releases
  • Validates tools are callable and properly configured
  • Fails if permission issues are detected (e.g., tool not allowed)
  • Provides summary of tool invocation results

The compiled workflow includes --allow-tool github and "tools": ["*"] configuration as expected.

Comment on lines 27 to 49
1. `get_me` - Get information about the authenticated user

### Repository Tools
2. `get_file_contents` - Get contents of README.md or another file from the repo
3. `list_branches` - List branches in the repository
4. `list_commits` - List recent commits on the main branch
5. `list_tags` - List tags in the repository
6. `search_repositories` - Search for repositories related to "github actions"

### Issues Tools
7. `list_issues` - List recent issues in the repository (state: all, per_page: 5)
8. `search_issues` - Search for issues with a keyword

### Pull Request Tools
9. `list_pull_requests` - List recent pull requests (state: all, per_page: 5)
10. `search_pull_requests` - Search for pull requests

### Actions Tools
11. `list_workflows` - List GitHub Actions workflows in the repository
12. `list_workflow_runs` - List recent workflow runs (per_page: 5)

### Release Tools
13. `list_releases` - List releases in the repository (per_page: 5)
Copy link
Contributor

Choose a reason for hiding this comment

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

@copilot tell the LLM to explore all available tools that belong to github

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in commit. The workflow now instructs the LLM to dynamically discover and test all available tools from the GitHub MCP server, rather than testing a fixed list. This makes the test more comprehensive and adaptable to changes in available tools.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI requested a review from pelikhan October 20, 2025 23:34
@pelikhan pelikhan marked this pull request as ready for review October 20, 2025 23:50
@github-actions
Copy link
Contributor

Agentic Changeset Generator triggered by this pull request.

@pelikhan pelikhan merged commit b170f87 into main Oct 20, 2025
19 checks passed
@pelikhan pelikhan deleted the copilot/configure-github-mcp-default-toolset branch October 20, 2025 23:52
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.

2 participants