Back to MCP directory
publicPublicdnsLocal runtime

lara-translate

Lara Translate MCP Server是一个基于模型上下文协议(MCP)的翻译服务中间件,为AI应用提供与Lara Translate API的桥梁连接。

article

README

🚀 Lara Translate 翻译服务器指南(中文版)

Lara Translate 是一款功能强大的翻译工具,支持通过 MCP(机器控制协议)接口进行集成。本指南将为您详细介绍如何安装和配置 Lara Translate 翻译服务器。

🚀 快速开始

您可根据自身需求,选择合适的安装方式来配置 Lara Translate 翻译服务器。

📦 安装指南

方法一:使用 Docker 容器安装

步骤:

  1. 打开终端并运行以下命令拉取预构建的 Docker 镜像:
docker pull translatednet/lara-mcp
  1. 将镜像添加到您的 MCP 配置文件中。以下是示例配置:
{
    "mcpServers": {
        "lara-translate": {
            "command": "docker",
            "args": [
                "run",
                "-i",
                "--rm",
                "-e",
                "LARA_ACCESS_KEY_ID",
                "-e",
                "LARA_ACCESS_KEY_SECRET",
                "translatednet/lara-mcp"
            ],
            "env": {
                "LARA_ACCESS_KEY_ID": "<YOUR_API_KEY>",
                "LARA_ACCESS_KEY_SECRET": "<YOUR_API_SECRET>"
            }
        }
    }
}

请将 <YOUR_API_KEY><YOUR_API_SECRET> 替换为您从 Lara Translate 获取的实际密钥。

方法二:使用 npm 包安装

  1. 在终端中运行以下命令安装 npm 包:
npm install @translated/lara-mcp
  1. 将以下内容添加到您的 MCP 配置文件中:
{
    "mcpServers": {
        "lara-translate": {
            "command": "node",
            "args": ["node_modules/@translated/lara-mcp/dist/index.js"],
            "env": {
                "LARA_ACCESS_KEY_ID": "<YOUR_API_KEY>",
                "LARA_ACCESS_KEY_SECRET": "<YOUR_API_SECRET>"
            }
        }
    }
}

方法三:从源代码构建(适合开发)

使用 Node.js 构建

  1. 克隆仓库:
git clone https://github.com/translated/lara-mcp.git
cd lara-mcp
  1. 安装依赖并构建项目:
pnpm install
pnpm run build
  1. 将以下内容添加到您的 MCP 配置文件中:
{
    "mcpServers": {
        "lara-translate": {
            "command": "node",
            "args": ["<项目绝对路径>/dist/index.js"],
            "env": {
                "LARA_ACCESS_KEY_ID": "<YOUR_API_KEY>",
                "LARA_ACCESS_KEY_SECRET": "<YOUR_API_SECRET>"
            }
        }
    }
}

请将 <项目绝对路径> 替换为您的项目实际路径。

构建 Docker 镜像

  1. 克隆仓库并构建镜像:
git clone https://github.com/translated/lara-mcp.git
cd lara-mcp
docker build -t lara-mcp .
  1. 将以下内容添加到您的 MCP 配置文件中:
{
    "mcpServers": {
        "lara-translate": {
            "command": "docker",
            "args": [
                "run",
                "-i",
                "--rm",
                "-e",
                "LARA_ACCESS_KEY_ID",
                "-e",
                "LARA_ACCESS_KEY_SECRET",
                "lara-mcp"
            ],
            "env": {
                "LARA_ACCESS_KEY_ID": "<YOUR_API_KEY>",
                "LARA_ACCESS_KEY_SECRET": "<YOUR_API_SECRET>"
            }
        }
    }
}

配置文件位置

根据您使用的操作系统,配置文件的位置如下:

  • Windows%APPDATA%\lara-mcp\config.json
  • MacOS~/Library/Application Support/lara-mcp/config.json
  • Linux$HOME/.config/lara-mcp/config.json

💻 使用示例

基础用法

示例 1:基本翻译

请求:

{
    "text": "Hello, World!",
    "source_lang": "en",
    "target_lang": "zh"
}

响应:

{
    "translated_text": "你好,世界!",
    "status": "success"
}

示例 2:批量翻译

请求:

[
    {"text": "Hello", "source_lang": "en", "target_lang": "zh"},
    {"text": "Goodbye", "source_lang": "en", "target_lang": "zh"}
]

响应:

[
    {"translated_text": "你好", "status": "success"},
    {"translated_text": "再见", "status": "success"}
]

🔍 验证安装

  1. 启动您的 MCP 服务。
  2. 发送以下测试请求以验证连接是否成功:
curl -X POST http://localhost:端口号/api/v1/translate \
    -H "Content-Type: application/json" \
    -d '{"text":"Hello, World!","source_lang":"en","target_lang":"zh"}'

如果返回正常结果,则表示安装成功。

⚠️ 注意事项

⚠️ 重要提示

请确保您的 API 密钥和密秘保持安全,避免泄露。

💡 使用建议

请根据实际需求调整服务器配置和性能参数。

如有任何问题,请访问 Lara Translate 官方文档 或联系技术支持。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client