Problem
安装 cherry-studio v1.1.7,在 MCP Server 的设置界面能看到如下提示。由于本地已有uv
和bun
,因此不想在此处再次安装。

根据如何在 Cherry Studio 中使用 MCP中的描述,配置了uv
/bun
的绝对路径。

但无法添加 server,报错为,
1
| Error invoking remote method 'mcp:add-server': McpError: MCP error -32000: Connection closed.
|
terminal 中直接运行是正常的,

翻了一下[BUG]: MCP 错误反馈汇总 · Issue #3264 · CherryHQ/cherry-studio,猜测是路径的问题。查看源码找到判断 binary 是否安装的逻辑如下,
1
2
3
4
5
6
7
8
9
10
11
12
| export async function getBinaryPath(name: string): Promise<string> {
let cmd = process.platform === 'win32' ? `${name}.exe` : name
const binariesDir = path.join(os.homedir(), '.cherrystudio', 'bin')
const binariesDirExists = await fs.existsSync(binariesDir)
cmd = binariesDirExists ? path.join(binariesDir, cmd) : name
return cmd
}
export async function isBinaryExists(name: string): Promise<boolean> {
const cmd = await getBinaryPath(name)
return await fs.existsSync(cmd)
}
|
因此 cherry-studio 是在~/cherrystudio/bin
路径判断是否存在uv
/bun
,那加上软链即可。
Solution
1
2
3
4
5
6
7
8
| mkdir -p ~/.cherrystudio/bin
cd ~/.cherrystudio/bin
ln -s /path/to/npx npx
ln -s /opt/homebrew/bin/uv uv
ln -s /opt/homebrew/bin/bun bun
ln -s /opt/homebrew/bin/bunx bunx
ln -s /opt/homebrew/bin/uvx uvx
|