Skip to content

Commit 75dc8e7

Browse files
Merge branch 'main' into actions-job-log-buffer
2 parents 5a76cbd + 1832210 commit 75dc8e7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+2700
-394
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Close inactive issues
2+
on:
3+
schedule:
4+
- cron: "30 8 * * *"
5+
6+
jobs:
7+
close-issues:
8+
runs-on: ubuntu-latest
9+
env:
10+
PR_DAYS_BEFORE_STALE: 60
11+
PR_DAYS_BEFORE_CLOSE: 10
12+
PR_STALE_LABEL: stale
13+
permissions:
14+
issues: write
15+
pull-requests: write
16+
steps:
17+
- uses: actions/stale@v9
18+
with:
19+
days-before-issue-stale: ${{ env.PR_DAYS_BEFORE_STALE }}
20+
days-before-issue-close: ${{ env.PR_DAYS_BEFORE_CLOSE }}
21+
stale-issue-label: ${{ env.PR_STALE_LABEL }}
22+
stale-issue-message: "This issue is stale because it has been open for ${{ env.PR_DAYS_BEFORE_STALE }} days with no activity. Leave a comment to avoid closing this issue in ${{ env.PR_DAYS_BEFORE_CLOSE }} days."
23+
close-issue-message: "This issue was closed because it has been inactive for ${{ env.PR_DAYS_BEFORE_CLOSE }} days since being marked as stale."
24+
days-before-pr-stale: -1
25+
days-before-pr-close: -1
26+
# Start with the oldest items first
27+
ascending: true
28+
repo-token: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ To keep your GitHub PAT secure and reusable across different MCP hosts:
144144
- **Minimum scopes**: Only grant necessary permissions
145145
- `repo` - Repository operations
146146
- `read:packages` - Docker image access
147+
- `read:org` - Organization team access
147148
- **Separate tokens**: Use different PATs for different projects/environments
148149
- **Regular rotation**: Update tokens periodically
149150
- **Never commit**: Keep tokens out of version control
@@ -421,6 +422,13 @@ The following sets of tools are available (all are on by default):
421422
- **get_me** - Get my user profile
422423
- No parameters required
423424

425+
- **get_team_members** - Get team members
426+
- `org`: Organization login (owner) that contains the team. (string, required)
427+
- `team_slug`: Team slug (string, required)
428+
429+
- **get_teams** - Get teams
430+
- `user`: Username to get teams for. If not provided, uses the authenticated user. (string, optional)
431+
424432
</details>
425433

426434
<details>
@@ -538,16 +546,19 @@ The following sets of tools are available (all are on by default):
538546
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
539547
- `repo`: Repository name (string, required)
540548

549+
- **list_issue_types** - List available issue types
550+
- `owner`: The organization owner of the repository (string, required)
551+
541552
- **list_issues** - List issues
542-
- `direction`: Sort direction (string, optional)
553+
- `after`: Cursor for pagination. Use the endCursor from the previous page's PageInfo for GraphQL APIs. (string, optional)
554+
- `direction`: Order direction. If provided, the 'orderBy' also needs to be provided. (string, optional)
543555
- `labels`: Filter by labels (string[], optional)
556+
- `orderBy`: Order issues by field. If provided, the 'direction' also needs to be provided. (string, optional)
544557
- `owner`: Repository owner (string, required)
545-
- `page`: Page number for pagination (min 1) (number, optional)
546558
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
547559
- `repo`: Repository name (string, required)
548560
- `since`: Filter by date (ISO 8601 timestamp) (string, optional)
549-
- `sort`: Sort order (string, optional)
550-
- `state`: Filter by state (string, optional)
561+
- `state`: Filter by state, by default both open and closed issues are returned when not provided (string, optional)
551562

552563
- **list_sub_issues** - List sub-issues
553564
- `issue_number`: Issue number (number, required)
@@ -572,11 +583,11 @@ The following sets of tools are available (all are on by default):
572583

573584
- **search_issues** - Search issues
574585
- `order`: Sort order (string, optional)
575-
- `owner`: Optional repository owner. If provided with repo, only notifications for this repository are listed. (string, optional)
586+
- `owner`: Optional repository owner. If provided with repo, only issues for this repository are listed. (string, optional)
576587
- `page`: Page number for pagination (min 1) (number, optional)
577588
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
578589
- `query`: Search query using GitHub issues search syntax (string, required)
579-
- `repo`: Optional repository name. If provided with owner, only notifications for this repository are listed. (string, optional)
590+
- `repo`: Optional repository name. If provided with owner, only issues for this repository are listed. (string, optional)
580591
- `sort`: Sort field by number of matches of categories, defaults to best match (string, optional)
581592

582593
- **update_issue** - Edit issue
@@ -744,11 +755,11 @@ The following sets of tools are available (all are on by default):
744755

745756
- **search_pull_requests** - Search pull requests
746757
- `order`: Sort order (string, optional)
747-
- `owner`: Optional repository owner. If provided with repo, only notifications for this repository are listed. (string, optional)
758+
- `owner`: Optional repository owner. If provided with repo, only pull requests for this repository are listed. (string, optional)
748759
- `page`: Page number for pagination (min 1) (number, optional)
749760
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
750761
- `query`: Search query using GitHub pull request search syntax (string, required)
751-
- `repo`: Optional repository name. If provided with owner, only notifications for this repository are listed. (string, optional)
762+
- `repo`: Optional repository name. If provided with owner, only pull requests for this repository are listed. (string, optional)
752763
- `sort`: Sort field by number of matches of categories, defaults to best match (string, optional)
753764

754765
- **submit_pending_pull_request_review** - Submit the requester's latest pending pull request review
@@ -829,6 +840,10 @@ The following sets of tools are available (all are on by default):
829840
- `repo`: Repository name (string, required)
830841
- `sha`: Accepts optional commit SHA. If specified, it will be used instead of ref (string, optional)
831842

843+
- **get_latest_release** - Get latest release
844+
- `owner`: Repository owner (string, required)
845+
- `repo`: Repository name (string, required)
846+
832847
- **get_tag** - Get tag details
833848
- `owner`: Repository owner (string, required)
834849
- `repo`: Repository name (string, required)
@@ -848,6 +863,12 @@ The following sets of tools are available (all are on by default):
848863
- `repo`: Repository name (string, required)
849864
- `sha`: Commit SHA, branch or tag name to list commits of. If not provided, uses the default branch of the repository. If a commit SHA is provided, will list commits up to that SHA. (string, optional)
850865

866+
- **list_releases** - List releases
867+
- `owner`: Repository owner (string, required)
868+
- `page`: Page number for pagination (min 1) (number, optional)
869+
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
870+
- `repo`: Repository name (string, required)
871+
851872
- **list_tags** - List tags
852873
- `owner`: Repository owner (string, required)
853874
- `page`: Page number for pagination (min 1) (number, optional)
@@ -1075,4 +1096,4 @@ The exported Go API of this module should currently be considered unstable, and
10751096

10761097
## License
10771098

1078-
This project is licensed under the terms of the MIT open source license. Please refer to [MIT](./LICENSE) for the full terms.
1099+
This project is licensed under the terms of the MIT open source license. Please refer to [MIT](./LICENSE) for the full terms.

cmd/github-mcp-server/generate_docs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/github/github-mcp-server/pkg/raw"
1414
"github.com/github/github-mcp-server/pkg/toolsets"
1515
"github.com/github/github-mcp-server/pkg/translations"
16-
gogithub "github.com/google/go-github/v73/github"
16+
gogithub "github.com/google/go-github/v74/github"
1717
"github.com/mark3labs/mcp-go/mcp"
1818
"github.com/shurcooL/githubv4"
1919
"github.com/spf13/cobra"

e2e/e2e_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
"github.com/github/github-mcp-server/internal/ghmcp"
1919
"github.com/github/github-mcp-server/pkg/github"
2020
"github.com/github/github-mcp-server/pkg/translations"
21-
gogithub "github.com/google/go-github/v73/github"
21+
gogithub "github.com/google/go-github/v74/github"
2222
mcpClient "github.com/mark3labs/mcp-go/client"
2323
"github.com/mark3labs/mcp-go/mcp"
2424
"github.com/stretchr/testify/require"

github-mcp-server

17.5 MB
Binary file not shown.

go.mod

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ module github.com/github/github-mcp-server
33
go 1.23.7
44

55
require (
6-
github.com/google/go-github/v73 v73.0.0
6+
github.com/google/go-github/v74 v74.0.0
77
github.com/josephburnett/jd v1.9.2
88
github.com/mark3labs/mcp-go v0.32.0
99
github.com/migueleliasweb/go-github-mock v1.3.0
10-
github.com/sirupsen/logrus v1.9.3
1110
github.com/spf13/cobra v1.9.1
1211
github.com/spf13/viper v1.20.1
1312
github.com/stretchr/testify v1.10.0

go.sum

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
2020
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
2121
github.com/google/go-github/v71 v71.0.0 h1:Zi16OymGKZZMm8ZliffVVJ/Q9YZreDKONCr+WUd0Z30=
2222
github.com/google/go-github/v71 v71.0.0/go.mod h1:URZXObp2BLlMjwu0O8g4y6VBneUj2bCHgnI8FfgZ51M=
23-
github.com/google/go-github/v73 v73.0.0 h1:aR+Utnh+Y4mMkS+2qLQwcQ/cF9mOTpdwnzlaw//rG24=
24-
github.com/google/go-github/v73 v73.0.0/go.mod h1:fa6w8+/V+edSU0muqdhCVY7Beh1M8F1IlQPZIANKIYw=
23+
github.com/google/go-github/v74 v74.0.0 h1:yZcddTUn8DPbj11GxnMrNiAnXH14gNs559AsUpNpPgM=
24+
github.com/google/go-github/v74 v74.0.0/go.mod h1:ubn/YdyftV80VPSI26nSJvaEsTOnsjrxG3o9kJhcyak=
2525
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
2626
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
2727
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
@@ -66,8 +66,6 @@ github.com/shurcooL/githubv4 v0.0.0-20240727222349-48295856cce7 h1:cYCy18SHPKRkv
6666
github.com/shurcooL/githubv4 v0.0.0-20240727222349-48295856cce7/go.mod h1:zqMwyHmnN/eDOZOdiTohqIUKUrTFX62PNlu7IJdu0q8=
6767
github.com/shurcooL/graphql v0.0.0-20230722043721-ed46e5a46466 h1:17JxqqJY66GmZVHkmAsGEkcIu0oCe3AM420QDgGwZx0=
6868
github.com/shurcooL/graphql v0.0.0-20230722043721-ed46e5a46466/go.mod h1:9dIRpgIY7hVhoqfe0/FcYp0bpInZaT7dc3BYOprrIUE=
69-
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
70-
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
7169
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
7270
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
7371
github.com/spf13/afero v1.14.0 h1:9tH6MapGnn/j0eb0yIXiLjERO8RB6xIVZRDCX7PtqWA=
@@ -83,7 +81,6 @@ github.com/spf13/viper v1.20.1/go.mod h1:P9Mdzt1zoHIG8m2eZQinpiBjo6kCmZSKBClNNqj
8381
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
8482
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
8583
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
86-
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
8784
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
8885
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
8986
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
@@ -98,7 +95,6 @@ golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0
9895
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY=
9996
golang.org/x/oauth2 v0.29.0 h1:WdYw2tdTK1S8olAzWHdgeqfy+Mtm9XNhv/xJsY65d98=
10097
golang.org/x/oauth2 v0.29.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8=
101-
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
10298
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
10399
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
104100
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=

internal/ghmcp/server.go

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"fmt"
66
"io"
77
"log"
8+
"log/slog"
89
"net/http"
910
"net/url"
1011
"os"
@@ -17,11 +18,10 @@ import (
1718
mcplog "github.com/github/github-mcp-server/pkg/log"
1819
"github.com/github/github-mcp-server/pkg/raw"
1920
"github.com/github/github-mcp-server/pkg/translations"
20-
gogithub "github.com/google/go-github/v73/github"
21+
gogithub "github.com/google/go-github/v74/github"
2122
"github.com/mark3labs/mcp-go/mcp"
2223
"github.com/mark3labs/mcp-go/server"
2324
"github.com/shurcooL/githubv4"
24-
"github.com/sirupsen/logrus"
2525
)
2626

2727
type MCPServerConfig struct {
@@ -49,6 +49,8 @@ type MCPServerConfig struct {
4949
Translator translations.TranslationHelperFunc
5050
}
5151

52+
const stdioServerLogPrefix = "stdioserver"
53+
5254
func NewMCPServer(cfg MCPServerConfig) (*server.MCPServer, error) {
5355
apiHost, err := parseAPIHost(cfg.Host)
5456
if err != nil {
@@ -203,17 +205,22 @@ func RunStdioServer(cfg StdioServerConfig) error {
203205

204206
stdioServer := server.NewStdioServer(ghServer)
205207

206-
logrusLogger := logrus.New()
208+
var slogHandler slog.Handler
209+
var logOutput io.Writer
207210
if cfg.LogFilePath != "" {
208211
file, err := os.OpenFile(cfg.LogFilePath, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0600)
209212
if err != nil {
210213
return fmt.Errorf("failed to open log file: %w", err)
211214
}
212-
213-
logrusLogger.SetLevel(logrus.DebugLevel)
214-
logrusLogger.SetOutput(file)
215-
}
216-
stdLogger := log.New(logrusLogger.Writer(), "stdioserver", 0)
215+
logOutput = file
216+
slogHandler = slog.NewTextHandler(logOutput, &slog.HandlerOptions{Level: slog.LevelDebug})
217+
} else {
218+
logOutput = os.Stderr
219+
slogHandler = slog.NewTextHandler(logOutput, &slog.HandlerOptions{Level: slog.LevelInfo})
220+
}
221+
logger := slog.New(slogHandler)
222+
logger.Info("starting server", "version", cfg.Version, "host", cfg.Host, "dynamicToolsets", cfg.DynamicToolsets, "readOnly", cfg.ReadOnly)
223+
stdLogger := log.New(logOutput, stdioServerLogPrefix, 0)
217224
stdioServer.SetErrorLogger(stdLogger)
218225

219226
if cfg.ExportTranslations {
@@ -227,7 +234,7 @@ func RunStdioServer(cfg StdioServerConfig) error {
227234
in, out := io.Reader(os.Stdin), io.Writer(os.Stdout)
228235

229236
if cfg.EnableCommandLogging {
230-
loggedIO := mcplog.NewIOLogger(in, out, logrusLogger)
237+
loggedIO := mcplog.NewIOLogger(in, out, logger)
231238
in, out = loggedIO, loggedIO
232239
}
233240
// enable GitHub errors in the context
@@ -241,9 +248,10 @@ func RunStdioServer(cfg StdioServerConfig) error {
241248
// Wait for shutdown signal
242249
select {
243250
case <-ctx.Done():
244-
logrusLogger.Infof("shutting down server...")
251+
logger.Info("shutting down server", "signal", "context done")
245252
case err := <-errC:
246253
if err != nil {
254+
logger.Error("error running server", "error", err)
247255
return fmt.Errorf("error running server: %w", err)
248256
}
249257
}

pkg/errors/error.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"context"
55
"fmt"
66

7-
"github.com/google/go-github/v73/github"
7+
"github.com/google/go-github/v74/github"
88
"github.com/mark3labs/mcp-go/mcp"
99
)
1010

pkg/errors/error_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"net/http"
77
"testing"
88

9-
"github.com/google/go-github/v73/github"
9+
"github.com/google/go-github/v74/github"
1010
"github.com/stretchr/testify/assert"
1111
"github.com/stretchr/testify/require"
1212
)

0 commit comments

Comments
 (0)