Skip to content

Commit f107159

Browse files
Merge branch 'main' into patch-1
2 parents 646a60f + b1575ed commit f107159

File tree

8 files changed

+405
-10
lines changed

8 files changed

+405
-10
lines changed

.github/workflows/docker-publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ jobs:
7070
# https://github.com/docker/metadata-action
7171
- name: Extract Docker metadata
7272
id: meta
73-
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
73+
uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0
7474
with:
7575
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
7676
tags: |
@@ -106,7 +106,7 @@ jobs:
106106
# https://github.com/docker/build-push-action
107107
- name: Build and push Docker image
108108
id: build-and-push
109-
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
109+
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
110110
with:
111111
context: .
112112
push: ${{ github.event_name != 'pull_request' }}

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,6 +1124,7 @@ The following sets of tools are available:
11241124
- `owner`: Repository owner (string, required)
11251125
- `pullNumber`: Pull request number (number, required)
11261126
- `repo`: Repository name (string, required)
1127+
- `threadId`: The node ID of the review thread (e.g., PRRT_kwDOxxx). Required for resolve_thread and unresolve_thread methods. Get thread IDs from pull_request_read with method get_review_comments. (string, optional)
11271128

11281129
- **search_pull_requests** - Search pull requests
11291130
- **Required OAuth Scopes**: `repo`
@@ -1541,6 +1542,34 @@ set the following environment variable:
15411542
export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description"
15421543
```
15431544

1545+
### Overriding Server Name and Title
1546+
1547+
The same override mechanism can be used to customize the MCP server's `name` and
1548+
`title` fields in the initialization response. This is useful when running
1549+
multiple GitHub MCP Server instances (e.g., one for github.com and one for
1550+
GitHub Enterprise Server) so that agents can distinguish between them.
1551+
1552+
| Key | Environment Variable | Default |
1553+
|-----|---------------------|---------|
1554+
| `SERVER_NAME` | `GITHUB_MCP_SERVER_NAME` | `github-mcp-server` |
1555+
| `SERVER_TITLE` | `GITHUB_MCP_SERVER_TITLE` | `GitHub MCP Server` |
1556+
1557+
For example, to configure a server instance for GitHub Enterprise Server:
1558+
1559+
```json
1560+
{
1561+
"SERVER_NAME": "ghes-mcp-server",
1562+
"SERVER_TITLE": "GHES MCP Server"
1563+
}
1564+
```
1565+
1566+
Or using environment variables:
1567+
1568+
```sh
1569+
export GITHUB_MCP_SERVER_NAME="ghes-mcp-server"
1570+
export GITHUB_MCP_SERVER_TITLE="GHES MCP Server"
1571+
```
1572+
15441573
## Library Usage
15451574

15461575
The exported Go API of this module should currently be considered unstable, and subject to breaking changes. In the future, we may offer stability; please file an issue if there is a use case where this would be valuable.

docs/server-configuration.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ We currently support the following ways in which the GitHub MCP Server can be co
1515
| Lockdown Mode | `X-MCP-Lockdown` header | `--lockdown-mode` flag or `GITHUB_LOCKDOWN_MODE` env var |
1616
| Insiders Mode | `X-MCP-Insiders` header or `/insiders` URL | `--insiders` flag or `GITHUB_INSIDERS` env var |
1717
| Scope Filtering | Always enabled | Always enabled |
18+
| Server Name/Title | Not available | `GITHUB_MCP_SERVER_NAME` / `GITHUB_MCP_SERVER_TITLE` env vars or `github-mcp-server-config.json` |
1819

1920
> **Default behavior:** If you don't specify any configuration, the server uses the **default toolsets**: `context`, `issues`, `pull_requests`, `repos`, `users`.
2021

pkg/github/__toolsnaps__/pull_request_review_write.snap

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"annotations": {
33
"title": "Write operations (create, submit, delete) on pull request reviews."
44
},
5-
"description": "Create and/or submit, delete review of a pull request.\n\nAvailable methods:\n- create: Create a new review of a pull request. If \"event\" parameter is provided, the review is submitted. If \"event\" is omitted, a pending review is created.\n- submit_pending: Submit an existing pending review of a pull request. This requires that a pending review exists for the current user on the specified pull request. The \"body\" and \"event\" parameters are used when submitting the review.\n- delete_pending: Delete an existing pending review of a pull request. This requires that a pending review exists for the current user on the specified pull request.\n",
5+
"description": "Create and/or submit, delete review of a pull request.\n\nAvailable methods:\n- create: Create a new review of a pull request. If \"event\" parameter is provided, the review is submitted. If \"event\" is omitted, a pending review is created.\n- submit_pending: Submit an existing pending review of a pull request. This requires that a pending review exists for the current user on the specified pull request. The \"body\" and \"event\" parameters are used when submitting the review.\n- delete_pending: Delete an existing pending review of a pull request. This requires that a pending review exists for the current user on the specified pull request.\n- resolve_thread: Resolve a review thread. Requires only \"threadId\" parameter with the thread's node ID (e.g., PRRT_kwDOxxx). The owner, repo, and pullNumber parameters are not used for this method. Resolving an already-resolved thread is a no-op.\n- unresolve_thread: Unresolve a previously resolved review thread. Requires only \"threadId\" parameter. The owner, repo, and pullNumber parameters are not used for this method. Unresolving an already-unresolved thread is a no-op.\n",
66
"inputSchema": {
77
"properties": {
88
"body": {
@@ -27,7 +27,9 @@
2727
"enum": [
2828
"create",
2929
"submit_pending",
30-
"delete_pending"
30+
"delete_pending",
31+
"resolve_thread",
32+
"unresolve_thread"
3133
],
3234
"type": "string"
3335
},
@@ -42,6 +44,10 @@
4244
"repo": {
4345
"description": "Repository name",
4446
"type": "string"
47+
},
48+
"threadId": {
49+
"description": "The node ID of the review thread (e.g., PRRT_kwDOxxx). Required for resolve_thread and unresolve_thread methods. Get thread IDs from pull_request_read with method get_review_comments.",
50+
"type": "string"
4551
}
4652
},
4753
"required": [

pkg/github/pullrequests.go

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1507,6 +1507,7 @@ type PullRequestReviewWriteParams struct {
15071507
Body string
15081508
Event string
15091509
CommitID *string
1510+
ThreadID string
15101511
}
15111512

15121513
func PullRequestReviewWrite(t translations.TranslationHelperFunc) inventory.ServerTool {
@@ -1519,7 +1520,7 @@ func PullRequestReviewWrite(t translations.TranslationHelperFunc) inventory.Serv
15191520
"method": {
15201521
Type: "string",
15211522
Description: `The write operation to perform on pull request review.`,
1522-
Enum: []any{"create", "submit_pending", "delete_pending"},
1523+
Enum: []any{"create", "submit_pending", "delete_pending", "resolve_thread", "unresolve_thread"},
15231524
},
15241525
"owner": {
15251526
Type: "string",
@@ -1546,6 +1547,10 @@ func PullRequestReviewWrite(t translations.TranslationHelperFunc) inventory.Serv
15461547
Type: "string",
15471548
Description: "SHA of commit to review",
15481549
},
1550+
"threadId": {
1551+
Type: "string",
1552+
Description: "The node ID of the review thread (e.g., PRRT_kwDOxxx). Required for resolve_thread and unresolve_thread methods. Get thread IDs from pull_request_read with method get_review_comments.",
1553+
},
15491554
},
15501555
Required: []string{"method", "owner", "repo", "pullNumber"},
15511556
}
@@ -1560,6 +1565,8 @@ Available methods:
15601565
- create: Create a new review of a pull request. If "event" parameter is provided, the review is submitted. If "event" is omitted, a pending review is created.
15611566
- submit_pending: Submit an existing pending review of a pull request. This requires that a pending review exists for the current user on the specified pull request. The "body" and "event" parameters are used when submitting the review.
15621567
- delete_pending: Delete an existing pending review of a pull request. This requires that a pending review exists for the current user on the specified pull request.
1568+
- resolve_thread: Resolve a review thread. Requires only "threadId" parameter with the thread's node ID (e.g., PRRT_kwDOxxx). The owner, repo, and pullNumber parameters are not used for this method. Resolving an already-resolved thread is a no-op.
1569+
- unresolve_thread: Unresolve a previously resolved review thread. Requires only "threadId" parameter. The owner, repo, and pullNumber parameters are not used for this method. Unresolving an already-unresolved thread is a no-op.
15631570
`),
15641571
Annotations: &mcp.ToolAnnotations{
15651572
Title: t("TOOL_PULL_REQUEST_REVIEW_WRITE_USER_TITLE", "Write operations (create, submit, delete) on pull request reviews."),
@@ -1590,6 +1597,12 @@ Available methods:
15901597
case "delete_pending":
15911598
result, err := DeletePendingPullRequestReview(ctx, client, params)
15921599
return result, nil, err
1600+
case "resolve_thread":
1601+
result, err := ResolveReviewThread(ctx, client, params.ThreadID, true)
1602+
return result, nil, err
1603+
case "unresolve_thread":
1604+
result, err := ResolveReviewThread(ctx, client, params.ThreadID, false)
1605+
return result, nil, err
15931606
default:
15941607
return utils.NewToolResultError(fmt.Sprintf("unknown method: %s", params.Method)), nil, nil
15951608
}
@@ -1819,6 +1832,60 @@ func DeletePendingPullRequestReview(ctx context.Context, client *githubv4.Client
18191832
return utils.NewToolResultText("pending pull request review successfully deleted"), nil
18201833
}
18211834

1835+
// ResolveReviewThread resolves or unresolves a PR review thread using GraphQL mutations.
1836+
func ResolveReviewThread(ctx context.Context, client *githubv4.Client, threadID string, resolve bool) (*mcp.CallToolResult, error) {
1837+
if threadID == "" {
1838+
return utils.NewToolResultError("threadId is required for resolve_thread and unresolve_thread methods"), nil
1839+
}
1840+
1841+
if resolve {
1842+
var mutation struct {
1843+
ResolveReviewThread struct {
1844+
Thread struct {
1845+
ID githubv4.ID
1846+
IsResolved githubv4.Boolean
1847+
}
1848+
} `graphql:"resolveReviewThread(input: $input)"`
1849+
}
1850+
1851+
input := githubv4.ResolveReviewThreadInput{
1852+
ThreadID: githubv4.ID(threadID),
1853+
}
1854+
1855+
if err := client.Mutate(ctx, &mutation, input, nil); err != nil {
1856+
return ghErrors.NewGitHubGraphQLErrorResponse(ctx,
1857+
"failed to resolve review thread",
1858+
err,
1859+
), nil
1860+
}
1861+
1862+
return utils.NewToolResultText("review thread resolved successfully"), nil
1863+
}
1864+
1865+
// Unresolve
1866+
var mutation struct {
1867+
UnresolveReviewThread struct {
1868+
Thread struct {
1869+
ID githubv4.ID
1870+
IsResolved githubv4.Boolean
1871+
}
1872+
} `graphql:"unresolveReviewThread(input: $input)"`
1873+
}
1874+
1875+
input := githubv4.UnresolveReviewThreadInput{
1876+
ThreadID: githubv4.ID(threadID),
1877+
}
1878+
1879+
if err := client.Mutate(ctx, &mutation, input, nil); err != nil {
1880+
return ghErrors.NewGitHubGraphQLErrorResponse(ctx,
1881+
"failed to unresolve review thread",
1882+
err,
1883+
), nil
1884+
}
1885+
1886+
return utils.NewToolResultText("review thread unresolved successfully"), nil
1887+
}
1888+
18221889
// AddCommentToPendingReview creates a tool to add a comment to a pull request review.
18231890
func AddCommentToPendingReview(t translations.TranslationHelperFunc) inventory.ServerTool {
18241891
schema := &jsonschema.Schema{

0 commit comments

Comments
 (0)