Skip to content

Experiment: Make a working version of completions #451

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions e2e/e2e_test.go
Original file line number Diff line number Diff line change
@@ -20,8 +20,8 @@ import (
"github.com/github/github-mcp-server/pkg/github"
"github.com/github/github-mcp-server/pkg/translations"
gogithub "github.com/google/go-github/v69/github"
mcpClient "github.com/mark3labs/mcp-go/client"
"github.com/mark3labs/mcp-go/mcp"
mcpClient "github.com/sammorrowdrums/mcp-go/client"
"github.com/sammorrowdrums/mcp-go/mcp"
"github.com/stretchr/testify/require"
)

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -5,8 +5,8 @@ go 1.23.7
require (
github.com/google/go-github/v69 v69.2.0
github.com/josephburnett/jd v1.9.2
github.com/mark3labs/mcp-go v0.30.0
github.com/migueleliasweb/go-github-mock v1.3.0
github.com/sammorrowdrums/mcp-go v0.0.0-20250602101733-1a4eb277f6a0
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.9.1
github.com/spf13/viper v1.20.1
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -47,8 +47,6 @@ github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN
github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mark3labs/mcp-go v0.30.0 h1:Taz7fiefkxY/l8jz1nA90V+WdM2eoMtlvwfWforVYbo=
github.com/mark3labs/mcp-go v0.30.0/go.mod h1:rXqOudj/djTORU/ThxYx8fqEVj/5pvTuuebQ2RC7uk4=
github.com/migueleliasweb/go-github-mock v1.3.0 h1:2sVP9JEMB2ubQw1IKto3/fzF51oFC6eVWOOFDgQoq88=
github.com/migueleliasweb/go-github-mock v1.3.0/go.mod h1:ipQhV8fTcj/G6m7BKzin08GaJ/3B5/SonRAkgrk0zCY=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
@@ -62,6 +60,10 @@ github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWN
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sagikazarmark/locafero v0.9.0 h1:GbgQGNtTrEmddYDSAH9QLRyfAHY12md+8YFTqyMTC9k=
github.com/sagikazarmark/locafero v0.9.0/go.mod h1:UBUyz37V+EdMS3hDF3QWIiVr/2dPrx49OMO0Bn0hJqk=
github.com/sammorrowdrums/mcp-go v0.0.0-20250528234530-f0daf2216052 h1:c9HI0HGuXED8zwXCdnk2iGyaSC8mvZlBGl+SdHxYJgs=
github.com/sammorrowdrums/mcp-go v0.0.0-20250528234530-f0daf2216052/go.mod h1:Kwt02UMWGJxJ1IHMO9Wrj4GabTSvv9uVUrpht1vjiuk=
github.com/sammorrowdrums/mcp-go v0.0.0-20250602101733-1a4eb277f6a0 h1:fmwKUofBVuktOGefuZUbvUCTPXovPDjTeN7X5N2S2GI=
github.com/sammorrowdrums/mcp-go v0.0.0-20250602101733-1a4eb277f6a0/go.mod h1:Kwt02UMWGJxJ1IHMO9Wrj4GabTSvv9uVUrpht1vjiuk=
github.com/shurcooL/githubv4 v0.0.0-20240727222349-48295856cce7 h1:cYCy18SHPKRkvclm+pWm1Lk4YrREb4IOIb/YdFO0p2M=
github.com/shurcooL/githubv4 v0.0.0-20240727222349-48295856cce7/go.mod h1:zqMwyHmnN/eDOZOdiTohqIUKUrTFX62PNlu7IJdu0q8=
github.com/shurcooL/graphql v0.0.0-20230722043721-ed46e5a46466 h1:17JxqqJY66GmZVHkmAsGEkcIu0oCe3AM420QDgGwZx0=
22 changes: 11 additions & 11 deletions internal/ghmcp/server.go
Original file line number Diff line number Diff line change
@@ -16,8 +16,8 @@ import (
mcplog "github.com/github/github-mcp-server/pkg/log"
"github.com/github/github-mcp-server/pkg/translations"
gogithub "github.com/google/go-github/v69/github"
"github.com/mark3labs/mcp-go/mcp"
"github.com/mark3labs/mcp-go/server"
"github.com/sammorrowdrums/mcp-go/mcp"
"github.com/sammorrowdrums/mcp-go/server"
"github.com/shurcooL/githubv4"
"github.com/sirupsen/logrus"
)
@@ -91,7 +91,15 @@ func NewMCPServer(cfg MCPServerConfig) (*server.MCPServer, error) {
OnBeforeInitialize: []server.OnBeforeInitializeFunc{beforeInit},
}

ghServer := github.NewServer(cfg.Version, server.WithHooks(hooks))
getClient := func(_ context.Context) (*gogithub.Client, error) {
return restClient, nil // closing over client
}

getGQLClient := func(_ context.Context) (*githubv4.Client, error) {
return gqlClient, nil // closing over client
}

ghServer := github.NewServer(getClient, cfg.Version, server.WithHooks(hooks))

enabledToolsets := cfg.EnabledToolsets
if cfg.DynamicToolsets {
@@ -104,14 +112,6 @@ func NewMCPServer(cfg MCPServerConfig) (*server.MCPServer, error) {
}
}

getClient := func(_ context.Context) (*gogithub.Client, error) {
return restClient, nil // closing over client
}

getGQLClient := func(_ context.Context) (*githubv4.Client, error) {
return gqlClient, nil // closing over client
}

// Create default toolsets
toolsets, err := github.InitToolsets(
enabledToolsets,
4 changes: 2 additions & 2 deletions pkg/github/code_scanning.go
Original file line number Diff line number Diff line change
@@ -9,8 +9,8 @@ import (

"github.com/github/github-mcp-server/pkg/translations"
"github.com/google/go-github/v69/github"
"github.com/mark3labs/mcp-go/mcp"
"github.com/mark3labs/mcp-go/server"
"github.com/sammorrowdrums/mcp-go/mcp"
"github.com/sammorrowdrums/mcp-go/server"
)

func GetCodeScanningAlert(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
4 changes: 2 additions & 2 deletions pkg/github/context_tools.go
Original file line number Diff line number Diff line change
@@ -4,8 +4,8 @@ import (
"context"

"github.com/github/github-mcp-server/pkg/translations"
"github.com/mark3labs/mcp-go/mcp"
"github.com/mark3labs/mcp-go/server"
"github.com/sammorrowdrums/mcp-go/mcp"
"github.com/sammorrowdrums/mcp-go/server"
)

// GetMe creates a tool to get details of the authenticated user.
4 changes: 2 additions & 2 deletions pkg/github/dynamic_tools.go
Original file line number Diff line number Diff line change
@@ -7,8 +7,8 @@ import (

"github.com/github/github-mcp-server/pkg/toolsets"
"github.com/github/github-mcp-server/pkg/translations"
"github.com/mark3labs/mcp-go/mcp"
"github.com/mark3labs/mcp-go/server"
"github.com/sammorrowdrums/mcp-go/mcp"
"github.com/sammorrowdrums/mcp-go/server"
)

func ToolsetEnum(toolsetGroup *toolsets.ToolsetGroup) mcp.PropertyOption {
2 changes: 1 addition & 1 deletion pkg/github/helper_test.go
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ import (
"net/http"
"testing"

"github.com/mark3labs/mcp-go/mcp"
"github.com/sammorrowdrums/mcp-go/mcp"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
4 changes: 2 additions & 2 deletions pkg/github/issues.go
Original file line number Diff line number Diff line change
@@ -12,8 +12,8 @@ import (
"github.com/github/github-mcp-server/pkg/translations"
"github.com/go-viper/mapstructure/v2"
"github.com/google/go-github/v69/github"
"github.com/mark3labs/mcp-go/mcp"
"github.com/mark3labs/mcp-go/server"
"github.com/sammorrowdrums/mcp-go/mcp"
"github.com/sammorrowdrums/mcp-go/server"
"github.com/shurcooL/githubv4"
)

4 changes: 2 additions & 2 deletions pkg/github/notifications.go
Original file line number Diff line number Diff line change
@@ -11,8 +11,8 @@ import (

"github.com/github/github-mcp-server/pkg/translations"
"github.com/google/go-github/v69/github"
"github.com/mark3labs/mcp-go/mcp"
"github.com/mark3labs/mcp-go/server"
"github.com/sammorrowdrums/mcp-go/mcp"
"github.com/sammorrowdrums/mcp-go/server"
)

const (
4 changes: 2 additions & 2 deletions pkg/github/pullrequests.go
Original file line number Diff line number Diff line change
@@ -9,8 +9,8 @@ import (

"github.com/go-viper/mapstructure/v2"
"github.com/google/go-github/v69/github"
"github.com/mark3labs/mcp-go/mcp"
"github.com/mark3labs/mcp-go/server"
"github.com/sammorrowdrums/mcp-go/mcp"
"github.com/sammorrowdrums/mcp-go/server"
"github.com/shurcooL/githubv4"

"github.com/github/github-mcp-server/pkg/translations"
5 changes: 3 additions & 2 deletions pkg/github/repositories.go
Original file line number Diff line number Diff line change
@@ -9,8 +9,8 @@ import (

"github.com/github/github-mcp-server/pkg/translations"
"github.com/google/go-github/v69/github"
"github.com/mark3labs/mcp-go/mcp"
"github.com/mark3labs/mcp-go/server"
"github.com/sammorrowdrums/mcp-go/mcp"
"github.com/sammorrowdrums/mcp-go/server"
)

func GetCommit(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
@@ -132,6 +132,7 @@ func ListCommits(getClient GetClientFn, t translations.TranslationHelperFunc) (t
}

client, err := getClient(ctx)

if err != nil {
return nil, fmt.Errorf("failed to get GitHub client: %w", err)
}
Loading
Oops, something went wrong.
Loading
Oops, something went wrong.