跳过正文
MMVI · MMXXVI

WSL2 - Opencode

WSL2 · Opencode

Opencode Agent / MCP 配置。

·1 分钟
OpenCode 全局 MCP 配置笔记 # 环境要求 # Node.js ≥ 18 OpenCode ≥ 1.14 1. 创建配置文件 # 1mkdir -p ~/.config/opencode ~/.config/opencode/opencode.json: 1{ 2 "$schema": "https://opencode.ai/config.json", 3 "mcp": { 4 "shadcn": { 5 "type": "local", 6 "command": ["npx", "-y", "shadcn@latest", "mcp"], 7 "enabled": true 8 } 9 } 10} 2. 预热 npx 缓存 # 避免首次启动时下载失败:

·3 分钟
官方docs:Windows (WSL) | OpenCode Settings # Proxy # 打开WSL运行直接curl -fsSL https://opencode.ai/install | bash来安装opencode; 如果网络不好,可以临时配置WSL代理端口,然后重新输入: curl -fsSL https://opencode.ai/install | bash 我使用的是windows clashverge的混合端口; 要查看Clash Verge端口 比如是7890; 先运行ip route,获取your_host_ip; 然后执行: 1export http_proxy="http://your_host_ip:7890" 2export https_proxy="http://your_host_ip:7890" 用curl ipinfo.io检查是否配置成功后 重新安装opencode 显示下载完成后; 先刷新一下配置source ~/.bashrc ,然后运行opencode --help; 如果有输出就是安装成功啦;