Skip to content

Commit c84e958

Browse files
committed
Merge remote-tracking branch 'upstream/main' into feat/update-pull-request-tool
2 parents 110ca4c + 519ed9e commit c84e958

28 files changed

+1044
-594
lines changed

.github/workflows/code-scanning.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: "CodeQL"
2+
run-name: ${{ github.event.inputs.code_scanning_run_name }}
3+
on: [push, pull_request, workflow_dispatch]
4+
5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.ref }}
7+
cancel-in-progress: true
8+
9+
env:
10+
CODE_SCANNING_REF: ${{ github.event.inputs.code_scanning_ref }}
11+
CODE_SCANNING_BASE_BRANCH: ${{ github.event.inputs.code_scanning_base_branch }}
12+
CODE_SCANNING_IS_ANALYZING_DEFAULT_BRANCH: ${{ github.event.inputs.code_scanning_is_analyzing_default_branch }}
13+
14+
jobs:
15+
analyze:
16+
name: Analyze (${{ matrix.language }})
17+
runs-on: ${{ fromJSON(matrix.runner) }}
18+
permissions:
19+
actions: read
20+
contents: read
21+
packages: read
22+
security-events: write
23+
continue-on-error: false
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
include:
28+
- language: actions
29+
category: /language:actions
30+
build-mode: none
31+
runner: '["ubuntu-22.04"]'
32+
- language: go
33+
category: /language:go
34+
build-mode: autobuild
35+
runner: '["ubuntu-22.04"]'
36+
steps:
37+
- name: Checkout repository
38+
uses: actions/checkout@v4
39+
40+
- name: Initialize CodeQL
41+
uses: github/codeql-action/init@v3
42+
with:
43+
languages: ${{ matrix.language }}
44+
build-mode: ${{ matrix.build-mode }}
45+
dependency-caching: ${{ runner.environment == 'github-hosted' }}
46+
queries: "" # Default query suite
47+
packs: github/ccr-${{ matrix.language }}-queries
48+
config: |
49+
default-setup:
50+
org:
51+
model-packs: [ ${{ github.event.inputs.code_scanning_codeql_packs }} ]
52+
threat-models: [ ]
53+
- name: Setup proxy for registries
54+
id: proxy
55+
uses: github/codeql-action/start-proxy@v3
56+
with:
57+
registries_credentials: ${{ secrets.GITHUB_REGISTRIES_PROXY }}
58+
language: ${{ matrix.language }}
59+
60+
- name: Configure
61+
uses: github/codeql-action/resolve-environment@v3
62+
id: resolve-environment
63+
with:
64+
language: ${{ matrix.language }}
65+
- name: Setup Go
66+
uses: actions/setup-go@v5
67+
if: matrix.language == 'go' && fromJSON(steps.resolve-environment.outputs.environment).configuration.go.version
68+
with:
69+
go-version: ${{ fromJSON(steps.resolve-environment.outputs.environment).configuration.go.version }}
70+
cache: false
71+
72+
- name: Autobuild
73+
uses: github/codeql-action/autobuild@v3
74+
75+
- name: Perform CodeQL Analysis
76+
uses: github/codeql-action/analyze@v3
77+
env:
78+
CODEQL_PROXY_HOST: ${{ steps.proxy.outputs.proxy_host }}
79+
CODEQL_PROXY_PORT: ${{ steps.proxy.outputs.proxy_port }}
80+
CODEQL_PROXY_CA_CERTIFICATE: ${{ steps.proxy.outputs.proxy_ca_certificate }}
81+
with:
82+
category: ${{ matrix.category }}

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,12 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
153153
- `repo`: Repository name (string, required)
154154
- `issue_number`: Issue number (number, required)
155155

156+
- **get_issue_comments** - Get comments for a GitHub issue
157+
158+
- `owner`: Repository owner (string, required)
159+
- `repo`: Repository name (string, required)
160+
- `issue_number`: Issue number (number, required)
161+
156162
- **create_issue** - Create a new issue in a GitHub repository
157163

158164
- `owner`: Repository owner (string, required)
@@ -198,7 +204,7 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
198204
- `sort`: Sort field (string, optional)
199205
- `order`: Sort order (string, optional)
200206
- `page`: Page number (number, optional)
201-
- `per_page`: Results per page (number, optional)
207+
- `perPage`: Results per page (number, optional)
202208

203209
### Pull Requests
204210

@@ -266,7 +272,9 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
266272
- `body`: Review comment text (string, optional)
267273
- `event`: Review action ('APPROVE', 'REQUEST_CHANGES', 'COMMENT') (string, required)
268274
- `commitId`: SHA of commit to review (string, optional)
269-
- `comments`: Line-specific comments array of objects, each object with path (string), position (number), and body (string) (array, optional)
275+
- `comments`: Line-specific comments array of objects to place comments on pull request changes (array, optional)
276+
- For inline comments: provide `path`, `position` (or `line`), and `body`
277+
- For multi-line comments: provide `path`, `start_line`, `line`, optional `side`/`start_side`, and `body`
270278

271279
- **create_pull_request** - Create a new pull request
272280

cmd/github-mcp-server/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ func runStdioServer(cfg runConfig) error {
158158
t, dumpTranslations := translations.TranslationHelper()
159159

160160
// Create
161-
ghServer := github.NewServer(ghClient, cfg.readOnly, t)
161+
ghServer := github.NewServer(ghClient, version, cfg.readOnly, t)
162162
stdioServer := server.NewStdioServer(ghServer)
163163

164164
stdLogger := stdlog.New(cfg.logger.Writer(), "stdioserver", 0)

cmd/mcpcurl/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ Available Commands:
4949
create_repository Create a new GitHub repository in your account
5050
fork_repository Fork a GitHub repository to your account or specified organization
5151
get_file_contents Get the contents of a file or directory from a GitHub repository
52-
get_issue Get details of a specific issue in a GitHub repository.
52+
get_issue Get details of a specific issue in a GitHub repository
53+
get_issue_comments Get comments for a GitHub issue
5354
list_commits Get list of commits of a branch in a GitHub repository
5455
list_issues List issues in a GitHub repository with filtering options
5556
push_files Push multiple files to a GitHub repository in a single commit
@@ -73,7 +74,7 @@ Get help for a specific tool:
7374

7475
```bash
7576
% ./mcpcurl --stdio-server-cmd "docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN mcp/github" tools get_issue --help
76-
Get details of a specific issue in a GitHub repository.
77+
Get details of a specific issue in a GitHub repository
7778

7879
Usage:
7980
mcpcurl tools get_issue [flags]

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ module github.com/github/github-mcp-server
33
go 1.23.7
44

55
require (
6-
github.com/aws/smithy-go v1.22.3
76
github.com/docker/docker v28.0.4+incompatible
87
github.com/google/go-cmp v0.7.0
98
github.com/google/go-github/v69 v69.2.0

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOEl
22
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
33
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
44
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
5-
github.com/aws/smithy-go v1.22.3 h1:Z//5NuZCSW6R4PhQ93hShNbyBbn8BWCmCVCt+Q8Io5k=
6-
github.com/aws/smithy-go v1.22.3/go.mod h1:t1ufH5HMublsJYulve2RKmHDC15xu1f26kHCp/HgceI=
75
github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM=
86
github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
97
github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I=

pkg/github/code_scanning.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/mark3labs/mcp-go/server"
1414
)
1515

16-
func getCodeScanningAlert(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
16+
func GetCodeScanningAlert(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
1717
return mcp.NewTool("get_code_scanning_alert",
1818
mcp.WithDescription(t("TOOL_GET_CODE_SCANNING_ALERT_DESCRIPTION", "Get details of a specific code scanning alert in a GitHub repository.")),
1919
mcp.WithString("owner",
@@ -38,7 +38,7 @@ func getCodeScanningAlert(client *github.Client, t translations.TranslationHelpe
3838
if err != nil {
3939
return mcp.NewToolResultError(err.Error()), nil
4040
}
41-
alertNumber, err := requiredInt(request, "alertNumber")
41+
alertNumber, err := RequiredInt(request, "alertNumber")
4242
if err != nil {
4343
return mcp.NewToolResultError(err.Error()), nil
4444
}
@@ -66,7 +66,7 @@ func getCodeScanningAlert(client *github.Client, t translations.TranslationHelpe
6666
}
6767
}
6868

69-
func listCodeScanningAlerts(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
69+
func ListCodeScanningAlerts(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
7070
return mcp.NewTool("list_code_scanning_alerts",
7171
mcp.WithDescription(t("TOOL_LIST_CODE_SCANNING_ALERTS_DESCRIPTION", "List code scanning alerts in a GitHub repository.")),
7272
mcp.WithString("owner",
@@ -97,15 +97,15 @@ func listCodeScanningAlerts(client *github.Client, t translations.TranslationHel
9797
if err != nil {
9898
return mcp.NewToolResultError(err.Error()), nil
9999
}
100-
ref, err := optionalParam[string](request, "ref")
100+
ref, err := OptionalParam[string](request, "ref")
101101
if err != nil {
102102
return mcp.NewToolResultError(err.Error()), nil
103103
}
104-
state, err := optionalParam[string](request, "state")
104+
state, err := OptionalParam[string](request, "state")
105105
if err != nil {
106106
return mcp.NewToolResultError(err.Error()), nil
107107
}
108-
severity, err := optionalParam[string](request, "severity")
108+
severity, err := OptionalParam[string](request, "severity")
109109
if err != nil {
110110
return mcp.NewToolResultError(err.Error()), nil
111111
}

pkg/github/code_scanning_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
func Test_GetCodeScanningAlert(t *testing.T) {
1717
// Verify tool definition once
1818
mockClient := github.NewClient(nil)
19-
tool, _ := getCodeScanningAlert(mockClient, translations.NullTranslationHelper)
19+
tool, _ := GetCodeScanningAlert(mockClient, translations.NullTranslationHelper)
2020

2121
assert.Equal(t, "get_code_scanning_alert", tool.Name)
2222
assert.NotEmpty(t, tool.Description)
@@ -82,7 +82,7 @@ func Test_GetCodeScanningAlert(t *testing.T) {
8282
t.Run(tc.name, func(t *testing.T) {
8383
// Setup client with mock
8484
client := github.NewClient(tc.mockedClient)
85-
_, handler := getCodeScanningAlert(client, translations.NullTranslationHelper)
85+
_, handler := GetCodeScanningAlert(client, translations.NullTranslationHelper)
8686

8787
// Create call request
8888
request := createMCPRequest(tc.requestArgs)
@@ -118,7 +118,7 @@ func Test_GetCodeScanningAlert(t *testing.T) {
118118
func Test_ListCodeScanningAlerts(t *testing.T) {
119119
// Verify tool definition once
120120
mockClient := github.NewClient(nil)
121-
tool, _ := listCodeScanningAlerts(mockClient, translations.NullTranslationHelper)
121+
tool, _ := ListCodeScanningAlerts(mockClient, translations.NullTranslationHelper)
122122

123123
assert.Equal(t, "list_code_scanning_alerts", tool.Name)
124124
assert.NotEmpty(t, tool.Description)
@@ -201,7 +201,7 @@ func Test_ListCodeScanningAlerts(t *testing.T) {
201201
t.Run(tc.name, func(t *testing.T) {
202202
// Setup client with mock
203203
client := github.NewClient(tc.mockedClient)
204-
_, handler := listCodeScanningAlerts(client, translations.NullTranslationHelper)
204+
_, handler := ListCodeScanningAlerts(client, translations.NullTranslationHelper)
205205

206206
// Create call request
207207
request := createMCPRequest(tc.requestArgs)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy