@@ -11,14 +11,13 @@ import {
1111 McpError ,
1212} from '@modelcontextprotocol/sdk/types.js' ;
1313import { getConfig , Config } from '../config.js' ;
14- import { GitHubClient } from '../github/client.js' ;
1514import { leaveGeneralComment } from './tools/leave_comment.js' ;
1615import { leaveInlineComment } from './tools/leave_inline_comment.js' ;
1716import { createCheckRun } from './tools/create_check_run.js' ;
1817import { getPRInfo } from './tools/get_pr_info.js' ;
1918import { triggerReview } from './tools/trigger_review.js' ;
2019import { getPRComments } from './tools/get_pr_comments.js' ;
21- import {
20+ import {
2221 validateLeaveGeneralCommentArgs ,
2322 validateLeaveInlineCommentArgs ,
2423 validateCreateCheckRunArgs ,
@@ -30,7 +29,6 @@ import {
3029class GitHubMCPServer {
3130 private server : Server ;
3231 private config : Config ;
33- private githubClient : GitHubClient ;
3432
3533 constructor ( ) {
3634 console . log ( '🚀 Initializing GitHub MCP Server...' ) ;
@@ -47,16 +45,9 @@ class GitHubMCPServer {
4745 ) ;
4846
4947 this . config = getConfig ( ) ;
50- // Initialize with a default client, will be updated in run()
51- this . githubClient = new GitHubClient ( this . config ) ;
5248 this . setupToolHandlers ( ) ;
5349 }
5450
55- private async setupGitHubClient ( ) {
56- console . log ( '🔑 Initializing GitHub client with static token' ) ;
57- this . githubClient = new GitHubClient ( this . config ) ;
58- }
59-
6051 private setupToolHandlers ( ) : void {
6152 console . log ( '🔨 Setting up tool handlers...' ) ;
6253 this . server . setRequestHandler ( ListToolsRequestSchema , async ( ) => {
@@ -268,8 +259,7 @@ class GitHubMCPServer {
268259 const validatedArgs = validateLeaveGeneralCommentArgs ( args ) ;
269260 const result = await leaveGeneralComment (
270261 validatedArgs ,
271- this . config ,
272- this . githubClient
262+ this . config
273263 ) ;
274264 console . log ( `✅ leave_general_comment completed in ${ Date . now ( ) - startTime } ms` ) ;
275265 return {
@@ -287,8 +277,7 @@ class GitHubMCPServer {
287277 const validatedArgs = validateLeaveInlineCommentArgs ( args ) ;
288278 const result = await leaveInlineComment (
289279 validatedArgs ,
290- this . config ,
291- this . githubClient
280+ this . config
292281 ) ;
293282 console . log ( `✅ leave_inline_comment completed in ${ Date . now ( ) - startTime } ms` ) ;
294283 return {
@@ -306,8 +295,7 @@ class GitHubMCPServer {
306295 const validatedArgs = validateCreateCheckRunArgs ( args ) ;
307296 const result = await createCheckRun (
308297 validatedArgs ,
309- this . config ,
310- this . githubClient
298+ this . config
311299 ) ;
312300 console . log ( `✅ create_check_run completed in ${ Date . now ( ) - startTime } ms` ) ;
313301 return {
@@ -325,8 +313,7 @@ class GitHubMCPServer {
325313 const validatedArgs = validateGetPRInfoArgs ( args ) ;
326314 const result = await getPRInfo (
327315 validatedArgs ,
328- this . config ,
329- this . githubClient
316+ this . config
330317 ) ;
331318 console . log ( `✅ get_pr_info completed in ${ Date . now ( ) - startTime } ms` ) ;
332319 return {
@@ -344,8 +331,7 @@ class GitHubMCPServer {
344331 const validatedArgs = validateTriggerReviewArgs ( args ) ;
345332 const result = await triggerReview (
346333 validatedArgs ,
347- this . config ,
348- this . githubClient
334+ this . config
349335 ) ;
350336 console . log ( `✅ trigger_review completed in ${ Date . now ( ) - startTime } ms` ) ;
351337 return {
@@ -363,8 +349,7 @@ class GitHubMCPServer {
363349 const validatedArgs = validateGetPRCommentsArgs ( args ) ;
364350 const result = await getPRComments (
365351 validatedArgs ,
366- this . config ,
367- this . githubClient
352+ this . config
368353 ) ;
369354 console . log ( `✅ get_pr_comments completed in ${ Date . now ( ) - startTime } ms` ) ;
370355 return {
@@ -397,9 +382,6 @@ class GitHubMCPServer {
397382
398383 async run ( ) : Promise < void > {
399384 console . log ( '🔌 Starting MCP server connection...' ) ;
400- // Setup the proper GitHub client before starting
401- await this . setupGitHubClient ( ) ;
402-
403385 console . log ( '📡 Creating stdio transport...' ) ;
404386 const transport = new StdioServerTransport ( ) ;
405387 console . log ( '🔗 Connecting to transport...' ) ;
0 commit comments