Skip to main content

Function: startLibreTranslateMcpServer()

startLibreTranslateMcpServer(options): Promise<RunningLibreTranslateMcpServer>

Defined in: src/mcp/server.ts:106

Build the LibreTranslate MCP server and serve it over Streamable HTTP at http://127.0.0.1:<port>/mcp.

Stateless: every POST gets a fresh server and transport, so there is no session to leak or expire; the SDK client is shared across them. Requests whose Host is not loopback are refused (DNS rebinding), GET /health answers { ok, baseUrl, apiKey, version } and, with a shutdownToken, POST /shutdown stops it. Resolves once the port is bound; rejects if it cannot be (e.g. in use).

import { startLibreTranslateMcpServer } from "@hoyasumii/libretranslate/mcp";
const mcp = await startLibreTranslateMcpServer({ port: 3768, baseUrl: "http://localhost:5000" });
// claude mcp add --transport http libretranslate http://127.0.0.1:3768/mcp

Parameters​

options​

LibreTranslateMcpServerOptions

Returns​

Promise<RunningLibreTranslateMcpServer>