Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,14 @@ The following sets of tools are available (all are on by default):

| Toolset | Description |
| ----------------------- | ------------------------------------------------------------- |
| `repos` | Repository-related tools (file operations, branches, commits) |
| `context` | **Strongly recommended**: Tools that provide context about the current user and GitHub context you are operating in |
| `code_security` | Code scanning alerts and security features |
| `issues` | Issue-related tools (create, read, update, comment) |
| `users` | Anything relating to GitHub Users |
| `notifications` | GitHub Notifications related tools |
| `pull_requests` | Pull request operations (create, merge, review) |
| `code_security` | Code scanning alerts and security features |
| `repos` | Repository-related tools (file operations, branches, commits) |
| `secret_protection` | Secret protection related tools, such as GitHub Secret Scanning |
| `users` | Anything relating to GitHub Users |
| `experiments` | Experimental features (not considered stable) |

#### Specifying Toolsets
Expand Down
2 changes: 0 additions & 2 deletions internal/ghmcp/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,10 @@ func NewMCPServer(cfg MCPServerConfig) (*server.MCPServer, error) {
return nil, fmt.Errorf("failed to enable toolsets: %w", err)
}

context := github.InitContextToolset(getClient, cfg.Translator)
github.RegisterResources(ghServer, getClient, cfg.Translator)

// Register the tools with the server
tsg.RegisterTools(ghServer)
context.RegisterTools(ghServer)

if cfg.DynamicToolsets {
dynamic := github.InitDynamicToolset(ghServer, tsg, cfg.Translator)
Expand Down
1 change: 1 addition & 0 deletions pkg/github/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ func SearchUsers(getClient GetClientFn, t translations.TranslationHelperFunc) (t
}

client, err := getClient(ctx)

if err != nil {
return nil, fmt.Errorf("failed to get GitHub client: %w", err)
}
Expand Down
16 changes: 6 additions & 10 deletions pkg/github/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,13 @@ func DefaultToolsetGroup(readOnly bool, getClient GetClientFn, getGQLClient GetG
// Keep experiments alive so the system doesn't error out when it's always enabled
experiments := toolsets.NewToolset("experiments", "Experimental features that are not considered stable yet")

contextTools := toolsets.NewToolset("context", "Tools that provide context about the current user and GitHub context you are operating in").
AddReadTools(
toolsets.NewServerTool(GetMe(getClient, t)),
)

// Add toolsets to the group
tsg.AddToolset(contextTools)
tsg.AddToolset(repos)
tsg.AddToolset(issues)
tsg.AddToolset(users)
Expand All @@ -119,16 +125,6 @@ func DefaultToolsetGroup(readOnly bool, getClient GetClientFn, getGQLClient GetG
return tsg
}

func InitContextToolset(getClient GetClientFn, t translations.TranslationHelperFunc) *toolsets.Toolset {
// Create a new context toolset
contextTools := toolsets.NewToolset("context", "Tools that provide context about the current user and GitHub context you are operating in").
AddReadTools(
toolsets.NewServerTool(GetMe(getClient, t)),
)
contextTools.Enabled = true
return contextTools
}

// InitDynamicToolset creates a dynamic toolset that can be used to enable other toolsets, and so requires the server and toolset group as arguments
func InitDynamicToolset(s *server.MCPServer, tsg *toolsets.ToolsetGroup, t translations.TranslationHelperFunc) *toolsets.Toolset {
// Create a new dynamic toolset
Expand Down