@acwink/movies-search-mcp
Version:
Smart MCP tool to find and validate movie/tv-show resources with multiple sources support
57 lines (55 loc) • 2.23 kB
JavaScript
;
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
// src/cli.ts
var import_child_process = require("child_process");
var import_path = __toESM(require("path"));
var args = process.argv.slice(2);
var isSSEMode = args.includes("--sse") || args.includes("-s");
var targetFile = isSSEMode ? "mcp-server-sse.js" : "mcp-server.js";
var targetPath = import_path.default.join(__dirname, targetFile);
var filteredArgs = args.filter((arg) => arg !== "--sse" && arg !== "-s");
if (isSSEMode) {
console.error(`\u{1F3AC} \u542F\u52A8\u7535\u5F71\u641C\u7D22\u5DE5\u5177 MCP Server (SSE \u6A21\u5F0F)`);
}
var child = (0, import_child_process.spawn)("node", [targetPath, ...filteredArgs], {
stdio: "inherit",
env: process.env
});
process.on("SIGINT", () => {
child.kill("SIGINT");
});
process.on("SIGTERM", () => {
child.kill("SIGTERM");
});
child.on("exit", (code) => {
process.exit(code || 0);
});
child.on("error", (error) => {
if (isSSEMode) {
console.error("\u542F\u52A8\u670D\u52A1\u5668\u5931\u8D25:", error);
}
process.exit(1);
});
//# sourceMappingURL=cli.js.map