MCP + Codex guide

Translate documents in Codex with the LingoBridge MCP server

Install one local MCP bridge, connect your API key, and let Codex check credits, create PDF or Office translation tasks, poll progress, and return short-lived result links. Every capability on this page matches the current production MCP server.

MCP endpoint
https://www.fanyipaiban.com/translate/mcp
Recommended setup
Local stdio bridge
Runtime
Node.js 18+
Formats
PDF, DOCX, PPTX, XLSX
Live tools
4 production tools
Verified
Workflow

Codex coordinates the task; LingoBridge processes the document

The local bridge reads JSON-RPC messages from Codex, adds your Bearer API key, and forwards them to the production MCP endpoint. Translation remains asynchronous: create a task, save task_id, then poll until SUCCESS or FAILED.

01Create a dedicated API key

Create one key for Codex and keep it out of prompts, screenshots, project files, and shared configuration.

02Install the local MCP bridge

Run the verified installer or register the stdio bridge manually with Node.js 18 or later.

03Restart Codex and verify read-only tools

Check the MCP registration, shared credits account, and current pricing before creating a paid task.

04Create, poll, and retrieve one result

Submit a representative local document, keep its task_id, and poll until SUCCESS or FAILED.

Before installation

Prepare Codex, Node.js, and a dedicated API key

Use a separate key for this client so it can be revoked without affecting another integration.

  • Install Codex and confirm that the codex command is available in your terminal.
  • Install Node.js 18 or later. The local bridge uses the built-in fetch API and does not add a project dependency.
  • Create a dedicated API key in the Developer Center. The full key is displayed only once.
  • Choose a representative PDF, DOCX, PPTX, or XLSX file no larger than 20 MB. Use the REST API upload workflow for larger files.
API KeyThe installer hides the key while you type it, but stores it as plain JSON in ~/.fanyipaiban/mcp.json for the current user. Do not sync, commit, or share that folder.
Install

Run the verified installer for your operating system

The installer downloads the bridge from the fixed LingoBridge domain, validates the API key against the MCP endpoint, replaces the existing Codex entry named fanyipaiban, and asks you to restart Codex.

Codex / Windows PowerShell
$installerUrl = "https://www.fanyipaiban.com/poly/fanyipaiban-mcp-install.ps1"
$installer = Invoke-RestMethod $installerUrl
if ($installer -notmatch "(?m)^# FANYIPAIBAN_MCP_INSTALLER$") {
  throw "Installer file is unavailable. Use the manual setup below."
}
& ([ScriptBlock]::Create($installer))
Codex / macOS Terminal
installer=$(mktemp)
curl -fsSL https://www.fanyipaiban.com/poly/fanyipaiban-mcp-install.sh -o "$installer"
grep -q "^# FANYIPAIBAN_MCP_INSTALLER$" "$installer" || {
  echo "Installer unavailable. Use manual setup below."
  rm -f "$installer"
  exit 1
}
bash "$installer"; rm -f "$installer"
Review before runningThese commands download and execute an installer. Keep the URL on www.fanyipaiban.com, verify the marker check remains present, or use the manual configuration below when your security policy forbids remote script execution.

Manual Codex configuration

The installer ultimately registers this local stdio command. Replace the paths with absolute paths on your own computer after downloading the bridge and creating mcp.json.

~/.codex/config.toml
# Download the bridge to ~/.fanyipaiban/fanyipaiban-mcp-proxy.mjs
# Create ~/.fanyipaiban/mcp.json with: {"apiKey":"YOUR_API_KEY"}

[mcp_servers.fanyipaiban]
command = "node"
args = [
  "FULL_PATH/.fanyipaiban/fanyipaiban-mcp-proxy.mjs",
  "--config",
  "FULL_PATH/.fanyipaiban/mcp.json"
]
OpenAI CodexCodex also supports streamable HTTP servers and bearer tokens through its CLI. See the official OpenAI Codex MCP documentation. For the desktop app, the tested local bridge avoids environment-variable inheritance problems. Open the official Codex MCP documentation
Connection check

Verify account and pricing before creating a paid task

Restart Codex and open a new task. First make two read-only calls so you can confirm the server, API key, and current billing rules without creating a translation task.

Terminal / Confirm registration
codex mcp list
Codex prompt / Read-only verification
Use only the LingoBridge MCP tools for this check.
1. Call translation_get_account and summarize the account fields without exposing secrets.
2. Call translation_get_pricing and report the current credits per billable page and the billing unit for PDF, DOCX, PPTX, and XLSX.
3. Do not create a translation task and do not modify any local file.
Read onlyA successful response should expose the shared credits balance and the current 1,500 credits-per-billable-page rule. Do not publish screenshots that reveal the full balance or API key.
First document

Give Codex a precise, auditable task prompt

Tell Codex which file to use, which target language to request, when to stop polling, and where the result should be saved. The original file should remain unchanged.

Codex prompt / Translate one PDF to Chinese
Translate ./manual.pdf to Chinese with the LingoBridge MCP tools.

Requirements:
1. Check that the file exists and is no larger than 20 MB. Stop and recommend the REST API if it is larger.
2. Call translation_create_document_task with source_lang=auto, target_lang=cn, and a stable request_id for this operation.
3. Save the returned task_id. Poll translation_get_task every 3 to 5 seconds until status is SUCCESS or FAILED.
4. On SUCCESS, save the result as ./outputs/manual-zh.pdf when this environment permits downloading; otherwise return the short-lived download URL.
5. Report estimated and charged credits. Do not overwrite the source file.
6. Remind me to review scans, tables, diagrams, and business-critical values before delivery.
What should happenCodex reads the local file, sends its bytes through translation_create_document_task, saves task_id, and calls translation_get_task until the task ends. After SUCCESS, it can download the result when the current environment permits network and file writes; otherwise it should return the short-lived download URL.
Production contract

Four MCP tools are currently available online

This list was verified against the production tools/list response. PDF utilities and image translation exist in newer local code but are intentionally omitted until they are deployed to the production MCP server.

translation_get_accountRead available, frozen, used, and recharged credits from the shared account.
translation_get_pricingRead the current credits-per-page price and the billable unit for PDF, DOCX, PPTX, and XLSX.
translation_create_document_taskCreate an asynchronous translation task. Required inputs are file_name, file_base64, and target_lang; source_lang, parse_engine, and request_id are optional.
translation_get_taskRead task status, progress, credits, and short-lived result links by task_id. Continue until SUCCESS or FAILED.
Choose the right entry point

Use MCP for an AI workspace and REST API for system integration

MCP and REST API reach the same document translation capability, but they fit different operational contexts.

SituationBest optionReason
Translate one or several local files while working in CodexMCPCodex can read the selected workspace file, create the task, and keep polling in the same task.
Backend service, RPA, queue, or batch workflowREST APIYour system controls multipart upload, Idempotency-Key, retries, logging, and result archiving.
A local file is larger than 20 MBREST APIThe production MCP document payload is limited to 20 MB.
Test output before writing any integrationWeb workspaceUpload a representative sample and review translation and layout before automating the workflow.

Read the REST API Quickstart

Security

Treat the local key file and result links as secrets

The bridge keeps the key out of prompts and project code, but the credential still needs normal secret-handling discipline.

  • The installer stores the API key in plain JSON under the current user profile. Restrict access to that account and do not include the folder in cloud sync or backups shared with others.
  • Use a dedicated key per client. Revoke it immediately in the Developer Center if the file, screenshot, terminal log, or device is exposed.
  • Codex may ask for permission to read a local file, access the network, or write a downloaded result depending on your workspace and sandbox settings.
  • Result download URLs are short-lived. Save approved deliverables promptly and keep the original document for comparison and review.
  • Translation and layout retention are not guaranteed to be perfect. Review scans, formulas, tables, diagrams, and business-critical values before delivery.
UninstallTo disconnect the client, run codex mcp remove fanyipaiban. If you no longer need the integration, you can then remove the local ~/.fanyipaiban directory after confirming it contains no files you need.
Troubleshooting

Diagnose the connection layer by layer

Check registration, session freshness, credentials, file boundaries, and account state in that order.

SymptomLikely causeAction
fanyipaiban is missing from codex mcp listThe installer did not finish or codex was unavailable in PATH.Fix the terminal installation, rerun the installer, and confirm the entry before restarting Codex.
The MCP entry exists but Codex shows no translation toolsThe current Codex task started before the MCP configuration changed.Restart Codex and open a new task.
Invalid API key or HTTP 401The key is mistyped, revoked, or no longer active.Create a new dedicated key and rerun the installer.
The file is rejected before task creationThe format is unsupported, the payload is invalid, or the file exceeds 20 MB.Use PDF, DOCX, PPTX, or XLSX and switch large files to the REST API.
The task remains QUEUED or RUNNINGDocument processing is asynchronous.Keep the same task_id and poll at a measured interval; do not create duplicate tasks.
INSUFFICIENT_CREDITSThe shared credits balance cannot cover the estimated task.Recharge the same account, then create a new request.
FAQ

Questions before using MCP in daily work

Which tools are currently available on the production MCP server?

The production server currently exposes translation_get_account, translation_get_pricing, translation_create_document_task, and translation_get_task. This page does not advertise tools that are present only in newer local code.

Where does the installer store my API key?

The installer hides the key during input, then stores it as plain JSON in the current user profile at ~/.fanyipaiban/mcp.json. Keep that folder private, use a dedicated key, and revoke the key if the device or file is exposed.

Can MCP translate a local file larger than 20 MB?

No. The current production MCP document payload is limited to 20 MB. Use the public REST API multipart upload workflow for larger files.

Does MCP use a separate credits balance?

No. MCP, REST API, and the web workspace use the same account balance. Document translation is currently charged at 1,500 credits per billable page.

Does Codex need access to my local document?

Yes. Codex must be able to read the selected workspace file before it can send the bytes to the MCP tool. Depending on the workspace and sandbox settings, it may ask for permission to read the file, use the network, or save the result.

Should I trust the translated result without reviewing it?

No. Review scans, formulas, tables, diagrams, numbers, terminology, and layout before delivery. Source quality and document complexity affect the final result.

Verify the connection before translating a paid document

Create a dedicated key, install the bridge, restart Codex, and run the read-only account and pricing check. Then test one representative file and review the result.

Run the full workflow with a real document

Upload a PDF, Word, Excel, or PPT file to check translation, layout retention, bilingual review, and export quality.

滚动至顶部