@teambit/cli-mcp-server 0.0.88 → 0.0.90

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.docs.mdx CHANGED
@@ -211,7 +211,7 @@ In default mode, the server exposes a minimal set of essential tools focused on
211
211
 
212
212
  - `bit_remote_search`: Search for components in remote scopes
213
213
  - `bit_workspace_info`: Get comprehensive workspace information including status, components list, apps, templates, and dependency graph
214
- - `bit_component_details`: Get detailed information about a specific component including basic info and optionally its public API schema
214
+ - `bit_component_details`: Get detailed information about multiple components in parallel (up to 5 max) including basic info and optionally their public API schemas
215
215
  - `bit_create`: Create a new component (source files and config) using a template with proper argument validation and documentation
216
216
  - `bit_query`: Execute read-only Bit commands that safely inspect workspace and component state without making modifications
217
217
  - `bit_execute`: Execute any Bit command, including those that modify workspace or repository state (use with caution)
@@ -264,6 +264,44 @@ Search for multiple components in parallel for efficient discovery:
264
264
  - Data display: `["table", "pagination", "filter", "sort"]`
265
265
  - Button variations: `["button", "btn", "click"]`
266
266
 
267
+ ### bit_component_details
268
+
269
+ Get detailed information about multiple components in parallel (limited to 5 components max to prevent context overload):
270
+
271
+ ```json
272
+ {
273
+ "componentIds": ["acme.design/ui/button", "acme.design/forms/input"],
274
+ "includeSchema": true,
275
+ "cwd": "/path/to/workspace"
276
+ }
277
+ ```
278
+
279
+ **Parameters:**
280
+
281
+ - `componentIds` (required): Array of component IDs to get details for. Limited to 5 components max. Use full component IDs (e.g., `acme.design/ui/button`)
282
+ - `cwd` (required): Path to workspace directory
283
+ - `includeSchema` (optional): Include component public API schema (default: false)
284
+
285
+ **Examples:**
286
+
287
+ - Multiple UI components: `{"componentIds": ["acme.design/ui/button", "acme.design/ui/input", "acme.design/ui/dropdown"], "cwd": "/path/to/workspace"}`
288
+ - With schema information: `{"componentIds": ["teambit.base-ui/navigation/link"], "includeSchema": true, "cwd": "/path/to/workspace"}`
289
+ - Form components batch: `{"componentIds": ["acme.forms/input", "acme.forms/validation", "acme.forms/submit-button"], "cwd": "/path/to/workspace"}`
290
+
291
+ **Response Format:**
292
+
293
+ The tool returns a structured response with:
294
+
295
+ - `summary`: Statistics about the request (requested, successful, failed counts)
296
+ - `components`: Object containing successful component details keyed by component ID
297
+ - `failures`: Object containing error messages for failed components (if any)
298
+
299
+ **Error Handling:**
300
+
301
+ - Returns error if more than 5 components are requested
302
+ - Individual component failures don't block the entire request
303
+ - Clear error messages indicate which specific components failed and why
304
+
267
305
  ### bit_create
268
306
 
269
307
  Create a new component with template-based generation:
@@ -211,7 +211,7 @@ In default mode, the server exposes a minimal set of essential tools focused on
211
211
 
212
212
  - `bit_remote_search`: Search for components in remote scopes
213
213
  - `bit_workspace_info`: Get comprehensive workspace information including status, components list, apps, templates, and dependency graph
214
- - `bit_component_details`: Get detailed information about a specific component including basic info and optionally its public API schema
214
+ - `bit_component_details`: Get detailed information about multiple components in parallel (up to 5 max) including basic info and optionally their public API schemas
215
215
  - `bit_create`: Create a new component (source files and config) using a template with proper argument validation and documentation
216
216
  - `bit_query`: Execute read-only Bit commands that safely inspect workspace and component state without making modifications
217
217
  - `bit_execute`: Execute any Bit command, including those that modify workspace or repository state (use with caution)
@@ -264,6 +264,44 @@ Search for multiple components in parallel for efficient discovery:
264
264
  - Data display: `["table", "pagination", "filter", "sort"]`
265
265
  - Button variations: `["button", "btn", "click"]`
266
266
 
267
+ ### bit_component_details
268
+
269
+ Get detailed information about multiple components in parallel (limited to 5 components max to prevent context overload):
270
+
271
+ ```json
272
+ {
273
+ "componentIds": ["acme.design/ui/button", "acme.design/forms/input"],
274
+ "includeSchema": true,
275
+ "cwd": "/path/to/workspace"
276
+ }
277
+ ```
278
+
279
+ **Parameters:**
280
+
281
+ - `componentIds` (required): Array of component IDs to get details for. Limited to 5 components max. Use full component IDs (e.g., `acme.design/ui/button`)
282
+ - `cwd` (required): Path to workspace directory
283
+ - `includeSchema` (optional): Include component public API schema (default: false)
284
+
285
+ **Examples:**
286
+
287
+ - Multiple UI components: `{"componentIds": ["acme.design/ui/button", "acme.design/ui/input", "acme.design/ui/dropdown"], "cwd": "/path/to/workspace"}`
288
+ - With schema information: `{"componentIds": ["teambit.base-ui/navigation/link"], "includeSchema": true, "cwd": "/path/to/workspace"}`
289
+ - Form components batch: `{"componentIds": ["acme.forms/input", "acme.forms/validation", "acme.forms/submit-button"], "cwd": "/path/to/workspace"}`
290
+
291
+ **Response Format:**
292
+
293
+ The tool returns a structured response with:
294
+
295
+ - `summary`: Statistics about the request (requested, successful, failed counts)
296
+ - `components`: Object containing successful component details keyed by component ID
297
+ - `failures`: Object containing error messages for failed components (if any)
298
+
299
+ **Error Handling:**
300
+
301
+ - Returns error if more than 5 components are requested
302
+ - Individual component failures don't block the entire request
303
+ - Clear error messages indicate which specific components failed and why
304
+
267
305
  ### bit_create
268
306
 
269
307
  Create a new component with template-based generation:
@@ -85,7 +85,7 @@ export declare class CliMcpServerMain {
85
85
  getEditorConfigPath(editor: string, isGlobal: boolean, workspaceDir?: string): string;
86
86
  setupEditor(editor: string, options: SetupOptions, workspaceDir?: string): Promise<void>;
87
87
  writeRulesFile(editor: string, options: RulesOptions, workspaceDir?: string): Promise<void>;
88
- getRulesContent(consumerProject?: boolean): Promise<string>;
88
+ getRulesContent(consumerProject?: boolean, forceStandard?: boolean): Promise<string>;
89
89
  static slots: never[];
90
90
  static dependencies: import("@teambit/harmony").Aspect[];
91
91
  static runtime: import("@teambit/harmony").RuntimeDefinition;
@@ -858,20 +858,102 @@ class CliMcpServerMain {
858
858
  }
859
859
  registerComponentDetailsTool(server) {
860
860
  const toolName = 'bit_component_details';
861
- const description = 'Get detailed information about a specific component including basic info and optionally its public API schema';
861
+ const description = 'Get detailed information about multiple components in parallel. Supports batch requests for efficient component discovery. Limited to 5 components max to prevent context overload.';
862
862
  const schema = {
863
863
  cwd: _zod().z.string().describe('Path to workspace directory'),
864
- componentName: _zod().z.string().describe('Component name or component ID to get details for'),
864
+ componentIds: _zod().z.array(_zod().z.string()).describe('Array of component IDs to get details for. Limited to 5 components max. Examples: ["acme.design/ui/button", "acme.design/forms/input", "teambit.base-ui/navigation/link"]'),
865
865
  includeSchema: _zod().z.boolean().optional().describe('Include component public API schema (default: false)')
866
866
  };
867
867
  server.tool(toolName, description, schema, async params => {
868
868
  try {
869
+ // Validate that componentIds parameter is provided and valid
870
+ if (!params.componentIds || !Array.isArray(params.componentIds) || params.componentIds.length === 0) {
871
+ return {
872
+ content: [{
873
+ type: 'text',
874
+ text: 'Error: componentIds parameter must be provided as a non-empty array of component IDs. Example: ["acme.design/ui/button", "acme.design/forms/input"]'
875
+ }]
876
+ };
877
+ }
869
878
  const includeSchema = params.includeSchema === true;
870
- const componentName = params.componentName;
879
+ const componentIds = params.componentIds;
880
+
881
+ // Check limit of 5 components to prevent context overload
882
+ const maxComponents = 5;
883
+ if (componentIds.length > maxComponents) {
884
+ return {
885
+ content: [{
886
+ type: 'text',
887
+ text: `Error: Too many components requested. Maximum allowed is ${maxComponents} components, but ${componentIds.length} were requested. Please reduce the number of components in your request.`
888
+ }]
889
+ };
890
+ }
871
891
 
872
- // Get component details using IDE API with includeSchema parameter
873
- const ideApiResult = await this.callBitServerIDEAPI('getCompDetails', [componentName, includeSchema], params.cwd);
874
- return this.formatAsCallToolResult(ideApiResult);
892
+ // Execute component detail requests in parallel
893
+ this.logger.debug(`[MCP-DEBUG] Fetching details for ${componentIds.length} component(s) in parallel: ${componentIds.join(', ')}`);
894
+ const detailPromises = componentIds.map(async componentId => {
895
+ try {
896
+ const result = await this.callBitServerIDEAPI('getCompDetails', [componentId, includeSchema], params.cwd);
897
+ return {
898
+ componentId,
899
+ success: true,
900
+ details: result
901
+ };
902
+ } catch (error) {
903
+ this.logger.warn(`[MCP-DEBUG] Failed to get details for component "${componentId}": ${error.message}`);
904
+ return {
905
+ componentId,
906
+ success: false,
907
+ error: error.message
908
+ };
909
+ }
910
+ });
911
+ const detailResults = await Promise.all(detailPromises);
912
+
913
+ // Process and consolidate results
914
+ const successfulResults = detailResults.filter(r => r.success);
915
+ const failedResults = detailResults.filter(r => !r.success);
916
+ if (successfulResults.length === 0) {
917
+ let message = 'Failed to get details for any components';
918
+ if (failedResults.length > 0) {
919
+ message += '\n\nErrors:';
920
+ failedResults.forEach(r => {
921
+ message += `\n- "${r.componentId}": ${r.error}`;
922
+ });
923
+ }
924
+ return {
925
+ content: [{
926
+ type: 'text',
927
+ text: message
928
+ }]
929
+ };
930
+ }
931
+
932
+ // Build the response
933
+ const response = {
934
+ summary: {
935
+ requested: componentIds.length,
936
+ successful: successfulResults.length,
937
+ failed: failedResults.length,
938
+ includeSchema
939
+ },
940
+ components: {}
941
+ };
942
+
943
+ // Add successful component details
944
+ successfulResults.forEach(result => {
945
+ response.components[result.componentId] = result.details;
946
+ });
947
+
948
+ // Add failed components info if any
949
+ if (failedResults.length > 0) {
950
+ response.failures = {};
951
+ failedResults.forEach(result => {
952
+ response.failures[result.componentId] = result.error;
953
+ });
954
+ }
955
+ this.logger.debug(`[MCP-DEBUG] Component details fetched: ${successfulResults.length} successful, ${failedResults.length} failed`);
956
+ return this.formatAsCallToolResult(response);
875
957
  } catch (error) {
876
958
  this.logger.error(`[MCP-DEBUG] Error in bit_component_details tool: ${error.message}`);
877
959
  return this.formatErrorAsCallToolResult(error, 'getting component details');
@@ -1305,8 +1387,8 @@ class CliMcpServerMain {
1305
1387
  }
1306
1388
  await _mcp2().McpConfigWriter.writeRulesFile(editor, rulesOptions);
1307
1389
  }
1308
- async getRulesContent(consumerProject = false) {
1309
- return _mcp2().McpConfigWriter.getDefaultRulesContent(consumerProject);
1390
+ async getRulesContent(consumerProject = false, forceStandard = false) {
1391
+ return _mcp2().McpConfigWriter.getDefaultRulesContent(consumerProject, process.cwd(), forceStandard);
1310
1392
  }
1311
1393
  static async provider([cli, loggerMain]) {
1312
1394
  const logger = loggerMain.createLogger(_cliMcpServer().CliMcpServerAspect.id);