Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 4 additions & 2 deletions cmd/github-mcp-server/generate_docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ func generateReadmeDocs(readmePath string) error {
t, _ := translations.TranslationHelper()

// (not available to regular users) while including tools with FeatureFlagDisable.
r := github.NewInventory(t).WithToolsets([]string{"all"}).Build()
// Build() can only fail if WithTools specifies invalid tools - not used here
r, _ := github.NewInventory(t).WithToolsets([]string{"all"}).Build()

// Generate toolsets documentation
toolsetsDoc := generateToolsetsDoc(r)
Expand Down Expand Up @@ -341,7 +342,8 @@ func generateRemoteToolsetsDoc() string {
t, _ := translations.TranslationHelper()

// Build inventory - stateless
r := github.NewInventory(t).Build()
// Build() can only fail if WithTools specifies invalid tools - not used here
r, _ := github.NewInventory(t).Build()

// Generate table header (icon is combined with Name column)
buf.WriteString("| Name | Description | API URL | 1-Click Install (VS Code) | Read-only Link | 1-Click Read-only Install (VS Code) |\n")
Expand Down
5 changes: 4 additions & 1 deletion cmd/github-mcp-server/list_scopes.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@ func runListScopes() error {
inventoryBuilder = inventoryBuilder.WithTools(enabledTools)
}

inv := inventoryBuilder.Build()
inv, err := inventoryBuilder.Build()
if err != nil {
return fmt.Errorf("failed to build inventory: %w", err)
}

// Collect all tools and their scopes
output := collectToolScopes(inv, readOnly)
Expand Down
7 changes: 5 additions & 2 deletions internal/ghmcp/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,18 @@ func NewMCPServer(cfg MCPServerConfig) (*mcp.Server, error) {
WithDeprecatedAliases(github.DeprecatedToolAliases).
WithReadOnly(cfg.ReadOnly).
WithToolsets(enabledToolsets).
WithTools(github.CleanTools(cfg.EnabledTools)).
WithTools(cfg.EnabledTools).
WithFeatureChecker(createFeatureChecker(cfg.EnabledFeatures))

// Apply token scope filtering if scopes are known (for PAT filtering)
if cfg.TokenScopes != nil {
inventoryBuilder = inventoryBuilder.WithFilter(github.CreateToolScopeFilter(cfg.TokenScopes))
}

inventory := inventoryBuilder.Build()
inventory, err := inventoryBuilder.Build()
if err != nil {
return nil, fmt.Errorf("failed to build inventory: %w", err)
}

if unrecognized := inventory.UnrecognizedToolsets(); len(unrecognized) > 0 {
fmt.Fprintf(os.Stderr, "Warning: unrecognized toolsets ignored: %s\n", strings.Join(unrecognized, ", "))
Expand Down
14 changes: 7 additions & 7 deletions pkg/github/__toolsnaps__/actions_get.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@
"description": "Get details about specific GitHub Actions resources.\nUse this tool to get details about individual workflows, workflow runs, jobs, and artifacts by their unique IDs.\n",
"inputSchema": {
"type": "object",
"required": [
"method",
"owner",
"repo",
"resource_id"
],
"properties": {
"method": {
"type": "string",
Expand All @@ -37,7 +31,13 @@
"type": "string",
"description": "The unique identifier of the resource. This will vary based on the \"method\" provided, so ensure you provide the correct ID:\n- Provide a workflow ID or workflow file name (e.g. ci.yaml) for 'get_workflow' method.\n- Provide a workflow run ID for 'get_workflow_run', 'get_workflow_run_usage', and 'get_workflow_run_logs_url' methods.\n- Provide an artifact ID for 'download_workflow_run_artifact' method.\n- Provide a job ID for 'get_workflow_job' method.\n"
}
}
},
"required": [
"method",
"owner",
"repo",
"resource_id"
]
},
"name": "actions_get"
}
12 changes: 6 additions & 6 deletions pkg/github/__toolsnaps__/actions_run_trigger.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
"description": "Trigger GitHub Actions workflow operations, including running, re-running, cancelling workflow runs, and deleting workflow run logs.",
"inputSchema": {
"type": "object",
"required": [
"method",
"owner",
"repo"
],
"properties": {
"inputs": {
"type": "object",
Expand Down Expand Up @@ -47,7 +42,12 @@
"type": "string",
"description": "The workflow ID (numeric) or workflow file name (e.g., main.yml, ci.yaml). Required for 'run_workflow' method."
}
}
},
"required": [
"method",
"owner",
"repo"
]
},
"name": "actions_run_trigger"
}
18 changes: 9 additions & 9 deletions pkg/github/__toolsnaps__/add_comment_to_pending_review.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@
"description": "Add review comment to the requester's latest pending pull request review. A pending review needs to already exist to call this (check with the user if not sure).",
"inputSchema": {
"type": "object",
"required": [
"owner",
"repo",
"pullNumber",
"path",
"body",
"subjectType"
],
"properties": {
"body": {
"type": "string",
Expand Down Expand Up @@ -66,7 +58,15 @@
"LINE"
]
}
}
},
"required": [
"owner",
"repo",
"pullNumber",
"path",
"body",
"subjectType"
]
},
"name": "add_comment_to_pending_review"
}
14 changes: 7 additions & 7 deletions pkg/github/__toolsnaps__/add_issue_comment.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@
"description": "Add a comment to a specific issue in a GitHub repository. Use this tool to add comments to pull requests as well (in this case pass pull request number as issue_number), but only if user is not asking specifically to add review comments.",
"inputSchema": {
"type": "object",
"required": [
"owner",
"repo",
"issue_number",
"body"
],
"properties": {
"body": {
"type": "string",
Expand All @@ -28,7 +22,13 @@
"type": "string",
"description": "Repository name"
}
}
},
"required": [
"owner",
"repo",
"issue_number",
"body"
]
},
"name": "add_issue_comment"
}
16 changes: 8 additions & 8 deletions pkg/github/__toolsnaps__/add_project_item.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@
"description": "Add a specific Project item for a user or org",
"inputSchema": {
"type": "object",
"required": [
"owner_type",
"owner",
"project_number",
"item_type",
"item_id"
],
"properties": {
"item_id": {
"type": "number",
Expand Down Expand Up @@ -41,7 +34,14 @@
"type": "number",
"description": "The project's number."
}
}
},
"required": [
"owner_type",
"owner",
"project_number",
"item_type",
"item_id"
]
},
"name": "add_project_item"
}
12 changes: 6 additions & 6 deletions pkg/github/__toolsnaps__/cancel_workflow_run.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
"description": "Cancel a workflow run",
"inputSchema": {
"type": "object",
"required": [
"owner",
"repo",
"run_id"
],
"properties": {
"owner": {
"type": "string",
Expand All @@ -23,7 +18,12 @@
"type": "number",
"description": "The unique identifier of the workflow run"
}
}
},
"required": [
"owner",
"repo",
"run_id"
]
},
"name": "cancel_workflow_run"
}
12 changes: 6 additions & 6 deletions pkg/github/__toolsnaps__/create_branch.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
"description": "Create a new branch in a GitHub repository",
"inputSchema": {
"type": "object",
"required": [
"owner",
"repo",
"branch"
],
"properties": {
"branch": {
"type": "string",
Expand All @@ -27,7 +22,12 @@
"type": "string",
"description": "Repository name"
}
}
},
"required": [
"owner",
"repo",
"branch"
]
},
"name": "create_branch"
}
10 changes: 5 additions & 5 deletions pkg/github/__toolsnaps__/create_gist.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
"description": "Create a new gist",
"inputSchema": {
"type": "object",
"required": [
"filename",
"content"
],
"properties": {
"content": {
"type": "string",
Expand All @@ -27,7 +23,11 @@
"description": "Whether the gist is public",
"default": false
}
}
},
"required": [
"filename",
"content"
]
},
"name": "create_gist"
}
18 changes: 9 additions & 9 deletions pkg/github/__toolsnaps__/create_or_update_file.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@
"description": "Create or update a single file in a GitHub repository. \nIf updating, you should provide the SHA of the file you want to update. Use this tool to create or update a file in a GitHub repository remotely; do not use it for local file operations.\n\nIn order to obtain the SHA of original file version before updating, use the following git command:\ngit ls-tree HEAD \u003cpath to file\u003e\n\nIf the SHA is not provided, the tool will attempt to acquire it by fetching the current file contents from the repository, which may lead to rewriting latest committed changes if the file has changed since last retrieval.\n",
"inputSchema": {
"type": "object",
"required": [
"owner",
"repo",
"path",
"content",
"message",
"branch"
],
"properties": {
"branch": {
"type": "string",
Expand Down Expand Up @@ -42,7 +34,15 @@
"type": "string",
"description": "The blob SHA of the file being replaced."
}
}
},
"required": [
"owner",
"repo",
"path",
"content",
"message",
"branch"
]
},
"name": "create_or_update_file"
}
16 changes: 8 additions & 8 deletions pkg/github/__toolsnaps__/create_pull_request.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@
"description": "Create a new pull request in a GitHub repository.",
"inputSchema": {
"type": "object",
"required": [
"owner",
"repo",
"title",
"head",
"base"
],
"properties": {
"base": {
"type": "string",
Expand Down Expand Up @@ -45,7 +38,14 @@
"type": "string",
"description": "PR title"
}
}
},
"required": [
"owner",
"repo",
"title",
"head",
"base"
]
},
"name": "create_pull_request"
}
8 changes: 4 additions & 4 deletions pkg/github/__toolsnaps__/create_repository.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
"description": "Create a new GitHub repository in your account or specified organization",
"inputSchema": {
"type": "object",
"required": [
"name"
],
"properties": {
"autoInit": {
"type": "boolean",
Expand All @@ -29,7 +26,10 @@
"type": "boolean",
"description": "Whether repo should be private"
}
}
},
"required": [
"name"
]
},
"name": "create_repository"
}
16 changes: 8 additions & 8 deletions pkg/github/__toolsnaps__/delete_file.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@
"description": "Delete a file from a GitHub repository",
"inputSchema": {
"type": "object",
"required": [
"owner",
"repo",
"path",
"message",
"branch"
],
"properties": {
"branch": {
"type": "string",
Expand All @@ -34,7 +27,14 @@
"type": "string",
"description": "Repository name"
}
}
},
"required": [
"owner",
"repo",
"path",
"message",
"branch"
]
},
"name": "delete_file"
}
Loading