Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9dacf70

Browse files
chore: extend user agent
1 parent6c05b40 commit9dacf70

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

‎cmd/github-mcp-server/main.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
iolog"github.com/github/github-mcp-server/pkg/log"
1414
"github.com/github/github-mcp-server/pkg/translations"
1515
gogithub"github.com/google/go-github/v69/github"
16+
"github.com/mark3labs/mcp-go/mcp"
1617
"github.com/mark3labs/mcp-go/server"
1718
log"github.com/sirupsen/logrus"
1819
"github.com/spf13/cobra"
@@ -137,11 +138,19 @@ func runStdioServer(cfg runConfig) error {
137138

138139
t,dumpTranslations:=translations.TranslationHelper()
139140

141+
beforeInit:=func(_ context.Context,_any,message*mcp.InitializeRequest) {
142+
ghClient.UserAgent=fmt.Sprintf("github-mcp-server/%s (%s/%s)",version,message.Params.ClientInfo.Name,message.Params.ClientInfo.Version)
143+
}
144+
140145
getClient:=func(_ context.Context) (*gogithub.Client,error) {
141146
returnghClient,nil// closing over client
142147
}
148+
149+
hooks:=&server.Hooks{
150+
OnBeforeInitialize: []server.OnBeforeInitializeFunc{beforeInit},
151+
}
143152
// Create
144-
ghServer:=github.NewServer(getClient,version,cfg.readOnly,t)
153+
ghServer:=github.NewServer(getClient,version,cfg.readOnly,t,server.WithHooks(hooks))
145154
stdioServer:=server.NewStdioServer(ghServer)
146155

147156
stdLogger:=stdlog.New(cfg.logger.Writer(),"stdioserver",0)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp