MCP Server

How to make LibreTranslate available to AI agents.

LibreTranslate can give machine translation capabilities to AI agents that support the MCP protocol.

Configuration

Add this to your client’s configuration:

OpenCode

{
  "mcp": {
    "LibreTranslate": {
      "type": "local",
      "command": ["npx", "-y", "@libretranslate/mcp"],
      "environment": {
        "LIBRETRANSLATE_API_URL": "https://libretranslate.com",
        "LIBRETRANSLATE_API_KEY": "your-api-key"
      }
    }
  }
}

Claude

{
  "mcpServers": {
    "libretranslate": {
      "command": "npx",
      "args": ["-y", "@libretranslate/mcp"],
      "env": {
        "LIBRETRANSLATE_API_URL": "https://libretranslate.com",
        "LIBRETRANSLATE_API_KEY": "your-api-key"
      }
    }
  }
}
VariableDescription
LIBRETRANSLATE_API_URLURL of the LibreTranslate API (default: https://libretranslate.com)
LIBRETRANSLATE_API_KEYAPI key for the LibreTranslate service (required for libretranslate.com)

Available Tools

detect

Detect the language of a given text.

translate

Translate text from one language to another.

languages

List all supported languages for translation.

See LibreTranslate-MCP for implementation details.

Tools and HTTP endpoints

MCPArgumentsHTTP request
detecttextPOST /detect
translatetext, source, targetPOST /translate
languagesNoneGET /languages

The translate tool requests three alternatives. The tools return JSON as text in an MCP content block; failed requests carry isError: true.

Where translation runs

The MCP process runs on your machine. Translation happens on the LibreTranslate instance named by LIBRETRANSLATE_API_URL. To use your own instance, set this to its address; see the self-hosting guide.