Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: partition tools by product/feature#188

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
SamMorrowDrums merged 1 commit intomainfrompartition-tools
Apr 14, 2025

Conversation

SamMorrowDrums
Copy link
Collaborator

@SamMorrowDrumsSamMorrowDrums commentedApr 8, 2025
edited
Loading

Partitioned Features

This PR proposes a method for partitioning features by product area, and provides ENV and CLI flag options to configure it on server startup.

Features Configuration

The GitHub MCP Server supports enabling or disabling specific groups of functionalities via the--features flag. This allows you to control which GitHub API capabilities are available to your AI tools.

Available Features

The following feature groups are available:

FeatureDescriptionDefault Status
reposRepository-related tools (file operations, branches, commits)Enabled
issuesIssue-related tools (create, read, update, comment)Enabled
searchSearch functionality (code, repositories, users)Enabled
pull_requestsPull request operations (create, merge, review)Enabled
code_securityCode scanning alerts and security featuresDisabled
experimentsExperimental features (not considered stable)Disabled
everythingSpecial flag to enable all featuresDisabled

Specifying Features

You can enable specific features in two ways:

  1. Using Command Line Argument:

    github-mcp-server --features repos,issues,pull_requests,code_security
  2. Using Environment Variable:

    GITHUB_FEATURES="repos,issues,pull_requests,code_security" ./github-mcp-server

The environment variableGITHUB_FEATURES takes precedence over the command line argument if both are provided.

Default Enabled Features

By default, the following features are enabled:

  • repos
  • issues
  • pull_requests
  • search

Using With Docker

When using Docker, you can pass the features as environment variables:

docker run -i --rm \  -e GITHUB_PERSONAL_ACCESS_TOKEN=<your-token> \  -e GITHUB_FEATURES="repos,issues,pull_requests,code_security,experiments" \  ghcr.io/github/github-mcp-server

The "everything" Feature

The special featureeverything can be provided to enable all available features regardless of their individual settings:

./github-mcp-server --features everything

Or using the environment variable:

GITHUB_FEATURES="everything" ./github-mcp-server

@CopilotCopilotAI review requested due to automatic review settingsApril 8, 2025 23:45
Copy link
Contributor

@CopilotCopilotAI 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 partitions the GitHub MCP Server tools by product area using feature flags, and adds the necessary configuration options and tests.

  • Introduces a new "features" module to manage feature sets and enable/disable specific tools.
  • Updates the server initialization to conditionally add tools based on feature flags.
  • Adds tests and updates documentation to reflect the new configurable features.

Reviewed Changes

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

Show a summary per file
FileDescription
pkg/github/server_test.goAdded tests (e.g., Test_ListAvailableFeatures) for verifying the feature listing tool.
pkg/github/server.goModified server creation to conditionally add tools based on enabled feature flags.
pkg/features/features_test.goAdded unit tests to validate FeatureSet behavior.
pkg/features/features.goIntroduced FeatureSet implementation for feature management.
cmd/github-mcp-server/main.goUpdated CLI and environment variable parsing to initialize features.
README.mdExpanded documentation on the new features configuration and usage.
Comments suppressed due to low confidence (2)

cmd/github-mcp-server/main.go:91

  • [nitpick] Consider renaming the variable 'envFeats' to 'envFeatures' to improve clarity.
if envFeats := os.Getenv("GITHUB_FEATURES"); envFeats != "" {

pkg/features/features.go:63

  • [nitpick] Consider wrapping the feature name in quotes within the error message (e.g. "feature '%s' does not exist") for improved clarity.
return fmt.Errorf("feature %s does not exist", name)

func(_ context.Context, _ mcp.CallToolRequest) (*mcp.CallToolResult, error) {
// We need to convert the FeatureSet back to a map for JSON serialization
featureMap := make(map[string]bool)
for name := range featureSet.Features {
Copy link
Preview

CopilotAIApr 8, 2025

Choose a reason for hiding this comment

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

If a deterministic order of features is required for clients consuming the JSON output, consider sorting the feature keys before JSON marshaling.

Copilot uses AI. Check for mistakes.

}
}

func (fs *FeatureSet) AddFeature(name string, description string, enabled bool) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: if you ever need to usehttps://pkg.go.dev/io/fs in here one or the other will need to be renamed

SamMorrowDrums reacted with heart emoji
Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Great point!

@toby
Copy link
Member

toby commentedApr 9, 2025

I might consider calling them "toolsets" instead of features, just to be a bit more explicit.

@SamMorrowDrums
Copy link
CollaboratorAuthor

@toby toolsets does make sense, I hesitate a little because resources and prompts are also part of it, so I was sort of avoiding the word tool, but perhaps we just run with it?

Definitely not committed to any naming.

juruen
juruen previously approved these changesApr 10, 2025
Copy link
Collaborator

@juruenjuruen left a comment
edited
Loading

Choose a reason for hiding this comment

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

Looks good to me!

Just one super minor question: what would you think about usingall instead ofeverything?

As it's very minor, feel free to ignore it 😄

SamMorrowDrums reacted with heart emoji
toby
toby previously approved these changesApr 10, 2025
@toby
Copy link
Member

This isso great!!

tonytrg
tonytrg previously approved these changesApr 10, 2025
@tonytrg
Copy link
Contributor

Aside from the linter, do you plan on merging this soon?

@SamMorrowDrums
Copy link
CollaboratorAuthor

Yeah, I just have to finish a couple of bits. Mostly the auto tool updates. Just keep pushing the latest.

@SamMorrowDrumsSamMorrowDrums dismissed stale reviews fromtonytrg andtoby viad2588f0April 10, 2025 23:51
@SamMorrowDrumsSamMorrowDrumsforce-pushed thepartition-tools branch 2 times, most recently from0ee52f5 to9a56c25CompareApril 11, 2025 00:15
juruen
juruen previously approved these changesApr 11, 2025
Copy link
Collaborator

@juruenjuruen left a comment

Choose a reason for hiding this comment

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

Looking great! 🚀

@toby
Copy link
Member

What do you think about these options?

  1. By default we list all tools (all),except:list_available_toolsets,enable_toolset andget_toolset_tools since you won't really need them with all enabled.
  2. Use a--dynamic-toolsets flag to enablelist_available_toolsets,enable_toolset andget_toolset_tools, all other tools (exceptget_me) are hidden until enabled
  3. Use the--toolsets flag to specify active toolsets. If used in conjunction with--dynamic-toolsets they will be hidden until enabled, toolsets not specified, cannot be enabled. If the--dynamic-toolsets flag is not set, all of the tools listed in the toolsets you've enabled are listed by default.
SamMorrowDrums reacted with heart emoji

@SamMorrowDrums
Copy link
CollaboratorAuthor

I think those suggestions get us closer to a usable interface for sure, will riff on them on Monday I hope, see if we end up with something mergeable. Feels close.

README.md Outdated
- `issues`
- `pull_requests`
- `search`
- `context-_ools`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Typo

readOnly bool
writeTools []server.ServerTool
readTools []server.ServerTool
resourceTemplates []ResourceTemplate
Copy link
Collaborator

Choose a reason for hiding this comment

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

Feedback

Was a bit confusing to me that toolsets also manage resource templates. I don't see a relationship between them. Might be indicative that the abstraction is trying to do too much.

SamMorrowDrums reacted with thumbs up emoji
Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

I'll leave it separate then, initially the idea was that all features pertaining to a product area (not just tools) would be adjusted - and the naming reflected that - but I merged it into toolsets.

For now I'll leave it separate, and it can be revisited.

@SamMorrowDrumsSamMorrowDrumsforce-pushed thepartition-tools branch 2 times, most recently from45f55fc to8aba085CompareApril 14, 2025 21:04
@ismith
Copy link
Contributor

"none" also might be useful? As in, "I do not currently want any of these tools enabled, but nor do I want to remove my config entirely from settings" (and since .vscode/mcp.json is, well, json, commenting out the entire block seems like a non-starter).

@SamMorrowDrums
Copy link
CollaboratorAuthor

Interesting idea@ismith

commenting out the entire block seems like a non-starter
Actually VSCode config supports jsonc, so you can use comments, and also you can de-select the tools for an entire server in the UI, if you click on the symbol.

CleanShot 2025-04-15 at 00 33 28

Some other software might not support that, but I'm tempted to say we once this merges we could track thenone idea in an issue if you like, and see if there are others requesting the same?

@SamMorrowDrumsSamMorrowDrums merged commitff3036d intomainApr 14, 2025
16 checks passed
@SamMorrowDrumsSamMorrowDrums deleted the partition-tools branchApril 14, 2025 23:11
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@mntltymntltymntlty left review comments

@williammartinwilliammartinwilliammartin left review comments

Copilot code reviewCopilotCopilot left review comments

@tobytobytoby left review comments

@tonytrgtonytrgtonytrg left review comments

@juruenjuruenAwaiting requested review from juruen

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

7 participants
@SamMorrowDrums@toby@tonytrg@ismith@juruen@mntlty@williammartin

[8]ページ先頭

©2009-2025 Movatter.jp