#!/usr/bin/env node import { createServer } from 'http'; /** * MotiBlog MCP server — standalone streamable HTTP entrypoint. * * This is the local/self-hosted way to serve remote agents. In production the * same handler is mounted inside the API process instead, so the endpoint is * `POST api.motiblog.ai/mcp` with no extra service and no extra proxy rule — * see apps/api/src/mcp/mcp.middleware.ts. * * Stateless: every request authenticates with its own per-project API key and * gets a fresh server + transport (no session affinity needed). * * Env: * MOTIBLOG_API_URL — API base for tool calls (default http://localhost:3001) * MOTIBLOG_HTTP_PORT — listen port (default 3021) * MOTIBLOG_HTTP_HOST — bind host (default 127.0.0.1; use 0.0.0.0 behind a proxy) * MOTIBLOG_PROJECT_ID — optional default project * * Auth: `x-api-key: ` or `Authorization: Bearer ` on every request. */ interface HttpServerOptions { port: number; host: string; apiBaseUrl: string; defaultProjectId?: string; } declare function startHttpServer(opts: HttpServerOptions): ReturnType; export { type HttpServerOptions, startHttpServer };