Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
edbdf4b
docs: Add Google Gemini CLI installation guide and integration
ipapapa Jul 26, 2025
89ec9f5
Fix Gemini CLI command syntax and add remote server method
ipapapa Aug 2, 2025
526a6c1
Merge branch 'main' into add-gemini-cli-docs
ipapapa Aug 3, 2025
0127628
Emphasize official Gemini CLI documentation link
ipapapa Aug 5, 2025
a6e2426
Fix Gemini CLI configuration file name: config.json -> settings.json
ipapapa Aug 8, 2025
bc96391
Remove Gemini CLI installation and authentication sections
ipapapa Aug 8, 2025
79e0782
Add Podman as Docker alternative in prerequisites
ipapapa Aug 8, 2025
6bfae0d
Remove references to deprecated npm package
ipapapa Aug 8, 2025
c52a1de
Add comprehensive ~/.gemini/.env file example
ipapapa Aug 8, 2025
e5e7bfd
Fix authorization header to use literal token placeholder
ipapapa Aug 8, 2025
d6696f6
Merge branch 'main' into add-gemini-cli-docs
ipapapa Aug 14, 2025
7e73679
Add issue types (#869)
JoannaaKL Aug 14, 2025
8f794ab
Enable Dependabot (#654)
zkoppert Aug 14, 2025
660967c
Bump SDK version to 0.36.0 (#863)
almaleksia Aug 14, 2025
83c67d1
Use server.ServerResourceTemplate and server.ServerPrompt wrappers (#…
almaleksia Aug 14, 2025
0d4dca9
Update "Close inactive issues" workflow to close issues after 180 day…
tommaso-moro Aug 18, 2025
34434aa
Update Claude MCP install guide after testing (#706)
D1M1TR10S Aug 18, 2025
fc381f8
Add actions job log buffer and profiler (#866)
mattdholloway Aug 19, 2025
615cc60
Add get_release_by_tag tool (#938)
tommaso-moro Aug 21, 2025
72a7214
docs(readme): Update readme to point to correct installation guides i…
beccccaboo Aug 21, 2025
cd4454e
Add Global Security Advisories Toolset (#919)
jurre Aug 21, 2025
ad3bf32
Repository security advisories (#925)
jurre Aug 21, 2025
6d4e070
Update Cursor installation link (#940)
tommaso-moro Aug 21, 2025
b33df25
Change role from "system" to "user" in prompt messages for `AssignCod…
tommaso-moro Aug 21, 2025
7acaad0
Resolve merge conflict with latest upstream main
ipapapa Aug 28, 2025
60fa301
Merge branch 'main' into add-gemini-cli-docs
LuluBeatson Aug 29, 2025
39db9e7
Local MCP is supported
LuluBeatson Aug 29, 2025
ff86293
Refactor Gemini CLI install guide
LuluBeatson Aug 29, 2025
f2e5ad7
Remove Bearer from Authorization header
ipapapa Aug 29, 2025
26d9139
Add reference to main README for latest config
ipapapa Aug 31, 2025
f86124e
Bearer needed for headers, add references
LuluBeatson Sep 2, 2025
12040db
Add minimal response to CRUD tools, `repositories` and `search` tools…
mattdholloway Sep 1, 2025
f898f17
initial org repo create support (#1023)
mattdholloway Sep 2, 2025
f6718c7
Merge branch 'main' into add-gemini-cli-docs
LuluBeatson Sep 2, 2025
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
Prev Previous commit
Next Next commit
Add Global Security Advisories Toolset (#919)
  • Loading branch information
jurre authored and ipapapa committed Aug 28, 2025
commit cd4454e11e3d95920c3db9739ba0b6471ecc8ae6
27 changes: 25 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Alternatively, to manually configure VS Code, choose the appropriate JSON block
<tr><th align=left colspan=2>VS Code (version 1.101 or greater)</th></tr>
<tr valign=top>
<td>

```json
{
"servers": {
Expand Down Expand Up @@ -130,7 +130,7 @@ To keep your GitHub PAT secure and reusable across different MCP hosts:
```bash
# CLI usage
claude mcp update github -e GITHUB_PERSONAL_ACCESS_TOKEN=$GITHUB_PAT

# In config files (where supported)
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "$GITHUB_PAT"
Expand Down Expand Up @@ -296,6 +296,7 @@ The following sets of tools are available (all are on by default):
| `pull_requests` | GitHub Pull Request related tools |
| `repos` | GitHub Repository related tools |
| `secret_protection` | Secret protection related tools, such as GitHub Secret Scanning |
| `security_advisories` | Security advisories related tools |
| `users` | GitHub User related tools |
<!-- END AUTOMATED TOOLSETS -->

Expand Down Expand Up @@ -924,6 +925,28 @@ The following sets of tools are available (all are on by default):

<details>

<summary>Security Advisories</summary>

- **get_global_security_advisory** - Get a global security advisory
- `ghsaId`: GitHub Security Advisory ID (format: GHSA-xxxx-xxxx-xxxx). (string, required)

- **list_global_security_advisories** - List global security advisories
- `affects`: Filter advisories by affected package or version (e.g. "package1,package2@1.0.0"). (string, optional)
- `cveId`: Filter by CVE ID. (string, optional)
- `cwes`: Filter by Common Weakness Enumeration IDs (e.g. ["79", "284", "22"]). (string[], optional)
- `ecosystem`: Filter by package ecosystem. (string, optional)
- `ghsaId`: Filter by GitHub Security Advisory ID (format: GHSA-xxxx-xxxx-xxxx). (string, optional)
- `isWithdrawn`: Whether to only return withdrawn advisories. (boolean, optional)
- `modified`: Filter by publish or update date or date range (ISO 8601 date or range). (string, optional)
- `published`: Filter by publish date or date range (ISO 8601 date or range). (string, optional)
- `severity`: Filter by severity. (string, optional)
- `type`: Advisory type. (string, optional)
- `updated`: Filter by update date or date range (ISO 8601 date or range). (string, optional)

</details>

<details>

<summary>Users</summary>

- **search_users** - Search users
Expand Down
2 changes: 1 addition & 1 deletion docs/installation-guides/install-gemini-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ gemini "Analyze the security alerts in my repositories"
### Configuration Issues
- **Invalid JSON**: Validate your configuration:
```bash
cat ~/.gemini/config.json | jq .
cat ~/.gemini/settings.json | jq .
```
- **MCP connection issues**: Check logs for connection errors:
```bash
Expand Down
1 change: 1 addition & 0 deletions docs/remote-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Below is a table of available toolsets for the remote GitHub MCP Server. Each to
| Pull Requests | GitHub Pull Request related tools | https://api.githubcopilot.com/mcp/x/pull_requests | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-pull_requests&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fpull_requests%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/pull_requests/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-pull_requests&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fpull_requests%2Freadonly%22%7D) |
| Repositories | GitHub Repository related tools | https://api.githubcopilot.com/mcp/x/repos | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-repos&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Frepos%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/repos/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-repos&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Frepos%2Freadonly%22%7D) |
| Secret Protection | Secret protection related tools, such as GitHub Secret Scanning | https://api.githubcopilot.com/mcp/x/secret_protection | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-secret_protection&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fsecret_protection%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/secret_protection/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-secret_protection&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fsecret_protection%2Freadonly%22%7D) |
| Security Advisories | Security advisories related tools | https://api.githubcopilot.com/mcp/x/security_advisories | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-security_advisories&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fsecurity_advisories%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/security_advisories/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-security_advisories&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fsecurity_advisories%2Freadonly%22%7D) |
| Users | GitHub User related tools | https://api.githubcopilot.com/mcp/x/users | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-users&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fusers%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/users/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-users&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fusers%2Freadonly%22%7D) |

<!-- END AUTOMATED TOOLSETS -->
Expand Down
228 changes: 228 additions & 0 deletions pkg/github/security_advisories.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
package github

import (
"context"
"encoding/json"
"fmt"
"io"
"net/http"

"github.com/github/github-mcp-server/pkg/translations"
"github.com/google/go-github/v74/github"
"github.com/mark3labs/mcp-go/mcp"
"github.com/mark3labs/mcp-go/server"
)

func ListGlobalSecurityAdvisories(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
return mcp.NewTool("list_global_security_advisories",
mcp.WithDescription(t("TOOL_LIST_GLOBAL_SECURITY_ADVISORIES_DESCRIPTION", "List global security advisories from GitHub.")),
mcp.WithToolAnnotation(mcp.ToolAnnotation{
Title: t("TOOL_LIST_GLOBAL_SECURITY_ADVISORIES_USER_TITLE", "List global security advisories"),
ReadOnlyHint: ToBoolPtr(true),
}),
mcp.WithString("ghsaId",
mcp.Description("Filter by GitHub Security Advisory ID (format: GHSA-xxxx-xxxx-xxxx)."),
),
mcp.WithString("type",
mcp.Description("Advisory type."),
mcp.Enum("reviewed", "malware", "unreviewed"),
mcp.DefaultString("reviewed"),
),
mcp.WithString("cveId",
mcp.Description("Filter by CVE ID."),
),
mcp.WithString("ecosystem",
mcp.Description("Filter by package ecosystem."),
mcp.Enum("actions", "composer", "erlang", "go", "maven", "npm", "nuget", "other", "pip", "pub", "rubygems", "rust"),
),
mcp.WithString("severity",
mcp.Description("Filter by severity."),
mcp.Enum("unknown", "low", "medium", "high", "critical"),
),
mcp.WithArray("cwes",
mcp.Description("Filter by Common Weakness Enumeration IDs (e.g. [\"79\", \"284\", \"22\"])."),
mcp.Items(map[string]any{
"type": "string",
}),
),
mcp.WithBoolean("isWithdrawn",
mcp.Description("Whether to only return withdrawn advisories."),
),
mcp.WithString("affects",
mcp.Description("Filter advisories by affected package or version (e.g. \"package1,package2@1.0.0\")."),
),
mcp.WithString("published",
mcp.Description("Filter by publish date or date range (ISO 8601 date or range)."),
),
mcp.WithString("updated",
mcp.Description("Filter by update date or date range (ISO 8601 date or range)."),
),
mcp.WithString("modified",
mcp.Description("Filter by publish or update date or date range (ISO 8601 date or range)."),
),
), func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
client, err := getClient(ctx)
if err != nil {
return nil, fmt.Errorf("failed to get GitHub client: %w", err)
}

ghsaID, err := OptionalParam[string](request, "ghsaId")
if err != nil {
return mcp.NewToolResultError(fmt.Sprintf("invalid ghsaId: %v", err)), nil
}

typ, err := OptionalParam[string](request, "type")
if err != nil {
return mcp.NewToolResultError(fmt.Sprintf("invalid type: %v", err)), nil
}

cveID, err := OptionalParam[string](request, "cveId")
if err != nil {
return mcp.NewToolResultError(fmt.Sprintf("invalid cveId: %v", err)), nil
}

eco, err := OptionalParam[string](request, "ecosystem")
if err != nil {
return mcp.NewToolResultError(fmt.Sprintf("invalid ecosystem: %v", err)), nil
}

sev, err := OptionalParam[string](request, "severity")
if err != nil {
return mcp.NewToolResultError(fmt.Sprintf("invalid severity: %v", err)), nil
}

cwes, err := OptionalParam[[]string](request, "cwes")
if err != nil {
return mcp.NewToolResultError(fmt.Sprintf("invalid cwes: %v", err)), nil
}

isWithdrawn, err := OptionalParam[bool](request, "isWithdrawn")
if err != nil {
return mcp.NewToolResultError(fmt.Sprintf("invalid isWithdrawn: %v", err)), nil
}

affects, err := OptionalParam[string](request, "affects")
if err != nil {
return mcp.NewToolResultError(fmt.Sprintf("invalid affects: %v", err)), nil
}

published, err := OptionalParam[string](request, "published")
if err != nil {
return mcp.NewToolResultError(fmt.Sprintf("invalid published: %v", err)), nil
}

updated, err := OptionalParam[string](request, "updated")
if err != nil {
return mcp.NewToolResultError(fmt.Sprintf("invalid updated: %v", err)), nil
}

modified, err := OptionalParam[string](request, "modified")
if err != nil {
return mcp.NewToolResultError(fmt.Sprintf("invalid modified: %v", err)), nil
}

opts := &github.ListGlobalSecurityAdvisoriesOptions{}

if ghsaID != "" {
opts.GHSAID = &ghsaID
}
if typ != "" {
opts.Type = &typ
}
if cveID != "" {
opts.CVEID = &cveID
}
if eco != "" {
opts.Ecosystem = &eco
}
if sev != "" {
opts.Severity = &sev
}
if len(cwes) > 0 {
opts.CWEs = cwes
}

if isWithdrawn {
opts.IsWithdrawn = &isWithdrawn
}

if affects != "" {
opts.Affects = &affects
}
if published != "" {
opts.Published = &published
}
if updated != "" {
opts.Updated = &updated
}
if modified != "" {
opts.Modified = &modified
}

advisories, resp, err := client.SecurityAdvisories.ListGlobalSecurityAdvisories(ctx, opts)
if err != nil {
return nil, fmt.Errorf("failed to list global security advisories: %w", err)
}
defer func() { _ = resp.Body.Close() }()

if resp.StatusCode != http.StatusOK {
body, err := io.ReadAll(resp.Body)
if err != nil {
return nil, fmt.Errorf("failed to read response body: %w", err)
}
return mcp.NewToolResultError(fmt.Sprintf("failed to list advisories: %s", string(body))), nil
}

r, err := json.Marshal(advisories)
if err != nil {
return nil, fmt.Errorf("failed to marshal advisories: %w", err)
}

return mcp.NewToolResultText(string(r)), nil
}
}

func GetGlobalSecurityAdvisory(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
return mcp.NewTool("get_global_security_advisory",
mcp.WithDescription(t("TOOL_GET_GLOBAL_SECURITY_ADVISORY_DESCRIPTION", "Get a global security advisory")),
mcp.WithToolAnnotation(mcp.ToolAnnotation{
Title: t("TOOL_GET_GLOBAL_SECURITY_ADVISORY_USER_TITLE", "Get a global security advisory"),
ReadOnlyHint: ToBoolPtr(true),
}),
mcp.WithString("ghsaId",
mcp.Description("GitHub Security Advisory ID (format: GHSA-xxxx-xxxx-xxxx)."),
mcp.Required(),
),
), func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
client, err := getClient(ctx)
if err != nil {
return nil, fmt.Errorf("failed to get GitHub client: %w", err)
}

ghsaID, err := RequiredParam[string](request, "ghsaId")
if err != nil {
return mcp.NewToolResultError(fmt.Sprintf("invalid ghsaId: %v", err)), nil
}

advisory, resp, err := client.SecurityAdvisories.GetGlobalSecurityAdvisories(ctx, ghsaID)
if err != nil {
return nil, fmt.Errorf("failed to get advisory: %w", err)
}
defer func() { _ = resp.Body.Close() }()

if resp.StatusCode != http.StatusOK {
body, err := io.ReadAll(resp.Body)
if err != nil {
return nil, fmt.Errorf("failed to read response body: %w", err)
}
return mcp.NewToolResultError(fmt.Sprintf("failed to get advisory: %s", string(body))), nil
}

r, err := json.Marshal(advisory)
if err != nil {
return nil, fmt.Errorf("failed to marshal advisory: %w", err)
}

return mcp.NewToolResultText(string(r)), nil
}
}
Loading