- Notifications
You must be signed in to change notification settings - Fork1k
Split PR review creation, commenting and submission, and deletion#381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Uh oh!
There was an error while loading.Please reload this page.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -15,7 +15,9 @@ import ( | ||
gogithub "github.com/google/go-github/v69/github" | ||
"github.com/mark3labs/mcp-go/mcp" | ||
"github.com/mark3labs/mcp-go/server" | ||
"github.com/shurcooL/githubv4" | ||
"github.com/sirupsen/logrus" | ||
"golang.org/x/oauth2" | ||
) | ||
type MCPServerConfig struct { | ||
@@ -86,11 +88,21 @@ func NewMCPServer(cfg MCPServerConfig) (*server.MCPServer, error) { | ||
return ghClient, nil // closing over client | ||
} | ||
getGQLClient := func(_ context.Context) (*githubv4.Client, error) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. TODO: Make enterprise ready. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. And TODO add headers to these requests somehow too if possible, for same source identification purposes. | ||
// TODO: Enterprise support | ||
src := oauth2.StaticTokenSource( | ||
&oauth2.Token{AccessToken: cfg.Token}, | ||
) | ||
httpClient := oauth2.NewClient(context.Background(), src) | ||
return githubv4.NewClient(httpClient), nil | ||
} | ||
// Create default toolsets | ||
toolsets, err := github.InitToolsets( | ||
enabledToolsets, | ||
cfg.ReadOnly, | ||
getClient, | ||
getGQLClient, | ||
cfg.Translator, | ||
) | ||
if err != nil { | ||
Uh oh!
There was an error while loading.Please reload this page.