翻呗文档翻译 · MCP Server
把翻呗的文档翻译能力接进任何支持 MCP 的 Agent: Claude Desktop / Claude Code、Cursor、Cline、Codex,或你自己写的 Agent。
一个端点,七个工具:列引擎 → 报价 → 上传下单 → 查进度 → 下载。
- 服务地址:https://trans.sunnytranslation.com
- 支持格式:DOCX / PPTX / PDF / XLSX / TXT,ZIP / 7Z / RAR 批量包;
.doc/.xls/.ppt上传时自动转换 - 计价:按页扣积分,1 积分/页起(引擎与附加项不同)
- 引擎:通用模型 / DEEPL / GPT-6 系列 / Claude 5.5 / Gemini / Grok / 豆包 / DeepSeek / GLM / LongCat / 金山·阿里·有道
1. 拿一个访问令牌
curl -X POST https://trans.sunnytranslation.com/trans/api/token \
-d "username=你的账号" -d "password=你的密码"
返回里的 token(fb1. 开头,默认 30 天有效)就是全部凭证。
改密码会让旧令牌立即失效——令牌签名的盐是该账号的密码哈希,服务端不存令牌表。
2. 配置客户端
Claude Desktop / Claude Code(stdio)
{
"mcpServers": {
"fanbei": {
"command": "uvx",
"args": ["fanbei-mcp"],
"env": { "FANBEI_TOKEN": "fb1.xxxxx" }
}
}
}
也支持用账号密码,让服务自己换令牌(首次调用时登录一次,之后缓存到过期):
"env": { "FANBEI_USERNAME": "你的账号", "FANBEI_PASSWORD": "你的密码" }
远程接入(streamable-http)
{
"mcpServers": {
"fanbei": {
"type": "http",
"url": "https://trans.sunnytranslation.com/mcp",
"headers": { "Authorization": "Bearer fb1.xxxxx" }
}
}
}
客户端不支持自定义请求头时,也可以把令牌放在 URL 查询参数里(服务端会自动转成鉴权头,且不会把令牌继续往下游传):
https://trans.sunnytranslation.com/mcp?token=fb1.xxxxx
自托管:
fanbei-mcp --transport http --host 127.0.0.1 --port 9010 --json-response
3. 工具
| 工具 | 说明 | 只读 |
|---|---|---|
fanbei_account |
积分余额、有效期、令牌到期 | ✓ |
fanbei_engines |
引擎清单、每页积分、能力边界 | ✓ |
fanbei_quote |
按页数估积分,判断余额够不够 | ✓ |
fanbei_translate_document |
上传并下单(可同步等待完成) | ✗ |
fanbei_task_status |
单任务进度 + 子文件明细 | ✓ |
fanbei_list_tasks |
任务列表(在用 / 回收站) | ✓ |
fanbei_download |
10 分钟有效的下载链接,或直接落盘 | ✓ |
典型对话:
把
/tmp/合同.docx用 GPT-6.1 Sol 翻成英文,双语对照,翻完给我下载链接。
Agent 会依次调用 fanbei_engines → fanbei_quote → fanbei_translate_document
→ fanbei_task_status → fanbei_download。
文件怎么传
| 场景 | 参数 | 说明 |
|---|---|---|
| 本地 stdio | file_path |
读本机文件,最大 300MB |
| 文件在公网 | file_url |
服务端拉取,最大 50MB |
| 远程 / 无路径 | file_base64 + filename |
最大 50MB,注意上下文长度 |
4. 注意
- 扣费发生在下单那一刻。
auto_confirm=false只上传不扣费,但也不会有进度。 status=3才是「翻译完成、可下载」;7只是转换完成。- 失败任务不会自动退款,走客服申诉。
- 传统网页引擎(金山/阿里/有道)不支持术语表与全文上下文。
- 下载链接 10 分钟过期,重新调用
fanbei_download换新的。
5. 开发
python -m venv .venv && .venv/Scripts/pip install -e .
FANBEI_TOKEN=fb1.xxx python tests/selftest.py # 全链路自测
FANBEI_TOKEN=fb1.xxx python tests/selftest.py --read-only # 只读自测
6. 许可与条款
Metadata
Release files for fanbei-mcp 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fanbei_mcp-0.1.0.tar.gz | 36.8 kB | Without provenance | Details for fanbei_mcp-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fanbei_mcp-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for fanbei_mcp-0.1.0-py3-none-any.whl |
Total release size: 52.8 kB
Release files / fanbei_mcp-0.1.0.tar.gz
| Download URL | fanbei_mcp-0.1.0.tar.gz |
|---|---|
| Size | 36.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
98364395038d513a1354b8d22496deb7c33322c49fa1c2c5ff8767721f758afd
|
|
BLAKE2b-256 checksum How to use checksums |
3f92907eab263d879ad7a4730433af448c36827da26f0c5d3c9658315f082e6f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.9
|
Release files / fanbei_mcp-0.1.0-py3-none-any.whl
| Download URL | fanbei_mcp-0.1.0-py3-none-any.whl |
|---|---|
| Size | 16.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aaa3cf1ca1adad66cb78cf9b2bbd2be8e9ce68946213f5a6eb46efe65fb6612f
|
|
BLAKE2b-256 checksum How to use checksums |
1a0a5801da497614e92a97b885ab44aee4b3f8c597adf7f5f25a283a81d74a76
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.9
|
Security for fanbei-mcp 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.