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
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,16 @@ For negotiated supported protocol versions `2026-07-28` or newer, the consolidat
- `severity`: Filter dependabot alerts by severity (string, optional)
- `state`: Filter dependabot alerts by state. Defaults to open (string, optional)

- **update_dependabot_alert** - Update Dependabot alert
- **OAuth Challenge Scopes**: `security_events`
- `alertNumber`: The repository's Dependabot alert number. (integer, required)
- `assignees`: Usernames replacing the entire assignee set; [] clears all, omission leaves it unchanged. Including copilot-swe-agent[bot] requests remediation, not just ownership bookkeeping. (string[], optional)
- `dismissed_comment`: Optional dismissal comment, up to 280 characters; not a standalone comment API. (string, optional)
- `dismissed_reason`: Required when state is dismissed. (string, optional)
- `owner`: Repository owner (username or organization). (string, required)
- `repo`: Repository name. (string, required)
- `state`: Reopen or dismiss the alert. Omission leaves state unchanged. (string, optional)

</details>

<details>
Expand Down
21 changes: 21 additions & 0 deletions cmd/github-mcp-server/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import (
"strings"
"testing"

"github.com/github/github-mcp-server/v2/pkg/github"
"github.com/github/github-mcp-server/v2/pkg/inventory"
"github.com/github/github-mcp-server/v2/pkg/scopes"
"github.com/github/github-mcp-server/v2/pkg/translations"
"github.com/google/jsonschema-go/jsonschema"
"github.com/modelcontextprotocol/go-sdk/mcp"
"github.com/spf13/viper"
Expand Down Expand Up @@ -68,6 +70,25 @@ func TestWriteToolDocScopes(t *testing.T) {
assert.Contains(t, buf.String(), "**OAuth Challenge Scopes**: `delete_repo`, `repo`")
}

func TestDependabotUpdateListScopes(t *testing.T) {
for _, readOnly := range []bool{false, true} {
inv, err := github.NewInventory(translations.NullTranslationHelper).
WithToolsets([]string{"dependabot"}).WithReadOnly(readOnly).Build()
require.NoError(t, err)
output := collectToolScopes(inv, readOnly)
if readOnly {
assert.NotContains(t, output.ScopesByTool, "update_dependabot_alert")
continue
}
assert.Equal(t, []string{"security_events"}, output.ScopesByTool["update_dependabot_alert"])
assert.Contains(t, output.ToolsByScope["security_events"], "update_dependabot_alert")
assert.Contains(t, output.Tools, ToolScopeInfo{
Name: "update_dependabot_alert", Toolset: "dependabot",
ReadOnly: false, ChallengeScopes: []string{"security_events"},
})
}
}

func TestSchemaTypeString(t *testing.T) {
tests := []struct {
name string
Expand Down
124 changes: 124 additions & 0 deletions pkg/github/__toolsnaps__/update_dependabot_alert.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
{
"annotations": {
"destructiveHint": true,
"idempotentHint": false,
"openWorldHint": true,
"readOnlyHint": false,
"title": "Update Dependabot alert"
},
"description": "Update a Dependabot alert's state or assignees. Provide state or assignees; dismissal requires dismissed_reason. Assigning copilot-swe-agent[bot] requests remediation that attempts a fix; a pull request is not guaranteed. Requires Dependabot alerts write permission or the security_events OAuth scope. GitHub enforces authorization, licensing, repository policies and delegated-dismissal review requirements. Agent configuration (agent_assignment) is not supported.",
"inputSchema": {
"additionalProperties": false,
"properties": {
"alertNumber": {
"description": "The repository's Dependabot alert number.",
"minimum": 1,
"type": "integer"
},
"assignees": {
"description": "Usernames replacing the entire assignee set; [] clears all, omission leaves it unchanged. Including copilot-swe-agent[bot] requests remediation, not just ownership bookkeeping.",
"items": {
"type": "string"
},
"type": "array"
},
"dismissed_comment": {
"description": "Optional dismissal comment, up to 280 characters; not a standalone comment API.",
"maxLength": 280,
"type": "string"
},
"dismissed_reason": {
"description": "Required when state is dismissed.",
"enum": [
"fix_started",
"inaccurate",
"no_bandwidth",
"not_used",
"tolerable_risk"
],
"type": "string"
},
"owner": {
"description": "Repository owner (username or organization).",
"minLength": 1,
"type": "string"
},
"repo": {
"description": "Repository name.",
"minLength": 1,
"type": "string"
},
"state": {
"description": "Reopen or dismiss the alert. Omission leaves state unchanged.",
"enum": [
"open",
"dismissed"
],
"type": "string"
}
},
"required": [
"owner",
"repo",
"alertNumber"
],
"type": "object"
},
"name": "update_dependabot_alert",
"outputSchema": {
"additionalProperties": false,
"properties": {
"assignees": {
"items": {
"additionalProperties": false,
"properties": {
"login": {
"type": "string"
}
},
"required": [
"login"
],
"type": "object"
},
"type": [
"null",
"array"
]
},
"dismissed_comment": {
"type": [
"null",
"string"
]
},
"dismissed_reason": {
"type": [
"null",
"string"
]
},
"html_url": {
"type": "string"
},
"number": {
"description": "Exact alert number as a decimal string to preserve integer precision.",
"type": "string"
},
"state": {
"type": "string"
}
},
"required": [
"number",
"state",
"html_url",
"dismissed_reason",
"dismissed_comment"
],
"type": [
"null",
"object"
]
}
}
1 change: 1 addition & 0 deletions pkg/github/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ func AllTools(t translations.TranslationHelperFunc, opts ...ToolOption) []invent
// Dependabot tools
GetDependabotAlert(t),
ListDependabotAlerts(t),
UpdateDependabotAlert(t),

// Notification tools
ListNotifications(t),
Expand Down
2 changes: 2 additions & 0 deletions pkg/github/typed_security_outputs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ func securityOutputSchema(t *testing.T, name string) *jsonschema.Schema {
schema, err = jsonschema.For[*DependabotAlertOutput](nil)
case "list_dependabot_alerts":
schema, err = jsonschema.For[DependabotAlertsOutput](nil)
case "update_dependabot_alert":
schema, err = jsonschema.For[*DependabotAlertUpdateOutput](nil)
case "get_global_security_advisory":
schema, err = jsonschema.For[*GlobalSecurityAdvisoryOutput](nil)
case "list_global_security_advisories":
Expand Down
Loading
Loading