Skip to content

feat: read-only flag #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 20, 2025
Merged

feat: read-only flag #29

merged 1 commit into from
Mar 20, 2025

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 Copilot AI review requested due to automatic review settings March 20, 2025 16:10
Copy link
Contributor

@Copilot 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
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