Skip to content

Commit f345fcb

Browse files
committed
Split PR review creation, commenting, submission and deletion
1 parent 0ca07aa commit f345fcb

File tree

15 files changed

+1498
-575
lines changed

15 files changed

+1498
-575
lines changed

e2e/e2e_test.go

+544
Large diffs are not rendered by default.

go.mod

+3
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,16 @@ require (
2525
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
2626
github.com/rogpeppe/go-internal v1.13.1 // indirect
2727
github.com/sagikazarmark/locafero v0.9.0 // indirect
28+
github.com/shurcooL/githubv4 v0.0.0-20240727222349-48295856cce7
29+
github.com/shurcooL/graphql v0.0.0-20230722043721-ed46e5a46466 // indirect
2830
github.com/sourcegraph/conc v0.3.0 // indirect
2931
github.com/spf13/afero v1.14.0 // indirect
3032
github.com/spf13/cast v1.7.1 // indirect
3133
github.com/spf13/pflag v1.0.6 // indirect
3234
github.com/subosito/gotenv v1.6.0 // indirect
3335
github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
3436
go.uber.org/multierr v1.11.0 // indirect
37+
golang.org/x/oauth2 v0.29.0
3538
golang.org/x/sys v0.31.0 // indirect
3639
golang.org/x/text v0.23.0 // indirect
3740
golang.org/x/time v0.5.0 // indirect

go.sum

+6
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWN
4545
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
4646
github.com/sagikazarmark/locafero v0.9.0 h1:GbgQGNtTrEmddYDSAH9QLRyfAHY12md+8YFTqyMTC9k=
4747
github.com/sagikazarmark/locafero v0.9.0/go.mod h1:UBUyz37V+EdMS3hDF3QWIiVr/2dPrx49OMO0Bn0hJqk=
48+
github.com/shurcooL/githubv4 v0.0.0-20240727222349-48295856cce7 h1:cYCy18SHPKRkvclm+pWm1Lk4YrREb4IOIb/YdFO0p2M=
49+
github.com/shurcooL/githubv4 v0.0.0-20240727222349-48295856cce7/go.mod h1:zqMwyHmnN/eDOZOdiTohqIUKUrTFX62PNlu7IJdu0q8=
50+
github.com/shurcooL/graphql v0.0.0-20230722043721-ed46e5a46466 h1:17JxqqJY66GmZVHkmAsGEkcIu0oCe3AM420QDgGwZx0=
51+
github.com/shurcooL/graphql v0.0.0-20230722043721-ed46e5a46466/go.mod h1:9dIRpgIY7hVhoqfe0/FcYp0bpInZaT7dc3BYOprrIUE=
4852
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
4953
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
5054
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
@@ -69,6 +73,8 @@ github.com/yosida95/uritemplate/v3 v3.0.2 h1:Ed3Oyj9yrmi9087+NczuL5BwkIc4wvTb5zI
6973
github.com/yosida95/uritemplate/v3 v3.0.2/go.mod h1:ILOh0sOhIJR3+L/8afwt/kE++YT040gmv5BQTMR2HP4=
7074
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
7175
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
76+
golang.org/x/oauth2 v0.29.0 h1:WdYw2tdTK1S8olAzWHdgeqfy+Mtm9XNhv/xJsY65d98=
77+
golang.org/x/oauth2 v0.29.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8=
7278
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
7379
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
7480
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=

internal/ghmcp/server.go

+12
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import (
1414
"github.com/github/github-mcp-server/pkg/translations"
1515
gogithub "github.com/google/go-github/v69/github"
1616
"github.com/mark3labs/mcp-go/mcp"
17+
"github.com/shurcooL/githubv4"
18+
"golang.org/x/oauth2"
1719

1820
"github.com/mark3labs/mcp-go/server"
1921
"github.com/sirupsen/logrus"
@@ -87,11 +89,21 @@ func NewMCPServer(cfg MCPServerConfig) (*server.MCPServer, error) {
8789
return ghClient, nil // closing over client
8890
}
8991

92+
getGQLClient := func(_ context.Context) (*githubv4.Client, error) {
93+
// TODO: Enterprise support
94+
src := oauth2.StaticTokenSource(
95+
&oauth2.Token{AccessToken: cfg.Token},
96+
)
97+
httpClient := oauth2.NewClient(context.Background(), src)
98+
return githubv4.NewClient(httpClient), nil
99+
}
100+
90101
// Create default toolsets
91102
toolsets, err := github.InitToolsets(
92103
enabledToolsets,
93104
cfg.ReadOnly,
94105
getClient,
106+
getGQLClient,
95107
cfg.Translator,
96108
)
97109
if err != nil {

0 commit comments

Comments
 (0)