关于 transfa
transfa 是面向开发者和 AI Agent 的文件分享服务,可通过命令行、REST API 或 MCP 服务上传文件并获得链接,无需注册账号。上传时会计算 SHA-256 校验值,并支持有效期限制。
主要功能
- 01命令行一键上传文件
- 02返回 SHA-256 校验值
- 03支持有效期、密码和下载次数限制
- 04提供 JSON REST API
- 05自动识别 100 多种文件格式
适用场景
- 01在 CI 流水线中上传构建产物
- 02让 AI Agent 把生成的报告或模型文件分享给他人
- 03在脚本中批量分发大型文件
MCP 相关
transfa 提供 MCP 服务,向 Claude、Cursor 等 MCP 客户端暴露 upload、file_info、list_uploads、delete_upload 和 run_artifacts 工具,用于上传、查询和删除文件。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
npx -y transfa-mcpTRANSFA_API_KEY密钥Your Transfa API key. Free at transfa.sh — leave empty for guest mode (10 MB limit).TRANSFA_BASE_URLCustom Transfa instance URL for self-hosted deployments. Defaults to https://transfa.sh本地服务需要在你的电脑上安装运行环境(如 Node.js 18+)。各客户端的配置文件位置不同,请参考客户端文档。
工具
4收录的工具列表 · 更新于 2 周前
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| name | string | 否 | 覆盖显示给接收者的文件名 |
| once | boolean | 否 | 首次下载后删除 |
| path | string | 是 | 要上传的文件路径 |
| grace | string | 否 | 过期后的宽限期,例如 "12h" — TTL 结束后,文件仍可在此期间内下载 |
| expires | string | 否 | TTL:"1h"、"24h"、"7d"、"30d"。默认值:7d |
| password | string | 否 | 为链接设置密码保护 |
| max_downloads | number | 否 | 最大下载次数 |
详细介绍
为开发者和 AI Agent 打造的极简文件共享工具。
一条命令即可上传,通过链接分享。无需账号。
$ tf upload model.gguf
✓ Uploaded model.gguf (4.2 GB) → https://transfa.sh/f/xK9mRp
SHA-256 a3f8c2...d91b
Expires in 7 days
为什么选择 transfa?
大多数文件共享工具都是为通过界面点击操作的人类打造的。transfa 专为终端而设计,可从 shell 脚本、CI 流水线和需要无障碍传输文件的 AI Agent(Claude、GPT、Cursor 等)中调用。
- 无需注册——安装后即可上传
- 支持任意格式和大小——最大 100 GB;支持 ML 模型、存档、二进制文件、代码和媒体文件
- 专为 Agent 打造——JSON API、SHA-256 校验和、幂等上传
- 密码保护、下载次数限制、TTL——全面控制每个链接
- 可检测 100 多种格式——自动检测 MIME 类型,包括
.gguf、.safetensors、.parquet、.ipynb等
安装
Node.js / CLI
npm install -g transfa
Python SDK
pip install transfa
MCP 服务(适用于 Claude、Cursor 及任何兼容 MCP 的 Agent)
npx -y transfa-mcp
也可以使用原始安装脚本:
curl -fsSL https://transfa.sh/install | sh
快速开始
# Upload a file (no account needed)
tf upload photo.jpg
# Upload with custom TTL and password
tf upload secret.zip --ttl 24h --password hunter2
# Upload and pipe the URL to clipboard
tf upload bundle.tar.gz | grep url | awk '{print $2}' | pbcopy
# Download a file
tf download https://transfa.sh/f/xK9mRp
# List your uploads
tf list
# Delete an upload
tf delete xK9mRp
GitHub Actions
直接从工作流上传构建产物、覆盖率报告和任何 CI 输出:
- uses: colapsis/transfa-action@v1
id: upload
with:
file: ./dist/report.pdf
api-key: ${{ secrets.TRANSFA_API_KEY }}
- run: echo "${{ steps.upload.outputs.agent-link }}" >> $GITHUB_STEP_SUMMARY
完成此步骤后,以下五个输出均可用:id、agent-link、human-link、sha256、expires-at。
请参阅 colapsis/transfa-action,了解完整的输入参考和更多示例(受密码保护的链接、可自托管实例、单次下载限制)。
API
transfa 完全采用 REST。CLI 能执行的所有操作,都可以通过 curl 或任意 HTTP 客户端完成。
上传
curl -X POST https://transfa.sh/api/upload \
-H "Authorization: Bearer $TF_KEY" \
-F "[email protected]" \
-F "ttl=7d"
{
"id": "xK9mRp",
"url": "https://transfa.sh/f/xK9mRp",
"download_url": "https://transfa.sh/api/download/xK9mRp",
"filename": "model.gguf",
"bytes": 4512345678,
"sha256": "a3f8c2...d91b",
"expires_at": "2026-05-21T12:00:00.000Z"
}
上传选项(表单字段或标头):
| 字段 | 标头 | 说明 |
|---|---|---|
ttl | X-Transfa-TTL | 过期时间:1h、24h、7d、30d |
password | — | 为下载链接设置密码保护 |
max_downloads | — | 达到 N 次下载后自动失效 |
filename | X-Transfa-Filename | 覆盖存储的文件名 |
下载
# Direct download (no auth required)
curl -L https://transfa.sh/api/download/xK9mRp -o model.gguf
# Password-protected
curl -L "https://transfa.sh/api/download/xK9mRp?password=hunter2" -o secret.zip
文件信息
curl https://transfa.sh/api/download/info/xK9mRp
{
"id": "xK9mRp",
"filename": "model.gguf",
"bytes": 4512345678,
"sha256": "a3f8c2...d91b",
"mime_type": "application/octet-stream",
"download_count": 3,
"has_password": false,
"expires_at": "2026-05-21T12:00:00.000Z",
"active": true
}
列出上传记录
curl https://transfa.sh/api/upload \
-H "Authorization: Bearer $TF_KEY"
删除
curl -X DELETE https://transfa.sh/api/upload/xK9mRp \
-H "Authorization: Bearer $TF_KEY"
支持的格式
支持 100 多种文件类型,并能正确检测 MIME 类型,包括标准 MIME 数据库中未收录的类型:
| 类别 | 格式 |
|---|---|
| ML 模型 | .gguf .ggml .safetensors .onnx .pt .pth .pkl .ckpt .tflite .mlmodel .lora |
| 数据科学 | .parquet .arrow .feather .h5 .hdf5 .npz .npy .lance .duckdb .ipynb |
| 代码 | .py .rs .go .ts .kt .swift .scala .cu .sol .vy .elm .zig |
| 存档 | .zip .tar .gz .bz2 .xz .7z .zst |
| 3D / 设计 | .glb .gltf .obj .stl .usdz .blend .fig .sketch .psd |
| 媒体 | .avif .webp .heic .jxl .opus .flac .webm .av1 |
| 配置 | .toml .hcl .tf .tfvars .nix .dhall .lock .env |
| 其他所有类型 | .wasm .sqlite .db .pem .crt .p12 + 所有标准类型 |
其他格式均可按 application/octet-stream 接受,不会屏蔽任何格式。
套餐
| 访客 | 免费版 | Pro | Team | |
|---|---|---|---|---|
| 最大文件大小 | 10 MB | 500 MB | 50 GB | 100 GB |
| 每日上传次数 | 5 | 20 | 500 | 5,000 |
| 最长 TTL | 24h | 48h | 30 days | 180 days |
| 存储空间 | — | — | 无限制 | 无限制 |
| 价格 | 免费 | 免费 | $12/mo | $48/mo |
| 试用 | — | — | 3 天免费试用 | 3 天免费试用 |
MCP 服务(Claude、Cursor 和任何兼容 MCP 的 Agent)
transfa 提供 MCP 服务,让 Claude、Cursor 和任何兼容 MCP 的 Agent 都能自主上传和分享文件,无需使用 shell 命令或配置基础设施。
npx -y transfa-mcp
Claude Desktop 配置
添加到 ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"transfa": {
"command": "npx",
"args": ["-y", "transfa-mcp"],
"env": {
"TRANSFA_API_KEY": "your-api-key"
}
}
}
}
API 密钥为可选项——不提供密钥时,服务会以访客模式运行(限制为 10 MB / 24h)。
可用的 MCP 工具
| 工具 | 描述 |
|---|---|
upload | 从本地文件系统上传文件。返回 agent_link(直接 URL)、human_link(分享页面)和 sha256。接受用于溯源的 run_id、step、consumer、intent。 |
file_info | 获取上传文件的元数据——文件名、大小、SHA-256、到期时间、下载次数和溯源字段。 |
list_uploads | 列出最近的上传记录(需要 API 密钥)。 |
delete_upload | 立即删除上传文件。 |
run_artifacts | 获取在某个 run_id 下上传的所有文件——包含完整的工作流运行或 Agent 会话溯源清单。 |
Agent 工作流示例
当 Claude 将 transfa 用作 MCP 工具时,可以:
- 生成报告 → 调用
upload→ 获取链接 → 将链接粘贴到对话中 - 通过分享
agent_link将文件传给另一个 Agent - 完成后调用
delete_upload清理
Python SDK
import transfa
# Upload
result = transfa.upload("model.pt", ttl="24h", run_id="run-42", artifact=True)
print(result.url, result.sha256)
# Download (SHA-256 verified)
transfa.download(result.id, output="model.pt")
# Provenance manifest for a run
manifest = transfa.run_artifacts("run-42")
# Async
async with transfa.AsyncClient() as client:
result = await client.upload("model.pt")
完整的 API 参考请参阅 python/README.md。
与 AI Agent 配合使用(脚本/子进程)
transfa 也可通过 shell 脚本、CI 工作流以及偏好使用子进程调用的 Agent 调用:
import subprocess, json
result = subprocess.run(
["tf", "upload", "output.csv"],
capture_output=True, text=True
)
data = json.loads(result.stdout)
print(data["url"]) # https://transfa.sh/f/xK9mRp
也可以直接使用 REST API——无需 SDK,无需认证流程,只需 HTTP。
自托管
git clone https://github.com/colapsis/transfa.git
cd transfa
cp .env.example .env # fill in your keys
npm install --prefix server
npm install --prefix cli
npm run build --prefix frontend
pm2 start ecosystem.config.cjs
要求: Node.js 18+、nginx(用于 SSL/代理)
生产环境可用的 nginx 配置请参阅 nginx/transfa.conf。
环境变量
| 变量 | 描述 |
|---|---|
PORT | 服务端口(默认:3001) |
BASE_URL | 公共 URL,例如 https://transfa.sh |
STRIPE_SECRET_KEY | 用于计费的 Stripe 密钥 |
STRIPE_WEBHOOK_SECRET | Stripe webhook 签名密钥 |
STRIPE_PRO_PRICE_ID | Pro 套餐的 Stripe 价格 ID |
STRIPE_TEAM_PRICE_ID | Team 套餐的 Stripe 价格 ID |
安全
发现漏洞?请发送邮件至 [email protected],或参阅 SECURITY.md。
请勿为安全问题公开创建 issue。
许可证
MIT — © 2026 transfa 贡献者
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。
