11import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js" ;
22import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js" ;
33import { z } from "zod" ;
4- import { testReactComponents } from "./tool/reactComponentTester.js" ;
5- import { testDataDrivenComponents } from "./tool/dataDrivenComponentTester.js" ;
64import { renderStorylineUI } from "./tool/storylineRenderer.js" ;
75import type { FeatureImpactAnalyzerInputs , ContributorRecommenderInputs , ReactComponentTestInputs , DataDrivenComponentInputs } from "./common/types.js" ;
86import { I18n } from "./common/i18n.js" ;
9- import { generateNewViz } from "./tool/generateNewViz.js" ;
107import { registerTestTools } from "./tools/test/testTools.js" ;
118import { registerVisualizationTools } from "./tools/visualization/register.js" ;
9+ import { registerReactTools } from "./tools/react/register.js" ;
1210
1311const server = new McpServer ( {
1412 name : "githru-mcp" ,
@@ -17,6 +15,7 @@ const server = new McpServer({
1715
1816registerTestTools ( server ) ;
1917registerVisualizationTools ( server ) ;
18+ registerReactTools ( server ) ;
2019
2120// ✨ Feature Impact Analyzer
2221server . registerTool (
@@ -144,120 +143,6 @@ server.registerTool(
144143 }
145144) ;
146145
147- server . registerTool (
148- "generate_csm_dict" ,
149- {
150- title : "Generate CSM Dictionary" ,
151- description : "Generates CSM (Commit Sequence Map) Dictionary from GitHub repository using AnalysisEngine" ,
152- inputSchema : {
153- repo : z . string ( ) . describe ( "GitHub repository (format: 'owner/repo' or 'https://github.com/owner/repo')" ) ,
154- githubToken : z . string ( ) . describe ( "GitHub authentication token" ) ,
155- baseBranchName : z . string ( ) . optional ( ) . describe ( "Base branch name to analyze (default: repository's default branch)" ) ,
156- locale : z . enum ( [ "en" , "ko" ] ) . default ( "en" ) . describe ( "Response language (en: English, ko: Korean)" ) ,
157- debug : z . boolean ( ) . default ( false ) . describe ( "Enable debug mode for detailed logging" ) ,
158- } ,
159- } ,
160-
161- async ( { repo, githubToken, baseBranchName, locale, debug } : {
162- repo : string ;
163- githubToken : string ;
164- baseBranchName ?: string ;
165- locale ?: string ;
166- debug ?: boolean ;
167- } ) => {
168- try {
169- const result = await generateNewViz ( {
170- repo,
171- githubToken,
172- baseBranchName,
173- locale,
174- debug
175- } ) ;
176-
177- return {
178- content : [
179- {
180- type : "text" ,
181- text : JSON . stringify ( result , null , 2 ) ,
182- } ,
183- ] ,
184- } ;
185- } catch ( err : any ) {
186- return {
187- content : [
188- { type : "text" , text : `CSM Dictionary generation error: ${ err ?. message ?? String ( err ) } ` } ,
189- ] ,
190- } ;
191- }
192- }
193- ) ;
194-
195- server . registerTool (
196- "react_component_test" ,
197- {
198- title : "React Component Test" ,
199- description : "Provides React components of varying complexity to test Claude's understanding capabilities" ,
200- inputSchema : {
201- complexity : z . enum ( [ "simple" , "medium" , "complex" , "all" ] ) . default ( "simple" ) . describe ( "Complexity level of React components to test" ) ,
202- componentType : z . enum ( [ "basic" , "chart" , "form" , "data-display" , "interactive" ] ) . optional ( ) . describe ( "Type of component to generate" ) ,
203- } ,
204- } ,
205-
206- async ( { complexity, componentType } : ReactComponentTestInputs ) => {
207- try {
208- const result = await testReactComponents ( { complexity, componentType } ) ;
209-
210- return {
211- content : [
212- {
213- type : "text" ,
214- text : result ,
215- } ,
216- ] ,
217- } ;
218- } catch ( err : any ) {
219- return {
220- content : [
221- { type : "text" , text : `React component test error: ${ err ?. message ?? String ( err ) } ` } ,
222- ] ,
223- } ;
224- }
225- }
226- ) ;
227-
228- server . registerTool (
229- "data_driven_component_test" ,
230- {
231- title : "Data-Driven React Component Test" ,
232- description : "Provides React components that work with data props to test Claude's understanding of data-driven patterns" ,
233- inputSchema : {
234- dataType : z . enum ( [ "chart" , "table" , "list" , "card" , "all" ] ) . default ( "all" ) . describe ( "Type of data-driven component to test" ) ,
235- sampleData : z . boolean ( ) . default ( true ) . describe ( "Include sample data with components" ) ,
236- } ,
237- } ,
238-
239- async ( { dataType, sampleData } : DataDrivenComponentInputs ) => {
240- try {
241- const result = await testDataDrivenComponents ( { dataType, sampleData } ) ;
242-
243- return {
244- content : [
245- {
246- type : "text" ,
247- text : result ,
248- } ,
249- ] ,
250- } ;
251- } catch ( err : any ) {
252- return {
253- content : [
254- { type : "text" , text : `Data-driven component test error: ${ err ?. message ?? String ( err ) } ` } ,
255- ] ,
256- } ;
257- }
258- }
259- ) ;
260-
261146server . registerTool (
262147 "render_storyline_ui" ,
263148 {
0 commit comments