@@ -120,28 +120,23 @@ func runStdioServer(cfg runConfig) error {
120
120
host = viper .GetString ("gh-host" )
121
121
}
122
122
123
- // Check if a token is set
124
- token := os .Getenv ("GITHUB_PERSONAL_ACCESS_TOKEN" )
125
-
126
- // Create GH client
127
- ghClientOptions := api.ClientOptions {
123
+ // Create GitHub API client
124
+ httpClient , err := api .NewHTTPClient (api.ClientOptions {
128
125
Host : host ,
129
- AuthToken : token ,
130
- }
131
-
132
- httpClient , err := api .NewHTTPClient (ghClientOptions )
126
+ AuthToken : os .Getenv ("GITHUB_PERSONAL_ACCESS_TOKEN" ),
127
+ })
133
128
if err != nil {
134
- return fmt .Errorf ("failed to create GitHub client: %w" , err )
129
+ return fmt .Errorf ("failed to create client: %w" , err )
135
130
}
136
131
ghClient := gogithub .NewClient (httpClient )
137
132
ghClient .UserAgent = fmt .Sprintf ("github-mcp-server/%s" , version )
138
133
139
- t , dumpTranslations := translations .TranslationHelper ()
140
-
141
134
getClient := func (_ context.Context ) (* gogithub.Client , error ) {
142
135
return ghClient , nil // closing over client
143
136
}
144
- // Create
137
+
138
+ // Create MCP server
139
+ t , dumpTranslations := translations .TranslationHelper ()
145
140
ghServer := github .NewServer (getClient , version , cfg .readOnly , t )
146
141
stdioServer := server .NewStdioServer (ghServer )
147
142
0 commit comments