@easynet/agent-tool 1.0.60 → 1.0.62

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 (114) hide show
  1. package/dist/api/adapters/LangChainToolsHub.d.ts.map +1 -1
  2. package/dist/api/expose/extension-init/initExtension.d.ts.map +1 -1
  3. package/dist/api/expose/index.d.ts +1 -1
  4. package/dist/api/expose/index.d.ts.map +1 -1
  5. package/dist/api/expose/mcp-build/build.d.ts +1 -3
  6. package/dist/api/expose/mcp-build/build.d.ts.map +1 -1
  7. package/dist/api/expose/mcp-build/index.d.ts +2 -2
  8. package/dist/api/expose/mcp-build/index.d.ts.map +1 -1
  9. package/dist/api/expose/mcp-build/run.d.ts +1 -3
  10. package/dist/api/expose/mcp-build/run.d.ts.map +1 -1
  11. package/dist/api/main.cjs +35 -15
  12. package/dist/api/main.d.ts +34 -0
  13. package/dist/api/main.d.ts.map +1 -1
  14. package/dist/api/main.js +8 -4
  15. package/dist/api/runtimeFromConfig.d.ts +2 -5
  16. package/dist/api/runtimeFromConfig.d.ts.map +1 -1
  17. package/dist/api/runtimeFromConfig.helpers.d.ts +12 -0
  18. package/dist/api/runtimeFromConfig.helpers.d.ts.map +1 -0
  19. package/dist/build.cjs +32 -0
  20. package/dist/build.cjs.map +1 -0
  21. package/dist/build.d.ts +13 -0
  22. package/dist/build.d.ts.map +1 -0
  23. package/dist/build.js +7 -0
  24. package/dist/build.js.map +1 -0
  25. package/dist/chunk-45S2HPVU.js +463 -0
  26. package/dist/chunk-45S2HPVU.js.map +1 -0
  27. package/dist/{chunk-Y75CRPVF.js → chunk-5J27MF7S.js} +11 -12
  28. package/dist/chunk-5J27MF7S.js.map +1 -0
  29. package/dist/chunk-DEDDPMBU.js +3 -0
  30. package/dist/chunk-DEDDPMBU.js.map +1 -0
  31. package/dist/chunk-FWWN4D2F.js +3 -0
  32. package/dist/chunk-FWWN4D2F.js.map +1 -0
  33. package/dist/chunk-ICHSEIZN.cjs +4 -0
  34. package/dist/chunk-ICHSEIZN.cjs.map +1 -0
  35. package/dist/chunk-JNIWNSCQ.cjs +494 -0
  36. package/dist/chunk-JNIWNSCQ.cjs.map +1 -0
  37. package/dist/{chunk-JXYANBTH.cjs → chunk-M2GEHWPN.cjs} +88 -1675
  38. package/dist/chunk-M2GEHWPN.cjs.map +1 -0
  39. package/dist/chunk-NKYFYALQ.js +181 -0
  40. package/dist/chunk-NKYFYALQ.js.map +1 -0
  41. package/dist/{chunk-DPOLJN7F.cjs → chunk-NMZ4IMEW.cjs} +22 -25
  42. package/dist/chunk-NMZ4IMEW.cjs.map +1 -0
  43. package/dist/chunk-NOGGIM7B.cjs +4 -0
  44. package/dist/chunk-NOGGIM7B.cjs.map +1 -0
  45. package/dist/chunk-OG5ZSXQ5.cjs +1099 -0
  46. package/dist/chunk-OG5ZSXQ5.cjs.map +1 -0
  47. package/dist/{chunk-WQMHMPNC.cjs → chunk-PYCCJF7C.cjs} +2 -68
  48. package/dist/chunk-PYCCJF7C.cjs.map +1 -0
  49. package/dist/chunk-QXQ4477T.js +49 -0
  50. package/dist/chunk-QXQ4477T.js.map +1 -0
  51. package/dist/chunk-R55NXJIH.cjs +184 -0
  52. package/dist/chunk-R55NXJIH.cjs.map +1 -0
  53. package/dist/{chunk-A5C2MUNA.js → chunk-RJAF5XY6.js} +72 -1630
  54. package/dist/chunk-RJAF5XY6.js.map +1 -0
  55. package/dist/chunk-RZTTO5MQ.js +65 -0
  56. package/dist/chunk-RZTTO5MQ.js.map +1 -0
  57. package/dist/{chunk-MUBZV65R.cjs → chunk-U67QDQFQ.cjs} +74 -41
  58. package/dist/chunk-U67QDQFQ.cjs.map +1 -0
  59. package/dist/chunk-WO4LZKPQ.cjs +359 -0
  60. package/dist/chunk-WO4LZKPQ.cjs.map +1 -0
  61. package/dist/{chunk-FCYBA7PR.js → chunk-WUMLZERG.js} +3 -62
  62. package/dist/chunk-WUMLZERG.js.map +1 -0
  63. package/dist/chunk-XPGHS4W7.cjs +73 -0
  64. package/dist/chunk-XPGHS4W7.cjs.map +1 -0
  65. package/dist/chunk-YL6RC7HQ.cjs +4 -0
  66. package/dist/chunk-YL6RC7HQ.cjs.map +1 -0
  67. package/dist/chunk-YLWTSNTT.js +3 -0
  68. package/dist/chunk-YLWTSNTT.js.map +1 -0
  69. package/dist/{chunk-IWM5B5DU.js → chunk-YMHUDRYE.js} +60 -31
  70. package/dist/chunk-YMHUDRYE.js.map +1 -0
  71. package/dist/chunk-YPGF5Y2Y.js +341 -0
  72. package/dist/chunk-YPGF5Y2Y.js.map +1 -0
  73. package/dist/chunk-YRFUGA3C.js +1072 -0
  74. package/dist/chunk-YRFUGA3C.js.map +1 -0
  75. package/dist/chunk-ZDSZHEQU.cjs +52 -0
  76. package/dist/chunk-ZDSZHEQU.cjs.map +1 -0
  77. package/dist/core/index.cjs +1 -0
  78. package/dist/core/index.js +1 -0
  79. package/dist/core/runtime.cjs +7 -5
  80. package/dist/core/runtime.js +3 -1
  81. package/dist/extension.cjs +58 -0
  82. package/dist/extension.cjs.map +1 -0
  83. package/dist/extension.d.ts +6 -0
  84. package/dist/extension.d.ts.map +1 -0
  85. package/dist/extension.js +5 -0
  86. package/dist/extension.js.map +1 -0
  87. package/dist/index.cjs +79 -592
  88. package/dist/index.cjs.map +1 -1
  89. package/dist/index.d.ts +51 -26
  90. package/dist/index.d.ts.map +1 -1
  91. package/dist/index.js +58 -518
  92. package/dist/index.js.map +1 -1
  93. package/dist/security.cjs +26 -0
  94. package/dist/security.cjs.map +1 -0
  95. package/dist/security.d.ts +6 -0
  96. package/dist/security.d.ts.map +1 -0
  97. package/dist/security.js +5 -0
  98. package/dist/security.js.map +1 -0
  99. package/dist/utils/cli/help.d.ts +2 -0
  100. package/dist/utils/cli/help.d.ts.map +1 -0
  101. package/dist/utils/cli/index.cjs +107 -81
  102. package/dist/utils/cli/index.cjs.map +1 -1
  103. package/dist/utils/cli/index.d.ts.map +1 -1
  104. package/dist/utils/cli/index.js +95 -69
  105. package/dist/utils/cli/index.js.map +1 -1
  106. package/package.json +18 -4
  107. package/dist/chunk-A5C2MUNA.js.map +0 -1
  108. package/dist/chunk-DPOLJN7F.cjs.map +0 -1
  109. package/dist/chunk-FCYBA7PR.js.map +0 -1
  110. package/dist/chunk-IWM5B5DU.js.map +0 -1
  111. package/dist/chunk-JXYANBTH.cjs.map +0 -1
  112. package/dist/chunk-MUBZV65R.cjs.map +0 -1
  113. package/dist/chunk-WQMHMPNC.cjs.map +0 -1
  114. package/dist/chunk-Y75CRPVF.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/api/expose/mcp-build/init.ts","../src/tools/scanPackage.ts","../src/api/expose/mcp-build/generator.ts","../src/api/expose/mcp-build/build.ts","../src/api/expose/mcp-build/run.ts"],"names":["path","fs","__dirname","path4","path5","fs3"],"mappings":";;;;;;;AAaA,IAAM,SAAA,GAAY;AAAA,EAChB,cAAA,EAAgB,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAAA,EAchB,WAAA,EAAa,CAAA;;AAAA;AAAA;AAAA,CAAA;AAAA,EAKb,WAAA,EAAa,CAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAAA,EASb,eAAA,EAAiB,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAAA,EAWjB,sBAAA,EAAwB,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAAA,EAQxB,6BAAA,EAA+B,CAAA;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA,CAAA;AAAA,EAS/B,+BAAA,EAAiC,CAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAAA,EAKjC,WAAA,EAAa,CAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;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,EAAA,MAAM,KAAA,GAAQ,MAAM,KAAA,EAAO,CAAC,MAAM,KAAA,EAAYA,KAAA,CAAA,QAAA,CAAS,KAAK,CAAC,CAAA,EAAG;AAAA,IAC9D,GAAA,EAAK,GAAA;AAAA,IACL,KAAA,EAAO,CAAC,MAAA,EAAQ,MAAA,EAAQ,SAAS,CAAA;AAAA,IACjC,KAAA,EAAO;AAAA,GACR,CAAA;AAED,EAAA,OAAO,EAAE,SAAS,KAAA,EAAM;AAC1B","file":"chunk-5J27MF7S.js","sourcesContent":["/**\n * Scaffold a new MCP tool project: @tool TS, SKILL sample, tsconfig, README.\n * Use: init → build → run.\n */\n\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nexport interface InitOptions {\n /** Target directory to create project (default: cwd). */\n targetPath?: string;\n}\n\nconst TEMPLATES = {\n \"package.json\": `{\n \"name\": \"my-mcp-tools\",\n \"version\": \"1.0.0\",\n \"private\": true,\n \"type\": \"module\",\n \"scripts\": {\n \"build\": \"node build.mjs\",\n \"start\": \"node start.mjs\"\n },\n \"devDependencies\": {\n \"@easynet/agent-tool\": \"latest\"\n }\n}\n`,\n \"build.mjs\": `import { buildMCPPackage } from \"@easynet/agent-tool/build\";\n\nconst result = await buildMCPPackage({ outDir: \"dist\" });\nconsole.log(\"Built\", result.toolCount, \"tool(s) ->\", result.outDir);\n`,\n \"start.mjs\": `import { runMCPServer } from \"@easynet/agent-tool/build\";\n\nconst { process: child } = await runMCPServer({ path: \"./dist\" });\nchild.stdin?.pipe(process.stdin);\nchild.stdout?.pipe(process.stdout);\nchild.stderr?.pipe(process.stderr);\nprocess.stdin?.ref();\nchild.on(\"close\", (code) => process.exit(code ?? 0));\n`,\n \"tsconfig.json\": `{\n \"compilerOptions\": {\n \"target\": \"ES2022\",\n \"module\": \"ESNext\",\n \"strict\": true,\n \"skipLibCheck\": true,\n \"noEmit\": true\n },\n \"include\": [\"src/**/*.ts\"]\n}\n`,\n \"src/tools/example.ts\": `/**\n * Add two numbers.\n * @tool\n */\nexport async function add(a: number, b: number): Promise<number> {\n return a + b;\n}\n`,\n \"skills/hello-skill/SKILL.md\": `---\nname: hello-skill\ndescription: Say hello with a name.\n---\n\n# Hello Skill\n\nReturns a greeting for the given name.\n`,\n \"skills/hello-skill/handler.js\": `export default async function handler(args, ctx) {\n const name = args?.name ?? \"World\";\n return { message: \\`Hello, \\${name}!\\` };\n}\n`,\n \"README.md\": `# MCP Tool Project\n\nScaffolded by \\`agent-tool init\\`. Workflow:\n\n1. **init** — create project template (you are here)\n2. **npm install** — install dependencies\n3. **npm run build** — generate MCP package under \\`dist/\\`\n4. **npm start** — start the MCP server for testing\n\n## Quick start\n\n\\`\\`\\`bash\nnpm install\nnpm run build\nnpm start\n\\`\\`\\`\n\nEdit \\`src/tools/*.ts\\` (add \\`@tool\\` JSDoc) and/or \\`skills/*/SKILL.md\\`, then \\`npm run build\\` again.\n`,\n};\n\n/**\n * Create project template at targetPath. Writes tsconfig, src/tools/example.ts,\n * skills/hello-skill (SKILL.md + handler.js), and README.\n */\nexport async function initProject(options: InitOptions = {}): Promise<{ targetPath: string; filesCreated: string[] }> {\n const targetPath = path.resolve(options.targetPath ?? process.cwd());\n const filesCreated: string[] = [];\n\n await fs.mkdir(targetPath, { recursive: true });\n\n for (const [relPath, content] of Object.entries(TEMPLATES)) {\n const fullPath = path.join(targetPath, relPath);\n await fs.mkdir(path.dirname(fullPath), { recursive: true });\n try {\n await fs.access(fullPath);\n if (relPath === \"package.json\") continue; // skip so we don't overwrite existing\n } catch {\n // file doesn't exist, write it\n }\n await fs.writeFile(fullPath, content, \"utf8\");\n filesCreated.push(relPath);\n }\n\n return { targetPath, filesCreated };\n}\n","/**\n * Scan package for tools: scanForAllTools, scanPackageForTools, registerPackageTools.\n * Aggregates function/skill/n8n discovery and optional directory discovery.\n */\n\nimport * as path from \"node:path\";\nimport type { ToolSpec } from \"../core/types/ToolSpec.js\";\nimport {\n discoverTools,\n DirectoryScanner,\n type DiscoverToolsOptions,\n} from \"./discoveryFactory.js\";\n\nexport interface ScanAllToolsResult {\n specs: ToolSpec[];\n errors: Array<{ file: string; message: string }>;\n warnings: Array<{ file: string; message: string }>;\n}\n\nexport interface ScanAllToolsOptions {\n include?: string[];\n tsconfigPath?: string;\n includeN8n?: boolean;\n}\n\nexport async function scanForAllTools(\n projectPath: string,\n options: ScanAllToolsOptions = {},\n): Promise<ScanAllToolsResult> {\n const include = options.include ?? [\"**/*.ts\"];\n const tsconfigPath = options.tsconfigPath;\n const includeN8n = options.includeN8n === true;\n const opts: DiscoverToolsOptions = { include, tsconfigPath };\n\n const results = await Promise.all([\n discoverTools(\"function\", projectPath, opts),\n discoverTools(\"skill\", projectPath, opts),\n ...(includeN8n ? [discoverTools(\"n8n\", projectPath, opts)] : []),\n ]);\n const specs = results.flatMap((r) => r.specs);\n const errors = results.flatMap((r) => r.errors);\n const warnings = results.flatMap((r) => r.warnings ?? []);\n\n return { specs, errors, warnings };\n}\n\nexport interface ScanPackageResult {\n specs: ToolSpec[];\n errors: Array<{ file: string; message: string }>;\n warnings: Array<{ file: string; message: string }>;\n}\n\nexport interface ScanPackageOptions extends ScanAllToolsOptions {\n includeDirectoryDiscovery?: boolean;\n namespace?: string;\n}\n\nexport async function scanPackageForTools(\n packagePath: string,\n options: ScanPackageOptions = {},\n): Promise<ScanPackageResult> {\n const root = path.resolve(packagePath);\n const includeDirectoryDiscovery = options.includeDirectoryDiscovery !== false;\n const namespace = options.namespace ?? \"pkg\";\n\n const errors: Array<{ file: string; message: string }> = [];\n const warnings: Array<{ file: string; message: string }> = [];\n\n const scanResult = await scanForAllTools(root, {\n include: options.include,\n tsconfigPath: options.tsconfigPath,\n includeN8n: options.includeN8n,\n });\n errors.push(...scanResult.errors);\n warnings.push(...scanResult.warnings);\n\n let dirSpecs: ToolSpec[] = [];\n if (includeDirectoryDiscovery) {\n const scanner = new DirectoryScanner({\n roots: [root],\n namespace,\n onError: (dir, err) => errors.push({ file: dir, message: err.message }),\n });\n try {\n dirSpecs = await scanner.scan();\n } catch (err) {\n errors.push({\n file: root,\n message: err instanceof Error ? err.message : String(err),\n });\n }\n }\n\n const byName = new Map<string, ToolSpec>();\n for (const spec of dirSpecs) byName.set(spec.name, spec);\n for (const spec of scanResult.specs) {\n if (!byName.has(spec.name)) byName.set(spec.name, spec);\n }\n\n return { specs: Array.from(byName.values()), errors, warnings };\n}\n\nexport async function registerPackageTools(\n registry: { bulkRegister: (specs: ToolSpec[]) => void },\n packagePath: string,\n options: ScanPackageOptions = {},\n): Promise<ScanPackageResult> {\n const result = await scanPackageForTools(packagePath, options);\n if (result.specs.length > 0) registry.bulkRegister(result.specs);\n return result;\n}\n","/**\n * Generate MCP server entrypoint, tool-specs.json, invokers for function/skill/n8n.\n * Accepts unified ToolSpec[] (reads _meta.sourcePath/exportName, endpoint for codegen).\n */\n\nimport * as path from \"node:path\";\nimport * as fs from \"node:fs/promises\";\nimport { fileURLToPath } from \"node:url\";\nimport type { ToolSpec } from \"../../../core/types/ToolSpec.js\";\nimport { FUNCTION_KIND } from \"../../../tools/function/types.js\";\nimport { SKILL_KIND } from \"../../../tools/skill/types.js\";\nimport { N8N_KIND } from \"../../../tools/n8n/types.js\";\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\n/** Function spec with required codegen fields (from ToolSpec._meta). */\ninterface FunctionSpecForCodegen extends ToolSpec {\n kind: \"function\";\n _meta: { sourcePath: string; exportName: string; projectPath?: string };\n}\n\n/** Skill spec with required codegen fields. */\ninterface SkillSpecForCodegen extends ToolSpec {\n kind: \"skill\";\n _meta: { sourcePath: string; projectPath?: string };\n}\n\n/** N8n spec with endpoint (webhook URL) and _meta.sourcePath. */\ninterface N8nSpecForCodegen extends ToolSpec {\n kind: \"n8n\";\n endpoint?: string;\n _meta?: { sourcePath?: string };\n}\n\nasync function loadTemplate(name: string): Promise<string> {\n for (const dir of [\n path.join(__dirname, \"templates\"),\n path.join(__dirname, \"..\", \"templates\"),\n ]) {\n try {\n return await fs.readFile(path.join(dir, name), \"utf-8\");\n } catch {\n continue;\n }\n }\n throw new Error(`Template not found: ${name}. Tried templates/ next to generator and ../templates.`);\n}\n\nconst TEMPLATE_NAMES = {\n mcpServer: \"mcp-server.js\",\n toolIndex: \"tool-index.js\",\n skillInvoker: \"skill-invoker.js\",\n n8nInvoker: \"n8n-invoker.js\",\n} as const;\n\nfunction buildToolIndexCases(specs: FunctionSpecForCodegen[], fromGeneratedToProject: string): string {\n return specs\n .map((s) => {\n const modPath = path.join(fromGeneratedToProject, s._meta.sourcePath).replace(/\\\\/g, \"/\");\n return ` case \"${s.name}\": return (await import(\"${modPath}\")).${s._meta.exportName};`;\n })\n .join(\"\\n\");\n}\n\nfunction buildSkillInvokerCases(specs: SkillSpecForCodegen[], fromGeneratedToProject: string): string {\n return specs\n .map((s) => {\n const handlerPath = path.join(fromGeneratedToProject, s._meta.sourcePath, \"handler\").replace(/\\\\/g, \"/\");\n const descEscaped = (s.description ?? \"\").replace(/\"/g, '\\\\\"');\n return ` case \"${s.name}\": {\n const mod = await import(\"${handlerPath}.js\")\n .catch(() => import(\"${handlerPath}.mjs\"))\n .catch(() => null);\n if (!mod) return { result: null, error: \"No handler\" };\n const fn = mod.default ?? mod.handler;\n if (typeof fn !== \"function\") return { result: null, error: \"No handler\" };\n const ctx = { requestId: \"mcp\", taskId: \"mcp\", skill: { name: \"${s.name}\", description: \"${descEscaped}\", instructions: \"\", resources: [], readResource: async () => \"\", getResourcesByType: () => [], dirPath: \"\" } };\n const out = await fn(args, ctx);\n return out?.result !== undefined ? out.result : out;\n }`;\n })\n .join(\"\\n\");\n}\n\nfunction buildN8nInvokerCases(specs: N8nSpecForCodegen[]): string {\n return specs\n .map((s) => {\n const webhookUrl = s.endpoint;\n const url =\n webhookUrl\n ? `\"${webhookUrl}\"`\n : \"process.env.N8N_WEBHOOK_\" + s.name.replace(/[^a-zA-Z0-9]/g, \"_\").toUpperCase() + \" ?? null\";\n return ` case \"${s.name}\": {\n const url = ${url};\n if (!url) throw new Error(\"n8n webhook not configured for ${s.name}. Set N8N_WEBHOOK_* or add webhook to workflow.\");\n const res = await fetch(url, { method: \"POST\", headers: { \"Content-Type\": \"application/json\" }, body: JSON.stringify(args) });\n if (!res.ok) throw new Error(\"n8n request failed: \" + res.status);\n return res.json().catch(() => ({}));\n }`;\n })\n .join(\"\\n\");\n}\n\n/** Write generated files into outDir. projectPath is the folder containing source. */\nexport async function generate(options: {\n specs: ToolSpec[];\n outDir: string;\n projectPath: string;\n}): Promise<{ entryPath: string; mcpJsonPath: string }> {\n const { specs, outDir, projectPath } = options;\n await fs.mkdir(outDir, { recursive: true });\n\n const functionSpecs = specs.filter(\n (s): s is FunctionSpecForCodegen =>\n s.kind === FUNCTION_KIND && s._meta?.sourcePath != null && s._meta?.exportName != null,\n );\n const skillSpecs = specs.filter(\n (s): s is SkillSpecForCodegen => s.kind === SKILL_KIND && s._meta?.sourcePath != null,\n );\n const n8nSpecs = specs.filter((s): s is N8nSpecForCodegen => s.kind === N8N_KIND);\n\n const toolSpecsJson = specs.map((s) => ({\n kind: s.kind,\n name: s.name,\n description: s.description,\n inputSchema: s.inputSchema,\n ...(s.kind === FUNCTION_KIND && s._meta?.sourcePath != null && s._meta?.exportName != null && {\n outputSchema: s.outputSchema ?? { type: \"object\", additionalProperties: true },\n sourcePath: s._meta.sourcePath,\n exportName: s._meta.exportName,\n }),\n _meta: s._meta,\n ...(s.kind === SKILL_KIND && s._meta?.sourcePath != null && { sourcePath: s._meta.sourcePath }),\n ...(s.kind === N8N_KIND && {\n sourcePath: s._meta?.sourcePath,\n webhookUrl: s.endpoint,\n }),\n }));\n await fs.writeFile(\n path.join(outDir, \"tool-specs.json\"),\n JSON.stringify(toolSpecsJson, null, 2),\n \"utf-8\",\n );\n\n const configJson = { projectPath: path.resolve(projectPath) };\n await fs.writeFile(path.join(outDir, \"config.json\"), JSON.stringify(configJson, null, 2), \"utf-8\");\n\n const rel = path.relative(outDir, projectPath) || \".\";\n const fromGeneratedToProject = rel.split(path.sep).length ? rel : \".\";\n\n const [mcpServerTemplate, toolIndexTemplate, skillInvokerTemplate, n8nInvokerTemplate] = await Promise.all([\n loadTemplate(TEMPLATE_NAMES.mcpServer),\n loadTemplate(TEMPLATE_NAMES.toolIndex),\n loadTemplate(TEMPLATE_NAMES.skillInvoker),\n loadTemplate(TEMPLATE_NAMES.n8nInvoker),\n ]);\n\n const toolIndexTs = toolIndexTemplate.replace(\"{{CASES}}\", buildToolIndexCases(functionSpecs, fromGeneratedToProject));\n await fs.writeFile(path.join(outDir, \"tool-index.ts\"), toolIndexTs, \"utf-8\");\n\n const skillCases = buildSkillInvokerCases(skillSpecs, fromGeneratedToProject);\n const skillDefaultCase =\n skillSpecs.length === 0 ? \"default: throw new Error('Unknown skill: ' + name);\" : 'default: throw new Error(\"Unknown skill: \" + name);';\n const skillInvokerTs = skillInvokerTemplate.replace(\"{{CASES}}\", skillCases).replace(\"{{DEFAULT_CASE}}\", skillDefaultCase);\n await fs.writeFile(path.join(outDir, \"skill-invoker.ts\"), skillInvokerTs, \"utf-8\");\n\n const n8nCases = buildN8nInvokerCases(n8nSpecs);\n const n8nDefaultCase =\n n8nSpecs.length === 0 ? \"default: throw new Error('Unknown n8n tool: ' + name);\" : 'default: throw new Error(\"Unknown n8n tool: \" + name);';\n const n8nInvokerTs = n8nInvokerTemplate.replace(\"{{CASES}}\", n8nCases).replace(\"{{DEFAULT_CASE}}\", n8nDefaultCase);\n await fs.writeFile(path.join(outDir, \"n8n-invoker.ts\"), n8nInvokerTs, \"utf-8\");\n\n await fs.writeFile(path.join(outDir, \"mcp-server.ts\"), mcpServerTemplate, \"utf-8\");\n\n const mcpJson = {\n command: \"npx\",\n args: [\"-y\", \"tsx\", path.join(outDir, \"mcp-server.ts\")],\n };\n await fs.writeFile(path.join(outDir, \"mcp.json\"), JSON.stringify(mcpJson, null, 2), \"utf-8\");\n\n const packageJson = {\n name: \"function-tools-mcp\",\n version: \"1.0.0\",\n type: \"module\",\n description: \"MCP server generated from @tool functions, SKILL.md, and workflow.json\",\n main: \"mcp-server.ts\",\n scripts: { start: \"npx tsx mcp-server.ts\" },\n dependencies: {\n \"@modelcontextprotocol/sdk\": \"^1.25.3\",\n typescript: \">=5.0.0\",\n tsx: \">=4.0.0\",\n },\n };\n await fs.writeFile(path.join(outDir, \"package.json\"), JSON.stringify(packageJson, null, 2), \"utf-8\");\n\n return {\n entryPath: path.join(outDir, \"mcp-server.ts\"),\n mcpJsonPath: path.join(outDir, \"mcp.json\"),\n };\n}\n","/**\n * MCP build: scan project for @tool, SKILL, n8n; generate MCP entrypoint and npm package.\n */\n\nimport * as path from \"node:path\";\nimport { scanForAllTools } from \"../../../tools/scanPackage.js\";\nimport { generate } from \"./generator.js\";\nimport type { BuildResult } from \"./types.js\";\nimport type { ToolSpec } from \"../../../core/types/ToolSpec.js\";\n\nexport interface BuildOptions {\n /** Project root (folder to scan; default: cwd). */\n projectPath?: string;\n /** Output directory for generated files (default: projectPath/dist). */\n outDir?: string;\n /** Glob patterns for TS files (default: [\"**\\/*.ts\"]). Used for @tool (TypeScript) scanning only. */\n include?: string[];\n /** Path to tsconfig.json (default: projectPath/tsconfig.json). Used for @tool scanning only. */\n tsconfigPath?: string;\n /** Include n8n (workflow.json) tools. Default false: we do not start or install n8n-local; set true if you use n8n. */\n includeN8n?: boolean;\n}\n\n/**\n * Scan project for all tools (@tool, SKILL, n8n); generate MCP server + tool-specs + invokers (npm package).\n */\nexport async function buildMCPPackage(options: BuildOptions = {}): Promise<BuildResult> {\n const projectPath = path.resolve(options.projectPath ?? process.cwd());\n const outDir = path.resolve(projectPath, options.outDir ?? \"dist\");\n const include = options.include ?? [\"**/*.ts\"];\n const tsconfigPath = options.tsconfigPath;\n\n const scanResult = await scanForAllTools(projectPath, {\n include,\n tsconfigPath,\n includeN8n: options.includeN8n,\n });\n\n if (scanResult.errors.length > 0) {\n const msg = scanResult.errors.map((e) => `${e.file}: ${e.message}`).join(\"; \");\n throw new Error(`Scan failed: ${msg}`);\n }\n\n const allSpecs: ToolSpec[] = scanResult.specs;\n\n if (allSpecs.length === 0) {\n throw new Error(\n \"No tools found. Add @tool functions (JSDoc), SKILL.md directories, or workflow.json directories.\",\n );\n }\n\n const { entryPath, mcpJsonPath } = await generate({\n specs: allSpecs,\n outDir,\n projectPath,\n });\n\n return {\n outDir,\n toolCount: allSpecs.length,\n entryPath,\n mcpJsonPath,\n };\n}\n","/**\n * Run step: start the generated MCP server (stdio) for testing. Spawns entrypoint via npx tsx.\n */\n\nimport { spawn } from \"node:child_process\";\nimport * as path from \"node:path\";\nimport * as fs from \"node:fs/promises\";\n\nexport interface RunOptions {\n /** Directory containing generated mcp-server (default: cwd or cwd/dist). */\n path?: string;\n}\n\n/**\n * Start the MCP server from the given directory.\n * Expects mcp-server.ts and tool-specs.json there; runs via npx tsx mcp-server.ts.\n * Returns a child process; caller should handle stdin/stdout and cleanup.\n */\nexport async function runMCPServer(options: RunOptions = {}): Promise<{ process: ReturnType<typeof spawn> }> {\n const base = options.path ?? process.cwd();\n const candidates = [\n path.join(base, \"mcp-server.ts\"),\n path.join(base, \"mcp-server.js\"),\n path.join(base, \"dist\", \"mcp-server.ts\"),\n path.join(base, \"dist\", \"mcp-server.js\"),\n path.join(base, \"generated\", \"mcp-server.ts\"),\n path.join(base, \"generated\", \"mcp-server.js\"),\n ];\n let entry = \"\";\n for (const p of candidates) {\n try {\n await fs.access(p);\n entry = p;\n break;\n } catch {\n // continue\n }\n }\n if (!entry) {\n throw new Error(\n `MCP entrypoint not found. Run \"agent-tool build\" first, or pass --path to a directory containing mcp-server.ts. Tried: ${candidates.join(\", \")}`,\n );\n }\n\n const dir = path.dirname(entry);\n const child = spawn(\"npx\", [\"-y\", \"tsx\", path.basename(entry)], {\n cwd: dir,\n stdio: [\"pipe\", \"pipe\", \"inherit\"],\n shell: false,\n });\n\n return { process: child };\n}\n"]}
@@ -0,0 +1,3 @@
1
+
2
+ //# sourceMappingURL=chunk-DEDDPMBU.js.map
3
+ //# sourceMappingURL=chunk-DEDDPMBU.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-DEDDPMBU.js"}
@@ -0,0 +1,3 @@
1
+
2
+ //# sourceMappingURL=chunk-FWWN4D2F.js.map
3
+ //# sourceMappingURL=chunk-FWWN4D2F.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-FWWN4D2F.js"}
@@ -0,0 +1,4 @@
1
+ 'use strict';
2
+
3
+ //# sourceMappingURL=chunk-ICHSEIZN.cjs.map
4
+ //# sourceMappingURL=chunk-ICHSEIZN.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-ICHSEIZN.cjs"}
@@ -0,0 +1,494 @@
1
+ 'use strict';
2
+
3
+ var chunkQEJF3KDV_cjs = require('./chunk-QEJF3KDV.cjs');
4
+ var path = require('path');
5
+ var fs = require('fs');
6
+ var ts2 = require('typescript');
7
+ var promises = require('fs/promises');
8
+
9
+ function _interopNamespace(e) {
10
+ if (e && e.__esModule) return e;
11
+ var n = Object.create(null);
12
+ if (e) {
13
+ Object.keys(e).forEach(function (k) {
14
+ if (k !== 'default') {
15
+ var d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: function () { return e[k]; }
19
+ });
20
+ }
21
+ });
22
+ }
23
+ n.default = e;
24
+ return Object.freeze(n);
25
+ }
26
+
27
+ var path__namespace = /*#__PURE__*/_interopNamespace(path);
28
+ var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
29
+ var ts2__namespace = /*#__PURE__*/_interopNamespace(ts2);
30
+
31
+ async function findDirsContainingFile(rootPath, fileName) {
32
+ const found = [];
33
+ await collectDirsWithFile(rootPath, fileName, found);
34
+ return found;
35
+ }
36
+ async function collectDirsWithFile(dir, fileName, acc) {
37
+ let entries;
38
+ try {
39
+ const e = await promises.readdir(dir, { withFileTypes: true });
40
+ entries = e.map((x) => ({
41
+ name: x.name,
42
+ isDirectory: x.isDirectory(),
43
+ isFile: x.isFile()
44
+ }));
45
+ } catch {
46
+ return;
47
+ }
48
+ if (entries.some((x) => x.isFile && x.name === fileName)) acc.push(dir);
49
+ for (const entry of entries) {
50
+ if (!entry.isDirectory || entry.name === "node_modules" || entry.name.startsWith(".")) continue;
51
+ await collectDirsWithFile(path.join(dir, entry.name), fileName, acc);
52
+ }
53
+ }
54
+ function pathToToolName(sourcePath, programName) {
55
+ const normalized = sourcePath.replace(/\\/g, "/").replace(/\.(ts|tsx|js|mjs|json)$/i, "");
56
+ const segments = normalized.split("/").filter(Boolean);
57
+ return segments.length === 0 ? programName : `${segments.join(".")}.${programName}`;
58
+ }
59
+ function buildOutputSchemaFromReturnType(node, typeChecker, onWarn) {
60
+ const sig = typeChecker.getSignatureFromDeclaration(node);
61
+ if (!sig) {
62
+ onWarn?.("Could not get signature for return type, using object");
63
+ return { type: "object", additionalProperties: true };
64
+ }
65
+ let returnType = typeChecker.getReturnTypeOfSignature(sig);
66
+ if (returnType.getSymbol?.()?.getName() === "Promise") {
67
+ const typeArgs = returnType.typeArguments;
68
+ if (typeArgs?.[0]) returnType = typeArgs[0];
69
+ }
70
+ const schema = typeToJsonSchema(returnType, typeChecker, onWarn);
71
+ const hasProps = typeof schema === "object" && schema.type === "object" && Object.keys(schema.properties ?? {}).length > 0;
72
+ return hasProps ? schema : { type: "object", additionalProperties: true };
73
+ }
74
+ function buildInputSchemaFromParams(node, typeChecker, onWarn) {
75
+ const properties = {};
76
+ const required = [];
77
+ if (!node.parameters.length) {
78
+ return { schema: { type: "object", properties: {} }, required: [] };
79
+ }
80
+ for (const param of node.parameters) {
81
+ const name = param.name.getText();
82
+ if (name.startsWith("_") && name.length <= 2) continue;
83
+ const sym = param.symbol;
84
+ const paramType = sym ? typeChecker.getTypeOfSymbolAtLocation(sym, param) : typeChecker.getTypeAtLocation(param);
85
+ const isOptional = !!param.questionToken || param.initializer !== void 0;
86
+ const propSchema = typeToJsonSchema(paramType, typeChecker, onWarn);
87
+ properties[name] = propSchema;
88
+ if (!isOptional) required.push(name);
89
+ }
90
+ const paramNames = Object.keys(properties);
91
+ if (paramNames.length === 1) {
92
+ const soleName = paramNames[0];
93
+ const inner = properties[soleName];
94
+ if (inner && typeof inner === "object" && inner.type === "object" && inner.properties && typeof inner.properties === "object") {
95
+ return {
96
+ schema: {
97
+ type: "object",
98
+ properties: inner.properties,
99
+ ...Array.isArray(inner.required) && inner.required.length > 0 ? { required: inner.required } : {},
100
+ ...inner.additionalProperties !== void 0 ? { additionalProperties: inner.additionalProperties } : {}
101
+ },
102
+ required: inner.required ?? []
103
+ };
104
+ }
105
+ }
106
+ return {
107
+ schema: {
108
+ type: "object",
109
+ properties,
110
+ ...required.length > 0 ? { required } : {}
111
+ },
112
+ required
113
+ };
114
+ }
115
+ function typeToJsonSchema(type, typeChecker, onWarn) {
116
+ const flags = type.flags;
117
+ if (flags & ts2__namespace.TypeFlags.String) return { type: "string" };
118
+ if (flags & ts2__namespace.TypeFlags.Number) return { type: "number" };
119
+ if (flags & ts2__namespace.TypeFlags.Boolean) return { type: "boolean" };
120
+ if (flags & ts2__namespace.TypeFlags.BooleanLiteral) return { type: "boolean" };
121
+ if (flags & ts2__namespace.TypeFlags.Null) return { type: "null" };
122
+ if (flags & ts2__namespace.TypeFlags.Undefined || flags & ts2__namespace.TypeFlags.Void) return {};
123
+ if (flags & ts2__namespace.TypeFlags.Any || flags & ts2__namespace.TypeFlags.Unknown) {
124
+ onWarn?.(`Unsupported type: any/unknown, using empty schema`);
125
+ return {};
126
+ }
127
+ if (type.isUnion?.()) {
128
+ const union = type;
129
+ const types = union.types;
130
+ const withoutUndef = types.filter(
131
+ (t) => !(t.flags & ts2__namespace.TypeFlags.Undefined) && !(t.flags & ts2__namespace.TypeFlags.Void)
132
+ );
133
+ if (withoutUndef.length === 1) return typeToJsonSchema(withoutUndef[0], typeChecker, onWarn);
134
+ if (withoutUndef.length === 0) return {};
135
+ const stringEnumValues = [];
136
+ let allStringLiterals = true;
137
+ for (const t of withoutUndef) {
138
+ if (t.flags & ts2__namespace.TypeFlags.StringLiteral) {
139
+ const lit = t;
140
+ if (typeof lit.value === "string") stringEnumValues.push(lit.value);
141
+ } else {
142
+ allStringLiterals = false;
143
+ break;
144
+ }
145
+ }
146
+ if (allStringLiterals && stringEnumValues.length > 0) {
147
+ return { type: "string", enum: [...new Set(stringEnumValues)] };
148
+ }
149
+ let allBooleanLiterals = true;
150
+ for (const t of withoutUndef) {
151
+ if (!(t.flags & ts2__namespace.TypeFlags.BooleanLiteral)) {
152
+ allBooleanLiterals = false;
153
+ break;
154
+ }
155
+ }
156
+ if (allBooleanLiterals) return { type: "boolean" };
157
+ }
158
+ if (flags & ts2__namespace.TypeFlags.StringLiteral) {
159
+ const lit = type;
160
+ if (typeof lit.value === "string") {
161
+ return { type: "string", enum: [lit.value] };
162
+ }
163
+ return { type: "string" };
164
+ }
165
+ if (typeChecker.isArrayType(type)) {
166
+ const typeRef = type;
167
+ const typeArgs = typeRef.typeArguments;
168
+ const itemType = typeArgs?.[0];
169
+ const items = itemType ? typeToJsonSchema(itemType, typeChecker, onWarn) : {};
170
+ return { type: "array", items: Object.keys(items).length ? items : {} };
171
+ }
172
+ const str = typeChecker.typeToString(type);
173
+ if (str === "string") return { type: "string" };
174
+ if (str === "number") return { type: "number" };
175
+ if (str === "boolean") return { type: "boolean" };
176
+ if (str.endsWith("[]")) {
177
+ const inner = str.slice(0, -2).trim();
178
+ const itemType = inner === "string" ? { type: "string" } : inner === "number" ? { type: "number" } : {};
179
+ return { type: "array", items: itemType };
180
+ }
181
+ if (type.getProperties && type.getProperties().length >= 0) {
182
+ const props = type.getProperties();
183
+ const properties = {};
184
+ const required = [];
185
+ for (const p of props) {
186
+ const decl = p.valueDeclaration;
187
+ const propType = decl ? typeChecker.getTypeAtLocation(decl) : typeChecker.getTypeOfSymbolAtLocation(p, p.valueDeclaration);
188
+ const optional = decl && ts2__namespace.isPropertySignature(decl) ? !!decl.questionToken : false;
189
+ properties[p.name] = typeToJsonSchema(propType, typeChecker, onWarn);
190
+ if (!optional) required.push(p.name);
191
+ }
192
+ return { type: "object", properties, ...required.length ? { required } : {} };
193
+ }
194
+ onWarn?.(`Unsupported type: ${str}, using object`);
195
+ return { type: "object" };
196
+ }
197
+
198
+ // src/tools/function/types.ts
199
+ var FUNCTION_KIND = "function";
200
+
201
+ // src/tools/skill/types.ts
202
+ var SKILL_KIND = "skill";
203
+ var SKILL_DIR_NAME = "skill";
204
+
205
+ // src/tools/n8n/types.ts
206
+ var N8N_KIND = "n8n";
207
+
208
+ // src/tools/mcp/mcpSpecToToolSpec.ts
209
+ var DEFAULT_OUTPUT = { type: "object", additionalProperties: true };
210
+ function mcpSpecToToolSpec(spec, projectPath) {
211
+ const base = {
212
+ name: spec.name,
213
+ version: "1.0.0",
214
+ kind: spec.kind,
215
+ description: spec.description,
216
+ inputSchema: spec.inputSchema ?? DEFAULT_OUTPUT,
217
+ outputSchema: "outputSchema" in spec && spec.outputSchema ? spec.outputSchema : chunkQEJF3KDV_cjs.DEFAULT_OUTPUT_SCHEMA,
218
+ capabilities: [],
219
+ _meta: spec._meta,
220
+ ...spec.kind === N8N_KIND && "webhookUrl" in spec && spec.webhookUrl ? { endpoint: spec.webhookUrl } : {}
221
+ };
222
+ if (spec.kind === FUNCTION_KIND && "sourcePath" in spec && "exportName" in spec) {
223
+ base._meta = {
224
+ ...base._meta,
225
+ sourcePath: spec.sourcePath,
226
+ exportName: spec.exportName,
227
+ ...projectPath && { projectPath }
228
+ };
229
+ }
230
+ if (spec.kind === SKILL_KIND && "sourcePath" in spec && projectPath) {
231
+ base._meta = { ...base._meta, sourcePath: spec.sourcePath, projectPath };
232
+ }
233
+ if (spec.kind === N8N_KIND && "sourcePath" in spec && projectPath) {
234
+ base._meta = { ...base._meta, sourcePath: spec.sourcePath, projectPath };
235
+ }
236
+ return base;
237
+ }
238
+
239
+ // src/tools/function/scanner.ts
240
+ var TOOL_TAG = "@tool";
241
+ var EFFECT_VALUES = ["none", "local_write", "external_write", "destructive"];
242
+ function scanForTools(options) {
243
+ const projectPath = path__namespace.resolve(options.projectPath);
244
+ const tsconfigPath = options.tsconfigPath ?? path__namespace.join(projectPath, "tsconfig.json");
245
+ const include = options.include ?? ["**/*.ts"];
246
+ const errors = [];
247
+ const warnings = [];
248
+ let config;
249
+ let configPathResolved = path__namespace.resolve(projectPath, tsconfigPath);
250
+ if (!fs__namespace.existsSync(configPathResolved)) {
251
+ configPathResolved = path__namespace.join(projectPath, "tsconfig.json");
252
+ }
253
+ if (fs__namespace.existsSync(configPathResolved)) {
254
+ const configFile = ts2__namespace.readConfigFile(configPathResolved, ts2__namespace.sys.readFile);
255
+ if (configFile.error) {
256
+ errors.push({ file: configPathResolved, message: String(configFile.error.messageText) });
257
+ return { specs: [], errors, warnings };
258
+ }
259
+ const parsed = ts2__namespace.parseJsonConfigFileContent(
260
+ configFile.config,
261
+ ts2__namespace.sys,
262
+ path__namespace.dirname(configPathResolved)
263
+ );
264
+ if (parsed.errors.length) {
265
+ for (const e of parsed.errors) {
266
+ errors.push({ file: e.file?.fileName ?? "tsconfig", message: String(e.messageText) });
267
+ }
268
+ return { specs: [], errors, warnings };
269
+ }
270
+ config = parsed;
271
+ } else {
272
+ config = {
273
+ options: {
274
+ target: ts2__namespace.ScriptTarget.ES2022,
275
+ module: ts2__namespace.ModuleKind.ESNext,
276
+ moduleResolution: ts2__namespace.ModuleResolutionKind.NodeNext,
277
+ strict: true,
278
+ skipLibCheck: true,
279
+ noEmit: true
280
+ },
281
+ fileNames: resolveGlob(projectPath, include),
282
+ errors: []
283
+ };
284
+ }
285
+ const program = ts2__namespace.createProgram(config.fileNames, config.options);
286
+ const typeChecker = program.getTypeChecker();
287
+ const specs = [];
288
+ for (const sourceFile of program.getSourceFiles()) {
289
+ const fileName = sourceFile.fileName;
290
+ if (fileName.includes("node_modules") || fileName.endsWith(".d.ts")) continue;
291
+ if (!config.fileNames.some((f) => path__namespace.resolve(f) === path__namespace.resolve(fileName))) continue;
292
+ ts2__namespace.forEachChild(sourceFile, (node) => {
293
+ const decl = getExportedFunctionDeclaration(node);
294
+ if (!decl) return;
295
+ const func = decl.func;
296
+ const name = decl.name;
297
+ if (!name) return;
298
+ const host = getJSDocHost(func);
299
+ if (!hasToolTag(host)) return;
300
+ const jsDoc = getJSDocComments(host);
301
+ const description = getDescription(jsDoc);
302
+ if (!description) {
303
+ warnings.push({ file: fileName, message: `Tool ${name}: missing description, using humanized name` });
304
+ }
305
+ const sideEffect = getEffect(host);
306
+ const onWarn = (msg) => warnings.push({ file: fileName, message: `${name}: ${msg}` });
307
+ const { schema } = buildInputSchemaFromParams(func, typeChecker, onWarn);
308
+ const inputSchema = Object.keys(schema.properties ?? {}).length > 0 ? schema : { type: "object", properties: {} };
309
+ const outputSchema = buildOutputSchemaFromReturnType(func, typeChecker, onWarn);
310
+ const sourcePath = path__namespace.relative(projectPath, fileName) || path__namespace.basename(fileName);
311
+ const toolName = pathToToolName(sourcePath, name);
312
+ specs.push({
313
+ kind: FUNCTION_KIND,
314
+ name: toolName,
315
+ description: description || humanize(name),
316
+ inputSchema,
317
+ outputSchema,
318
+ _meta: { hitl: { sideEffect } },
319
+ sourcePath,
320
+ exportName: name
321
+ });
322
+ });
323
+ }
324
+ return { specs, errors, warnings };
325
+ }
326
+ function resolveGlob(projectPath, patterns) {
327
+ const result = [];
328
+ const seen = /* @__PURE__ */ new Set();
329
+ const add = (f) => {
330
+ const abs = path__namespace.resolve(f);
331
+ if (f.endsWith(".ts") && !f.endsWith(".d.ts") && !seen.has(abs)) {
332
+ seen.add(abs);
333
+ result.push(abs);
334
+ }
335
+ };
336
+ for (const p of patterns) {
337
+ const full = path__namespace.join(projectPath, p);
338
+ if (full.includes("*")) {
339
+ const baseDir = full.replace(/\*\*\/.*$/, "").replace(/\*.*$/, "").replace(/\/?$/, "") || ".";
340
+ const dir = path__namespace.resolve(projectPath, baseDir);
341
+ if (fs__namespace.existsSync(dir)) walk(dir, add);
342
+ } else {
343
+ const resolved = path__namespace.resolve(projectPath, full);
344
+ if (fs__namespace.existsSync(resolved)) {
345
+ if (fs__namespace.statSync(resolved).isFile()) add(resolved);
346
+ else walk(resolved, add);
347
+ }
348
+ }
349
+ }
350
+ if (result.length > 0) return result;
351
+ const srcDir = path__namespace.join(projectPath, "src");
352
+ if (fs__namespace.existsSync(srcDir)) return walkCollect(srcDir);
353
+ return [];
354
+ }
355
+ function walkCollect(dir) {
356
+ const out = [];
357
+ walk(dir, (fullPath) => {
358
+ if (fullPath.endsWith(".ts") && !fullPath.endsWith(".d.ts")) out.push(path__namespace.resolve(fullPath));
359
+ });
360
+ return out;
361
+ }
362
+ var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", "generated", "dist"]);
363
+ function walk(dir, visit) {
364
+ try {
365
+ const entries = fs__namespace.readdirSync(dir, { withFileTypes: true });
366
+ for (const e of entries) {
367
+ const full = path__namespace.join(dir, e.name);
368
+ if (e.isDirectory() && !SKIP_DIRS.has(e.name)) walk(full, visit);
369
+ else if (e.isFile()) visit(full);
370
+ }
371
+ } catch {
372
+ }
373
+ }
374
+ function getExportedFunctionDeclaration(node, _sourceFile) {
375
+ if (ts2__namespace.isFunctionDeclaration(node) && node.name) {
376
+ const exported = (ts2__namespace.getModifiers(node) ?? []).some((m) => m.kind === ts2__namespace.SyntaxKind.ExportKeyword);
377
+ if (exported) return { func: node, name: node.name.getText() };
378
+ return null;
379
+ }
380
+ if (ts2__namespace.isVariableStatement(node)) {
381
+ const exported = (ts2__namespace.getModifiers(node) ?? []).some((m) => m.kind === ts2__namespace.SyntaxKind.ExportKeyword);
382
+ if (!exported) return null;
383
+ for (const decl of node.declarationList.declarations) {
384
+ let init = decl.initializer;
385
+ while (init && (ts2__namespace.isParenthesizedExpression(init) || ts2__namespace.isAsExpression(init)))
386
+ init = init.expression;
387
+ if (init && ts2__namespace.isArrowFunction(init)) {
388
+ const name = decl.name.getText();
389
+ return { func: init, name };
390
+ }
391
+ if (init && ts2__namespace.isFunctionExpression(init)) {
392
+ const name = decl.name.getText();
393
+ return { func: init, name };
394
+ }
395
+ }
396
+ }
397
+ return null;
398
+ }
399
+ function getJSDocHost(node) {
400
+ const parent = node.parent;
401
+ if (ts2__namespace.isVariableDeclaration(parent)) {
402
+ const gp = parent.parent;
403
+ if (ts2__namespace.isVariableDeclarationList(gp) && gp.parent && ts2__namespace.isVariableStatement(gp.parent)) return gp.parent;
404
+ }
405
+ return node;
406
+ }
407
+ function getJSDocComments(host) {
408
+ const all = ts2__namespace.getJSDocCommentsAndTags(host);
409
+ return all.filter((t) => ts2__namespace.isJSDoc(t));
410
+ }
411
+ function hasToolTag(host) {
412
+ const tags = ts2__namespace.getJSDocTags(host);
413
+ for (const tag of tags) {
414
+ const name = tag.tagName?.getText() ?? "";
415
+ if (name === "tool") return true;
416
+ }
417
+ const all = ts2__namespace.getJSDocCommentsAndTags(host);
418
+ for (const t of all) {
419
+ if (ts2__namespace.isJSDoc(t)) {
420
+ const full = t.getFullText();
421
+ if (full.includes(TOOL_TAG)) return true;
422
+ }
423
+ }
424
+ return false;
425
+ }
426
+ function getDescription(jsDocs, fallbackName) {
427
+ for (const doc of jsDocs) {
428
+ const comment = doc.comment;
429
+ if (typeof comment === "string") {
430
+ const first = comment.split(/\n/)[0]?.trim() ?? "";
431
+ if (first && !first.startsWith("@")) return first;
432
+ }
433
+ if (Array.isArray(comment)) {
434
+ const first = comment[0];
435
+ if (first && typeof first === "object" && "text" in first) {
436
+ const t = first.text.trim();
437
+ if (t && !t.startsWith("@")) return t;
438
+ }
439
+ }
440
+ const full = doc.getFullText();
441
+ const match = full.match(/\*\s*@tool\s+(.+?)(?=\n|$|\*\/)/s);
442
+ if (match?.[1]) return match[1].trim();
443
+ }
444
+ return "";
445
+ }
446
+ function getEffect(host) {
447
+ const tags = ts2__namespace.getJSDocTags(host);
448
+ for (const tag of tags) {
449
+ const name = tag.tagName?.getText() ?? "";
450
+ if (name === "effect") {
451
+ const comment = tag.comment;
452
+ const v = (typeof comment === "string" ? comment : "").trim().toLowerCase();
453
+ if (EFFECT_VALUES.includes(v)) return v;
454
+ }
455
+ }
456
+ const all = ts2__namespace.getJSDocCommentsAndTags(host);
457
+ for (const t of all) {
458
+ if (ts2__namespace.isJSDoc(t)) {
459
+ const full = t.getFullText();
460
+ const match = full.match(/\*\s*@effect\s+(\w+)/);
461
+ if (match && EFFECT_VALUES.includes(match[1])) return match[1];
462
+ }
463
+ }
464
+ return "none";
465
+ }
466
+ function humanize(name) {
467
+ return name.replace(/([A-Z])/g, " $1").replace(/^./, (s) => s.toUpperCase()).trim();
468
+ }
469
+ function scan(projectPath, options = {}) {
470
+ const root = path__namespace.resolve(projectPath);
471
+ const result = scanForTools({
472
+ projectPath: root,
473
+ include: options.include ?? ["**/*.ts"],
474
+ tsconfigPath: options.tsconfigPath
475
+ });
476
+ const specs = result.specs.map((s) => mcpSpecToToolSpec(s, root));
477
+ return Promise.resolve({
478
+ specs,
479
+ errors: result.errors,
480
+ warnings: result.warnings
481
+ });
482
+ }
483
+
484
+ exports.FUNCTION_KIND = FUNCTION_KIND;
485
+ exports.N8N_KIND = N8N_KIND;
486
+ exports.SKILL_DIR_NAME = SKILL_DIR_NAME;
487
+ exports.SKILL_KIND = SKILL_KIND;
488
+ exports.findDirsContainingFile = findDirsContainingFile;
489
+ exports.mcpSpecToToolSpec = mcpSpecToToolSpec;
490
+ exports.pathToToolName = pathToToolName;
491
+ exports.scan = scan;
492
+ exports.scanForTools = scanForTools;
493
+ //# sourceMappingURL=chunk-JNIWNSCQ.cjs.map
494
+ //# sourceMappingURL=chunk-JNIWNSCQ.cjs.map