Skip to content

Commit 432907e

Browse files
authored
Merge branch 'main' into feat/259/assign-reviewers
2 parents 4e28ee7 + 08a49b0 commit 432907e

File tree

18 files changed

+602
-141
lines changed

18 files changed

+602
-141
lines changed

.github/workflows/go.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
run: go mod download
2727

2828
- name: Run unit tests
29-
run: go test -race ./...
29+
run: script/test
3030

3131
- name: Build
3232
run: go build -v ./cmd/github-mcp-server

README.md

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ The following sets of tools are available (all are on by default):
269269
| `context` | **Strongly recommended**: Tools that provide context about the current user and GitHub context you are operating in |
270270
| `actions` | GitHub Actions workflows and CI/CD operations |
271271
| `code_security` | Code security related tools, such as GitHub Code Scanning |
272+
| `dependabot` | Dependabot tools |
272273
| `discussions` | GitHub Discussions related tools |
273274
| `experiments` | Experimental features that are not considered stable yet |
274275
| `issues` | GitHub Issues related tools |
@@ -477,15 +478,15 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
477478
- **list_workflow_jobs** - List workflow jobs
478479
- `filter`: Filters jobs by their completed_at timestamp (string, optional)
479480
- `owner`: Repository owner (string, required)
480-
- `page`: The page number of the results to fetch (number, optional)
481-
- `per_page`: The number of results per page (max 100) (number, optional)
481+
- `page`: Page number for pagination (min 1) (number, optional)
482+
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
482483
- `repo`: Repository name (string, required)
483484
- `run_id`: The unique identifier of the workflow run (number, required)
484485

485486
- **list_workflow_run_artifacts** - List workflow artifacts
486487
- `owner`: Repository owner (string, required)
487-
- `page`: The page number of the results to fetch (number, optional)
488-
- `per_page`: The number of results per page (max 100) (number, optional)
488+
- `page`: Page number for pagination (min 1) (number, optional)
489+
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
489490
- `repo`: Repository name (string, required)
490491
- `run_id`: The unique identifier of the workflow run (number, required)
491492

@@ -494,16 +495,16 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
494495
- `branch`: Returns workflow runs associated with a branch. Use the name of the branch. (string, optional)
495496
- `event`: Returns workflow runs for a specific event type (string, optional)
496497
- `owner`: Repository owner (string, required)
497-
- `page`: The page number of the results to fetch (number, optional)
498-
- `per_page`: The number of results per page (max 100) (number, optional)
498+
- `page`: Page number for pagination (min 1) (number, optional)
499+
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
499500
- `repo`: Repository name (string, required)
500501
- `status`: Returns workflow runs with the check run status (string, optional)
501502
- `workflow_id`: The workflow ID or workflow file name (string, required)
502503

503504
- **list_workflows** - List workflows
504505
- `owner`: Repository owner (string, required)
505-
- `page`: The page number of the results to fetch (number, optional)
506-
- `per_page`: The number of results per page (max 100) (number, optional)
506+
- `page`: Page number for pagination (min 1) (number, optional)
507+
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
507508
- `repo`: Repository name (string, required)
508509

509510
- **rerun_failed_jobs** - Rerun failed jobs
@@ -555,6 +556,23 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
555556

556557
<details>
557558

559+
<summary>Dependabot</summary>
560+
561+
- **get_dependabot_alert** - Get dependabot alert
562+
- `alertNumber`: The number of the alert. (number, required)
563+
- `owner`: The owner of the repository. (string, required)
564+
- `repo`: The name of the repository. (string, required)
565+
566+
- **list_dependabot_alerts** - List dependabot alerts
567+
- `owner`: The owner of the repository. (string, required)
568+
- `repo`: The name of the repository. (string, required)
569+
- `severity`: Filter dependabot alerts by severity (string, optional)
570+
- `state`: Filter dependabot alerts by state. Defaults to open (string, optional)
571+
572+
</details>
573+
574+
<details>
575+
558576
<summary>Discussions</summary>
559577

560578
- **get_discussion** - Get discussion
@@ -614,8 +632,8 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
614632
- **get_issue_comments** - Get issue comments
615633
- `issue_number`: Issue number (number, required)
616634
- `owner`: Repository owner (string, required)
617-
- `page`: Page number (number, optional)
618-
- `per_page`: Number of records per page (number, optional)
635+
- `page`: Page number for pagination (min 1) (number, optional)
636+
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
619637
- `repo`: Repository name (string, required)
620638

621639
- **list_issues** - List issues
@@ -904,7 +922,7 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
904922
- `page`: Page number for pagination (min 1) (number, optional)
905923
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
906924
- `repo`: Repository name (string, required)
907-
- `sha`: SHA or Branch name (string, optional)
925+
- `sha`: The commit SHA, branch name, or tag name to list commits from. If not specified, defaults to the repository's default branch. (string, optional)
908926

909927
- **list_tags** - List tags
910928
- `owner`: Repository owner (string, required)

docs/remote-server.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Below is a table of available toolsets for the remote GitHub MCP Server. Each to
2020
| all | All available GitHub MCP tools | https://api.githubcopilot.com/mcp/ | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=github&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2F%22%7D) | [read-only](https://api.githubcopilot.com/mcp/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=github&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Freadonly%22%7D) |
2121
| Actions | GitHub Actions workflows and CI/CD operations | https://api.githubcopilot.com/mcp/x/actions | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-actions&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Factions%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/actions/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-actions&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Factions%2Freadonly%22%7D) |
2222
| Code Security | Code security related tools, such as GitHub Code Scanning | https://api.githubcopilot.com/mcp/x/code_security | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-code_security&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fcode_security%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/code_security/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-code_security&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fcode_security%2Freadonly%22%7D) |
23+
| Dependabot | Dependabot tools | https://api.githubcopilot.com/mcp/x/dependabot | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-dependabot&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fdependabot%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/dependabot/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-dependabot&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fdependabot%2Freadonly%22%7D) |
2324
| Discussions | GitHub Discussions related tools | https://api.githubcopilot.com/mcp/x/discussions | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-discussions&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fdiscussions%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/discussions/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-discussions&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fdiscussions%2Freadonly%22%7D) |
2425
| Experiments | Experimental features that are not considered stable yet | https://api.githubcopilot.com/mcp/x/experiments | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-experiments&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fexperiments%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/experiments/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-experiments&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fexperiments%2Freadonly%22%7D) |
2526
| Issues | GitHub Issues related tools | https://api.githubcopilot.com/mcp/x/issues | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-issues&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fissues%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/issues/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-issues&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fissues%2Freadonly%22%7D) |
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"annotations": {
3+
"title": "Get dependabot alert",
4+
"readOnlyHint": true
5+
},
6+
"description": "Get details of a specific dependabot alert in a GitHub repository.",
7+
"inputSchema": {
8+
"properties": {
9+
"alertNumber": {
10+
"description": "The number of the alert.",
11+
"type": "number"
12+
},
13+
"owner": {
14+
"description": "The owner of the repository.",
15+
"type": "string"
16+
},
17+
"repo": {
18+
"description": "The name of the repository.",
19+
"type": "string"
20+
}
21+
},
22+
"required": [
23+
"owner",
24+
"repo",
25+
"alertNumber"
26+
],
27+
"type": "object"
28+
},
29+
"name": "get_dependabot_alert"
30+
}

pkg/github/__toolsnaps__/get_issue_comments.snap

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,14 @@
1515
"type": "string"
1616
},
1717
"page": {
18-
"description": "Page number",
18+
"description": "Page number for pagination (min 1)",
19+
"minimum": 1,
1920
"type": "number"
2021
},
21-
"per_page": {
22-
"description": "Number of records per page",
22+
"perPage": {
23+
"description": "Results per page for pagination (min 1, max 100)",
24+
"maximum": 100,
25+
"minimum": 1,
2326
"type": "number"
2427
},
2528
"repo": {

pkg/github/__toolsnaps__/list_commits.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"title": "List commits",
44
"readOnlyHint": true
55
},
6-
"description": "Get list of commits of a branch in a GitHub repository",
6+
"description": "Get list of commits of a branch in a GitHub repository. Returns at least 30 results per page by default, but can return more if specified using the perPage parameter (up to 100).",
77
"inputSchema": {
88
"properties": {
99
"author": {
@@ -30,7 +30,7 @@
3030
"type": "string"
3131
},
3232
"sha": {
33-
"description": "SHA or Branch name",
33+
"description": "The commit SHA, branch name, or tag name to list commits from. If not specified, defaults to the repository's default branch.",
3434
"type": "string"
3535
}
3636
},
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"annotations": {
3+
"title": "List dependabot alerts",
4+
"readOnlyHint": true
5+
},
6+
"description": "List dependabot alerts in a GitHub repository.",
7+
"inputSchema": {
8+
"properties": {
9+
"owner": {
10+
"description": "The owner of the repository.",
11+
"type": "string"
12+
},
13+
"repo": {
14+
"description": "The name of the repository.",
15+
"type": "string"
16+
},
17+
"severity": {
18+
"description": "Filter dependabot alerts by severity",
19+
"enum": [
20+
"low",
21+
"medium",
22+
"high",
23+
"critical"
24+
],
25+
"type": "string"
26+
},
27+
"state": {
28+
"default": "open",
29+
"description": "Filter dependabot alerts by state. Defaults to open",
30+
"enum": [
31+
"open",
32+
"fixed",
33+
"dismissed",
34+
"auto_dismissed"
35+
],
36+
"type": "string"
37+
}
38+
},
39+
"required": [
40+
"owner",
41+
"repo"
42+
],
43+
"type": "object"
44+
},
45+
"name": "list_dependabot_alerts"
46+
}

pkg/github/actions.go

Lines changed: 16 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,7 @@ func ListWorkflows(getClient GetClientFn, t translations.TranslationHelperFunc)
3737
mcp.Required(),
3838
mcp.Description(DescriptionRepositoryName),
3939
),
40-
mcp.WithNumber("per_page",
41-
mcp.Description("The number of results per page (max 100)"),
42-
),
43-
mcp.WithNumber("page",
44-
mcp.Description("The page number of the results to fetch"),
45-
),
40+
WithPagination(),
4641
),
4742
func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
4843
owner, err := RequiredParam[string](request, "owner")
@@ -55,11 +50,7 @@ func ListWorkflows(getClient GetClientFn, t translations.TranslationHelperFunc)
5550
}
5651

5752
// Get optional pagination parameters
58-
perPage, err := OptionalIntParam(request, "per_page")
59-
if err != nil {
60-
return mcp.NewToolResultError(err.Error()), nil
61-
}
62-
page, err := OptionalIntParam(request, "page")
53+
pagination, err := OptionalPaginationParams(request)
6354
if err != nil {
6455
return mcp.NewToolResultError(err.Error()), nil
6556
}
@@ -71,8 +62,8 @@ func ListWorkflows(getClient GetClientFn, t translations.TranslationHelperFunc)
7162

7263
// Set up list options
7364
opts := &github.ListOptions{
74-
PerPage: perPage,
75-
Page: page,
65+
PerPage: pagination.perPage,
66+
Page: pagination.page,
7667
}
7768

7869
workflows, resp, err := client.Actions.ListWorkflows(ctx, owner, repo, opts)
@@ -157,12 +148,7 @@ func ListWorkflowRuns(getClient GetClientFn, t translations.TranslationHelperFun
157148
mcp.Description("Returns workflow runs with the check run status"),
158149
mcp.Enum("queued", "in_progress", "completed", "requested", "waiting"),
159150
),
160-
mcp.WithNumber("per_page",
161-
mcp.Description("The number of results per page (max 100)"),
162-
),
163-
mcp.WithNumber("page",
164-
mcp.Description("The page number of the results to fetch"),
165-
),
151+
WithPagination(),
166152
),
167153
func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
168154
owner, err := RequiredParam[string](request, "owner")
@@ -197,11 +183,7 @@ func ListWorkflowRuns(getClient GetClientFn, t translations.TranslationHelperFun
197183
}
198184

199185
// Get optional pagination parameters
200-
perPage, err := OptionalIntParam(request, "per_page")
201-
if err != nil {
202-
return mcp.NewToolResultError(err.Error()), nil
203-
}
204-
page, err := OptionalIntParam(request, "page")
186+
pagination, err := OptionalPaginationParams(request)
205187
if err != nil {
206188
return mcp.NewToolResultError(err.Error()), nil
207189
}
@@ -218,8 +200,8 @@ func ListWorkflowRuns(getClient GetClientFn, t translations.TranslationHelperFun
218200
Event: event,
219201
Status: status,
220202
ListOptions: github.ListOptions{
221-
PerPage: perPage,
222-
Page: page,
203+
PerPage: pagination.perPage,
204+
Page: pagination.page,
223205
},
224206
}
225207

@@ -483,12 +465,7 @@ func ListWorkflowJobs(getClient GetClientFn, t translations.TranslationHelperFun
483465
mcp.Description("Filters jobs by their completed_at timestamp"),
484466
mcp.Enum("latest", "all"),
485467
),
486-
mcp.WithNumber("per_page",
487-
mcp.Description("The number of results per page (max 100)"),
488-
),
489-
mcp.WithNumber("page",
490-
mcp.Description("The page number of the results to fetch"),
491-
),
468+
WithPagination(),
492469
),
493470
func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
494471
owner, err := RequiredParam[string](request, "owner")
@@ -512,11 +489,7 @@ func ListWorkflowJobs(getClient GetClientFn, t translations.TranslationHelperFun
512489
}
513490

514491
// Get optional pagination parameters
515-
perPage, err := OptionalIntParam(request, "per_page")
516-
if err != nil {
517-
return mcp.NewToolResultError(err.Error()), nil
518-
}
519-
page, err := OptionalIntParam(request, "page")
492+
pagination, err := OptionalPaginationParams(request)
520493
if err != nil {
521494
return mcp.NewToolResultError(err.Error()), nil
522495
}
@@ -530,8 +503,8 @@ func ListWorkflowJobs(getClient GetClientFn, t translations.TranslationHelperFun
530503
opts := &github.ListWorkflowJobsOptions{
531504
Filter: filter,
532505
ListOptions: github.ListOptions{
533-
PerPage: perPage,
534-
Page: page,
506+
PerPage: pagination.perPage,
507+
Page: pagination.page,
535508
},
536509
}
537510

@@ -1022,12 +995,7 @@ func ListWorkflowRunArtifacts(getClient GetClientFn, t translations.TranslationH
1022995
mcp.Required(),
1023996
mcp.Description("The unique identifier of the workflow run"),
1024997
),
1025-
mcp.WithNumber("per_page",
1026-
mcp.Description("The number of results per page (max 100)"),
1027-
),
1028-
mcp.WithNumber("page",
1029-
mcp.Description("The page number of the results to fetch"),
1030-
),
998+
WithPagination(),
1031999
),
10321000
func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
10331001
owner, err := RequiredParam[string](request, "owner")
@@ -1045,11 +1013,7 @@ func ListWorkflowRunArtifacts(getClient GetClientFn, t translations.TranslationH
10451013
runID := int64(runIDInt)
10461014

10471015
// Get optional pagination parameters
1048-
perPage, err := OptionalIntParam(request, "per_page")
1049-
if err != nil {
1050-
return mcp.NewToolResultError(err.Error()), nil
1051-
}
1052-
page, err := OptionalIntParam(request, "page")
1016+
pagination, err := OptionalPaginationParams(request)
10531017
if err != nil {
10541018
return mcp.NewToolResultError(err.Error()), nil
10551019
}
@@ -1061,8 +1025,8 @@ func ListWorkflowRunArtifacts(getClient GetClientFn, t translations.TranslationH
10611025

10621026
// Set up list options
10631027
opts := &github.ListOptions{
1064-
PerPage: perPage,
1065-
Page: page,
1028+
PerPage: pagination.perPage,
1029+
Page: pagination.page,
10661030
}
10671031

10681032
artifacts, resp, err := client.Actions.ListWorkflowRunArtifacts(ctx, owner, repo, runID, opts)

pkg/github/actions_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func Test_ListWorkflows(t *testing.T) {
2323
assert.NotEmpty(t, tool.Description)
2424
assert.Contains(t, tool.InputSchema.Properties, "owner")
2525
assert.Contains(t, tool.InputSchema.Properties, "repo")
26-
assert.Contains(t, tool.InputSchema.Properties, "per_page")
26+
assert.Contains(t, tool.InputSchema.Properties, "perPage")
2727
assert.Contains(t, tool.InputSchema.Properties, "page")
2828
assert.ElementsMatch(t, tool.InputSchema.Required, []string{"owner", "repo"})
2929

@@ -393,7 +393,7 @@ func Test_ListWorkflowRunArtifacts(t *testing.T) {
393393
assert.Contains(t, tool.InputSchema.Properties, "owner")
394394
assert.Contains(t, tool.InputSchema.Properties, "repo")
395395
assert.Contains(t, tool.InputSchema.Properties, "run_id")
396-
assert.Contains(t, tool.InputSchema.Properties, "per_page")
396+
assert.Contains(t, tool.InputSchema.Properties, "perPage")
397397
assert.Contains(t, tool.InputSchema.Properties, "page")
398398
assert.ElementsMatch(t, tool.InputSchema.Required, []string{"owner", "repo", "run_id"})
399399

0 commit comments

Comments
 (0)