Paraglide Messages Mcp

io.github.whazeted由 GitHub 帳號 whazeted 發布v0.3.0更新於 Oct 24, 2026

Validated, sub-agent per-locale translation of Paraglide JS / inlang message-format projects.

已驗證STDIO僅桌面開發者工具AI 與機器學習

概覽

AI 產生的概覽

一個本機 MCP 伺服器,透過 OpenAI Batch API 翻譯 Paraglide JS / inlang 訊息目錄,並將驗證後的譯文依語言合併回專案檔案。

可以做什麼
檢查 Paraglide/inlang 專案:語言清單、來源語言、訊息數量與啟動時的風格說明,並依前綴與狀態分頁列出、讀取或搜尋訊息鍵與內容。提交可持久化的 OpenAI Batch 翻譯工作,可依目標語言與鍵前綴限定範圍,也可重新整理既有譯文,並在重新啟動後追蹤、列出或取消工作。收集已完成批次:封存輸出、逐筆驗證譯文並把通過的譯文合併進語言檔,回報已儲存、失敗與衝突數量。對既有鍵儲存經過驗證的人工修正。
適用情境
適用於 Paraglide JS 或 inlang 專案需要把訊息目錄翻譯成多種語言,並希望透過 OpenAI Batch 非同步完成、而不是在即時代理迴圈中翻譯的情況。適合需要依語言驗證、衝突回報與可續跑工作的團隊。
執行需求
透過 npx 以 stdio 在本機執行,需要 Node.js 22.12 以上版本。翻譯需要可存取所設定 Batch 模型的 OpenAI API 金鑰,透過環境變數 OPENAI_API_KEY 提供。專案路徑可用 --project 指定,或從 .inlang 目錄自動探索。檢查專案與儲存人工修正不需要金鑰。
安裝前請注意
翻譯會把訊息文字、既有目標語言文案與風格說明傳送給 OpenAI,並產生付費的 Batch 用量;送出結果不確定時不會自動重試,以避免重複的付費批次。project.inlang 下的工作目錄包含訊息文字與封存的模型輸出,應排除於版本控制之外。收集過程會寫入並合併語言檔,取消工作最長可能需要 10 分鐘。請勿把 API 金鑰寫進提交的設定。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Paraglide Messages Mcp,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

paraglide-messages-mcp

Stateless MCP service for translating Paraglide JS / inlang message files through the OpenAI Batch API.

OpenAI does the translation asynchronously. The MCP client submits a job and later collects it; the client and server can disconnect or restart while OpenAI works. Each request includes flat message keys as usage context, source text, existing target text, placeholders, a style brief, and a small sample of existing target copy. The default is gpt-6-luna with reasoning.effort: "low" (“Luna light”).

Requires Node.js 22.12+ and an OpenAI API key with access to the configured Batch model. Inspecting projects and saving manual corrections work without a key.

Connect

json
{  "mcpServers": {    "paraglide": {      "command": "npx",      "args": [        "-y", "paraglide-messages-mcp",        "--project", "./project.inlang",        "--translation-style", "Concise product UI; informal address; preserve brand terms."      ],      "env": { "OPENAI_API_KEY": "<your API key>" }    }  }}

Use your client's secret/environment configuration to supply the key; don't commit credentials. --project is optional when there is a discoverable .inlang directory. --model <id> overrides the default. --jobs-dir <path> overrides the local job directory.

Translate

  1. Call project_info to inspect locales and missing counts.

  2. Call start_translation_job with a stable jobId, for example:

    json
    { "jobId": "checkout-fr-2026-10-07", "targetLocales": ["fr"], "prefix": "checkout_" }

    Omit targetLocales for every locale except the source. The source defaults to the project base locale. Omit prefix for the whole catalog. Use mode: "all" to refresh existing translations. A per-job translationStyle overrides the startup brief.

  3. Keep the returned ID and periodically call get_translation_job. Batch jobs have a 24-hour completion window; a tool call checks once instead of holding a connection open. Reuse the same ID after errors. list_translation_jobs discovers jobs after a restart without calling OpenAI.

  4. On a terminal batch, collection archives output/error files, validates individual translations, and merges accepted values into the locale files. Check saved, failed, lastError, and cleanedUp; a remote completed status alone does not mean everything was saved. Failure details are capped at 50 in tool responses; the job record contains every outcome. Failed or conflicted messages can be corrected with save_translations or translated in a new scoped job.

An empty scope finishes locally without an API request. A reused ID with different options is rejected. Use a new ID for new work; retrying an existing ID resumes its original snapshot.

Durability and cleanup

Job snapshots and IDs are atomically persisted in project.inlang/.paraglide-batches/. Keep this directory on persistent storage and exclude it from source control: it contains message text and archived model outputs. API keys are never stored in job records. Locks serialize job reconciliation and catalog writes across processes on the same host. Source or target edits made during the batch are preserved and reported as conflicts. Per-locale merges can be replayed after an interrupted collection.

Lost batch creation responses are reconciled through OpenAI batch metadata and the input file ID. An uncertain submission is never automatically repeated, which avoids duplicate paid batches. If reconciliation finds no matching batch, the job stays pending and reports lastError; inspect it in OpenAI before deciding to submit replacement work. OpenAI validates model availability asynchronously; unsupported models are reported through batch errors.

There is no “close completed batch” operation. Once results are safely archived and applied, the service deletes the remote input, output, and error files. Cleanup failures remain resumable. Both uploaded and generated files have a 30-day expiration as a fallback; collect before they expire. cancel_translation_job records cancellation before sending it to OpenAI. Cancellation can take up to 10 minutes; keep collecting until terminal and cleanedUp: true. Successful partial results from cancelled or expired batches are validated and applied too.

For unattended collection, run this command periodically through your own scheduler:

sh
npx paraglide-messages-mcp --project ./project.inlang --resume

It reconciles every unfinished local job once, prints JSON summaries, and exits. No timers or workers remain attached to MCP sessions. It returns a nonzero exit code for collection errors or rejected translations.

Tools

ToolPurpose
project_infoLocales, source, counts and startup style brief
list_message_keysFlat keys filtered by prefix/status; cursor pagination
get_messagesMessage values by key or prefix
search_messagesSearch text and key substrings
save_translationsValidated corrections to existing keys
start_translation_jobSubmit a durable OpenAI Batch job
get_translation_jobReconcile, collect and clean up a job
list_translation_jobsLocal job summaries, cursor pagination
cancel_translation_jobRequest cancellation, retaining partial results

The old agent translation loops, workflow prompts, duplicate resources and destructive catalog/locale management tools have been removed from the MCP surface. Existing TranslationService library helpers remain available for callers that need them. MCP saves no longer expose validation bypasses or arbitrary new-key creation.

Stateless HTTP

The CLI uses SDK v2 serveStdio; the library also exports a web-standard HTTP handler:

ts
import { createHandler } from "paraglide-messages-mcp";const handler = createHandler("/workspace/project.inlang", { translationStyle: "Concise UI" });// Mount handler.fetch(Request) on your HTTP runtime; call handler.close() at shutdown.

The handler creates a fresh MCP server for each request and supports the 2026-07-28 protocol without initialization or session IDs. Legacy clients are served statelessly through SDK compatibility. Deployments must mount authentication and Host/Origin checks ahead of fetch as described in the SDK HTTP guide. The filesystem store supports one host, or a persistent single-writer deployment; multi-host replicas need a shared transactional job/catalog store and distributed locking.

See COMPATIBILITY.md for supported message formats and DEVELOPMENT.md for architecture and tests. The optional agent skill teaches the batch workflow.

License

MIT

來源:README.md,提交 6586963

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.3.0最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分