UNPKG

@kya-os/mcp-i

Version:

The TypeScript MCP framework with identity features built-in

38 lines (37 loc) 1.8 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.getEntries = getEntries; const path_1 = __importDefault(require("path")); /** Get what packages are gonna be built by xmcp */ function getEntries(xmcpConfig) { const entries = {}; // Resolve to the mcp-i package root (works for both workspace and published packages) const mcpiPackageRoot = path_1.default.resolve(__dirname, "../../.."); // Check if source files exist (workspace/development) or use dist files (published package) const fs = require("fs"); const srcRuntimePath = path_1.default.join(mcpiPackageRoot, "src/runtime"); const distRuntimePath = path_1.default.join(mcpiPackageRoot, "dist/runtime"); const useSourceFiles = fs.existsSync(srcRuntimePath); const runtimePath = useSourceFiles ? srcRuntimePath : distRuntimePath; const fileExt = useSourceFiles ? ".ts" : ".js"; if (xmcpConfig.stdio) { entries.stdio = path_1.default.join(runtimePath, `transports/stdio/index${fileExt}`); } if (xmcpConfig["http"]) { // non adapter mode if (!xmcpConfig.experimental?.adapter) { entries["http"] = path_1.default.join(runtimePath, `transports/http/index${fileExt}`); } // adapter mode enabled if (xmcpConfig.experimental?.adapter === "express") { entries["adapter"] = path_1.default.join(runtimePath, `adapters/express/index${fileExt}`); } if (xmcpConfig.experimental?.adapter === "nextjs") { entries["adapter"] = path_1.default.join(runtimePath, `adapters/nextjs/index${fileExt}`); } } return entries; }