@kya-os/mcp-i
Version:
The TypeScript MCP framework with identity features built-in
25 lines (23 loc) • 780 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateImportCode = generateImportCode;
const compiler_context_1 = require("./compiler-context");
function generateImportCode() {
const { toolPaths, hasMiddleware } = compiler_context_1.compilerContext.getContext();
const importToolsCode = Array.from(toolPaths)
.map((p) => {
const path = p.replace(/\\/g, "/");
const relativePath = `../${path}`;
return `"${path}": () => import("${relativePath}"),`;
})
.join("\n");
const importMiddlewareCode = hasMiddleware
? `export const middleware = () => import("../src/middleware.ts");`
: "";
return `
export const tools = {
${importToolsCode}
};
${importMiddlewareCode}
`;
}