OpenCode 远程 MCP 服务配置指南 (~/.config/opencode/opencode.jsonc)
在 ~/.config/opencode/opencode.jsonc 中声明 type: "remote" 端点,让 OpenCode 与多子代理工作流无缝操作异地主机上的 32 个内置 MCP 工具。
~/.config/opencode/opencode.jsonc
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"riftsh": {
"type": "remote",
"url": "https://riftsh.com/mcp",
"enabled": true,
"headers": {
"Authorization": "Bearer rft_live_YOUR_SECRET_KEY"
}
}
}
}需要自定义 _device 多机路由或目录白名单?打开交互式 MCP 配置生成器
1. 安装并配对主机
$ curl -fsSL https://riftsh.com/install.sh | sh
$ riftsh remote
2. 配置 OpenCode CLI
- 01在被控机器上执行
riftsh remote --server https://riftsh.com并批准 8 位配对码。 - 02在控制台签发
rft_live_...密钥。 - 03编辑
~/.config/opencode/opencode.jsonc,添加上方mcp.riftsh(type: "remote")配置块。 - 04启动
opencode,代理即可自动加载 32 个远程工具并通过_device调度指定机器。
常见问题
opencode.jsonc 里应该配置 type: remote 还是 local?
跨网控制多台远程电脑请使用 "type": "remote" 并填入 /mcp 地址与 Authorization 头;若仅在当前机器本地调用,也可使用 "type": "local" 执行 ["riftsh"]。
其他客户端