Skip to content

Conversation

@SamMorrowDrums
Copy link
Collaborator

Add a read-only flag and gate endpoints that would otherwise write behind it, so that people can avoid the risk that an LLM can write to their GitHub account entirely.

Copilot AI review requested due to automatic review settings March 20, 2025 16:10
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 introduces a read-only flag that restricts write operations within the GitHub MCP server to help prevent unauthorized modifications.

  • Added a new persistent flag "read-only" and bound it via viper in cmd/github-mcp-server/main.go.
  • Updated the runStdioServer function signature and its invocation to include the readOnly parameter.
  • Modified the NewServer function in pkg/github/server.go to conditionally add write tools based on the readOnly flag.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
cmd/github-mcp-server/main.go Added a "read-only" flag and updated function calls to pass the flag value.
pkg/github/server.go Updated the NewServer function to gate write operations using the readOnly flag.
Comments suppressed due to low confidence (1)

pkg/github/server.go:37

  • The new condition controlling the addition of write-related tools for GitHub operations is introduced here without associated tests.
if !readOnly { 

Tip: Copilot code review supports C#, Go, Java, JavaScript, Markdown, Python, Ruby and TypeScript, with more languages coming soon. Learn more

Copy link
Collaborator

@juruen juruen left a comment

Choose a reason for hiding this comment

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

🚀

@SamMorrowDrums SamMorrowDrums merged commit 3f7d5b0 into main Mar 20, 2025
3 checks passed
DaleSeo pushed a commit to DaleSeo/github-mcp-server that referenced this pull request Oct 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants