secondbrainos-mcp-server 1.4.1 → 1.4.3

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.
Files changed (2) hide show
  1. package/build/index.js +42 -33
  2. package/package.json +1 -1
package/build/index.js CHANGED
@@ -476,7 +476,13 @@ class SecondBrainOSServer {
476
476
  async interceptFilePathArgs(args) {
477
477
  const result = { ...args };
478
478
  for (const [key, value] of Object.entries(result)) {
479
- if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
479
+ if (Array.isArray(value)) {
480
+ result[key] = await Promise.all(value.map(async (item) => typeof item === 'object' && item !== null
481
+ ? this.interceptFilePathArgs(item)
482
+ : item));
483
+ continue;
484
+ }
485
+ if (typeof value === 'object' && value !== null) {
480
486
  result[key] = await this.interceptFilePathArgs(value);
481
487
  continue;
482
488
  }
@@ -610,43 +616,46 @@ class SecondBrainOSServer {
610
616
  console.error('Failed to write agent skill files:', error);
611
617
  }
612
618
  }
613
- // 3. workflows
619
+ // 3. workflows (parallelized — each workflow fetched concurrently)
614
620
  if (this.runPromptChainPath) {
615
621
  try {
616
622
  const data = await this.callRunPromptChain('', '');
617
- const workflows = data.workflows || [];
618
- for (const wf of workflows) {
619
- if (!wf.name || !wf.workflow_id)
620
- continue;
621
- const folderName = toSnakeCase(wf.name);
622
- const workflowDetail = await this.callRunPromptChain('workflow', wf.workflow_id);
623
- const promptIds = workflowDetail.prompt_id || [];
624
- const promptResults = await Promise.all(promptIds.map(async (promptId) => {
625
- try {
626
- const promptData = await this.callRunPromptChain('prompt', promptId);
627
- return {
628
- id: promptId,
629
- name: promptData.name,
630
- order: promptData.order,
631
- description: promptData.description || ''
632
- };
633
- }
634
- catch {
635
- return { id: promptId, name: '', order: 0, description: '' };
636
- }
637
- }));
638
- const sortedPrompts = promptResults.sort((a, b) => (a.order || 0) - (b.order || 0));
639
- const workflowDocument = {
640
- skill_id: wf.workflow_id,
641
- name: wf.name,
642
- description: wf.description || '',
643
- prompts: sortedPrompts
644
- };
645
- writeSkill(path.join(skillsBase, 'workflows', folderName), `---\nname: secondbrainos_skill_${folderName}\ndescription: "${wf.description || wf.name}"\nuser-invocable: false\n---\n\n${JSON.stringify(workflowDocument, null, 2)}\n`);
646
- }
623
+ const workflows = (data.workflows || []).filter((wf) => wf.name && wf.workflow_id);
624
+ await Promise.all(workflows.map(async (wf) => {
625
+ try {
626
+ const folderName = toSnakeCase(wf.name);
627
+ const workflowDetail = await this.callRunPromptChain('workflow', wf.workflow_id);
628
+ const promptIds = workflowDetail.prompt_id || [];
629
+ const promptResults = await Promise.all(promptIds.map(async (promptId) => {
630
+ try {
631
+ const promptData = await this.callRunPromptChain('prompt', promptId);
632
+ return {
633
+ id: promptId,
634
+ name: promptData.name,
635
+ order: promptData.order,
636
+ description: promptData.description || ''
637
+ };
638
+ }
639
+ catch {
640
+ return { id: promptId, name: '', order: 0, description: '' };
641
+ }
642
+ }));
643
+ const sortedPrompts = promptResults.sort((a, b) => (a.order || 0) - (b.order || 0));
644
+ const workflowDocument = {
645
+ skill_id: wf.workflow_id,
646
+ name: wf.name,
647
+ description: wf.description || '',
648
+ prompts: sortedPrompts
649
+ };
650
+ writeSkill(path.join(skillsBase, 'workflows', folderName), `---\nname: secondbrainos_skill_${folderName}\ndescription: "${wf.description || wf.name}"\nuser-invocable: false\n---\n\n${JSON.stringify(workflowDocument, null, 2)}\n`);
651
+ }
652
+ catch (error) {
653
+ console.error(`Failed to write skill file for workflow "${wf.name}":`, error);
654
+ }
655
+ }));
647
656
  }
648
657
  catch (error) {
649
- console.error('Failed to write workflow skill files:', error);
658
+ console.error('Failed to fetch workflows for skill files:', error);
650
659
  }
651
660
  }
652
661
  // 4. knowledgebases
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "secondbrainos-mcp-server",
3
- "version": "1.4.1",
3
+ "version": "1.4.3",
4
4
  "description": "Second Brain OS MCP Server for Claude Desktop",
5
5
  "type": "module",
6
6
  "main": "build/index.js",