Skip to content

Commit e62aa0b

Browse files
feat(discussions): add discussion write tools (create/update + comment CRUD) (#1)
* feat(discussions): add discussion write tools * build(docker): remove git dependency (pass COMMIT build-arg) * ci(docker): add COMMIT build-arg to docker-publish workflow * ci(docker): trigger workflow on feat/discussions-write-tools branch * ci(docker): remove explicit feat/discussions-write-tools branch (now main) --------- Co-authored-by: Ilia Shutov <shutovilya@gmail.com>
1 parent 30712de commit e62aa0b

File tree

10 files changed

+1126
-18
lines changed

10 files changed

+1126
-18
lines changed

.github/workflows/docker-publish.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ on:
1616
branches: ["main", "next"]
1717
workflow_dispatch:
1818
inputs:
19-
description:
20-
required: false
21-
description: "Description of the run."
22-
type: string
23-
default: "Manual run"
19+
description:
20+
required: false
21+
description: "Description of the run."
22+
type: string
23+
default: "Manual run"
2424

2525
env:
2626
# Use docker.io for Docker Hub if empty
@@ -112,6 +112,7 @@ jobs:
112112
platforms: linux/amd64,linux/arm64
113113
build-args: |
114114
VERSION=${{ github.ref_name }}
115+
COMMIT=${{ github.sha }}
115116
116117
# Sign the resulting Docker image digest except on PRs.
117118
# This will only write to the public Rekor transparency log when the Docker
@@ -127,4 +128,3 @@ jobs:
127128
# This step uses the identity token to provision an ephemeral certificate
128129
# against the sigstore community Fulcio instance.
129130
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
130-

Dockerfile

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
FROM golang:1.25.4-alpine AS build
22
ARG VERSION="dev"
3+
ARG COMMIT="unknown"
34

45
# Set the working directory
56
WORKDIR /build
67

7-
# Install git
8-
RUN --mount=type=cache,target=/var/cache/apk \
9-
apk add git
10-
118
# Build the server
129
# go build automatically download required module dependencies to /go/pkg/mod
1310
RUN --mount=type=cache,target=/go/pkg/mod \
1411
--mount=type=cache,target=/root/.cache/go-build \
1512
--mount=type=bind,target=. \
16-
CGO_ENABLED=0 go build -ldflags="-s -w -X main.version=${VERSION} -X main.commit=$(git rev-parse HEAD) -X main.date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
13+
CGO_ENABLED=0 go build -ldflags="-s -w -X main.version=${VERSION} -X main.commit=${COMMIT} -X main.date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
1714
-o /bin/github-mcp-server cmd/github-mcp-server/main.go
1815

1916
# Make a stage to run the app
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"annotations": {
3+
"title": "Add discussion comment"
4+
},
5+
"description": "Add a comment to a discussion.",
6+
"inputSchema": {
7+
"type": "object",
8+
"properties": {
9+
"body": {
10+
"type": "string",
11+
"description": "Comment body (Markdown)"
12+
},
13+
"discussionNumber": {
14+
"type": "number",
15+
"description": "Discussion Number"
16+
},
17+
"owner": {
18+
"type": "string",
19+
"description": "Repository owner"
20+
},
21+
"reply_to_id": {
22+
"type": "string",
23+
"description": "Optional discussion comment node ID to reply to."
24+
},
25+
"repo": {
26+
"type": "string",
27+
"description": "Repository name"
28+
}
29+
},
30+
"required": [
31+
"owner",
32+
"repo",
33+
"discussionNumber",
34+
"body"
35+
]
36+
},
37+
"name": "add_discussion_comment"
38+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"annotations": {
3+
"title": "Create discussion"
4+
},
5+
"description": "Create a new discussion in a repository.",
6+
"inputSchema": {
7+
"type": "object",
8+
"properties": {
9+
"body": {
10+
"type": "string",
11+
"description": "Discussion body (Markdown)"
12+
},
13+
"category_id": {
14+
"type": "string",
15+
"description": "Discussion category node ID. If provided, this is used directly."
16+
},
17+
"category_name": {
18+
"type": "string",
19+
"description": "Discussion category name. If provided, it will be resolved to a category ID."
20+
},
21+
"owner": {
22+
"type": "string",
23+
"description": "Repository owner"
24+
},
25+
"repo": {
26+
"type": "string",
27+
"description": "Repository name"
28+
},
29+
"title": {
30+
"type": "string",
31+
"description": "Discussion title"
32+
}
33+
},
34+
"required": [
35+
"owner",
36+
"repo",
37+
"title",
38+
"body"
39+
]
40+
},
41+
"name": "create_discussion"
42+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"annotations": {
3+
"title": "Delete discussion comment"
4+
},
5+
"description": "Delete an existing discussion comment.",
6+
"inputSchema": {
7+
"type": "object",
8+
"properties": {
9+
"comment_id": {
10+
"type": "string",
11+
"description": "Discussion comment node ID"
12+
}
13+
},
14+
"required": [
15+
"comment_id"
16+
]
17+
},
18+
"name": "delete_discussion_comment"
19+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"annotations": {
3+
"title": "Update discussion"
4+
},
5+
"description": "Update a discussion (title/body/category) in a repository.",
6+
"inputSchema": {
7+
"type": "object",
8+
"properties": {
9+
"body": {
10+
"type": "string",
11+
"description": "New discussion body (optional)"
12+
},
13+
"category_id": {
14+
"type": "string",
15+
"description": "New discussion category node ID (optional). If provided, this is used directly."
16+
},
17+
"category_name": {
18+
"type": "string",
19+
"description": "New discussion category name (optional). If provided, it will be resolved to a category ID."
20+
},
21+
"discussionNumber": {
22+
"type": "number",
23+
"description": "Discussion Number"
24+
},
25+
"owner": {
26+
"type": "string",
27+
"description": "Repository owner"
28+
},
29+
"repo": {
30+
"type": "string",
31+
"description": "Repository name"
32+
},
33+
"title": {
34+
"type": "string",
35+
"description": "New discussion title (optional)"
36+
}
37+
},
38+
"required": [
39+
"owner",
40+
"repo",
41+
"discussionNumber"
42+
]
43+
},
44+
"name": "update_discussion"
45+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"annotations": {
3+
"title": "Update discussion comment"
4+
},
5+
"description": "Update an existing discussion comment.",
6+
"inputSchema": {
7+
"type": "object",
8+
"properties": {
9+
"body": {
10+
"type": "string",
11+
"description": "New comment body (Markdown)"
12+
},
13+
"comment_id": {
14+
"type": "string",
15+
"description": "Discussion comment node ID"
16+
}
17+
},
18+
"required": [
19+
"comment_id",
20+
"body"
21+
]
22+
},
23+
"name": "update_discussion_comment"
24+
}

0 commit comments

Comments
 (0)