UNPKG

@modelfetch/node

Version:

Node.js runtime adapter for MCP servers built with ModelFetch

23 lines 857 B
import { serve } from "@hono/node-server"; import { createApp } from "@modelfetch/core"; export function getListeningAddress(addressInfo) { let hostname = addressInfo.address; if (addressInfo.family === "IPv6") { hostname = addressInfo.address === "::" || addressInfo.address === "::1" ? "localhost" : `[${addressInfo.address}]`; } if (addressInfo.family === "IPv4") { hostname = addressInfo.address === "0.0.0.0" || addressInfo.address === "127.0.0.1" ? "localhost" : addressInfo.address; } return `http://${hostname}:${addressInfo.port}`; } export default function handle(arg, callback, options) { const app = createApp(arg); return serve({ ...options, fetch: app.fetch }, callback); } //# sourceMappingURL=index.js.map