Untitled conversation
- User
{ "mcpServers": { "tavily-mcp": { "command": "npx", "args": [ "-y", "tavily-mcp@0.2.1" ], "env": { "TAVILY_API_KEY": "{ "mcpServers": { "tavily-mcp": { "command": "npx", "args": [ "-y", "tavily-mcp@0.2.1" ], "env": { "TAVILY_API_KEY": "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" }, "disabled": false, "autoApprove": [] } } }" }, "disabled": false, "autoApprove": [] } } }
- Assistant
It looks like your JSON got a bit nested inside the
TAVILY_API_KEYstring. Here’s a cleaned-up version where the API key is just a simple string value:{ "mcpServers": { "tavily-mcp": { "command": "npx", "args": [ "-y", "tavily-mcp@0.2.1" ], "env": { "TAVILY_API_KEY": "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" }, "disabled": false, "autoApprove": [] } } }Make sure:
- Your JSON file has no trailing commas.
- The
TAVILY_API_KEYvalue is just the raw key string. - You’ve saved and reloaded any processes that read this config.
Let me know if that fixes it or if you run into any other issues! 😃
- User
这个代码在chatwise里可以使用,但我用在cherry studio里不行,请分析错误,给出正确的配置
- Assistant
下面给出两种常见的做法,一是把完整的
mcpServers写入 Cherry Studio 的配置文件(JSON 或 YAML),二是直接在 Cherry Studio 的 Web UI 里注入环境变量后,在配置里以占位符引用。你可以根据自己项目实际选一种即可。
一、直接在配置里写死(JSON)
保存为
cherry.config.json(或你项目实际读取的文件名):{ "mcpServers": { "tavily-mcp": { "command": "npx", "args": [ "-y", "tavily-mcp@0.2.1" ], "env": { "TAVILY_API_KEY": "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" }, "disabled": false, "autoApprove": [] } } }要点:
- 不要在字符串里再塞一段 JSON —— 原先的双层大括号把整个对象当成了一个字符串,导致 Cherry Studio 解析失败。
- 确保没有多余的逗号或引号,文件整体是一个合法的 JSON。
二、借助 Cherry Studio 的环境变量功能(推荐)
- 在 Cherry Studio 项目设置 → Environment Variables → 添加:
- Key:
TAVILY_API_KEY - Value:
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
- Key:
- 配置文件里这样写(支持 JSON/YAML 两种形式):
--- JSON 版(
cherry.config.json){ "mcpServers": { "tavily-mcp": { "command": "npx", "args": ["-y", "tavily-mcp@0.2.1"], "env": { "TAVILY_API_KEY": "${TAVILY_API_KEY}" }, "disabled": false, "autoApprove": [] } } }--- YAML 版(
cherry.config.yml)mcpServers: tavily-mcp: command: npx args: - -y - tavily-mcp@0.2.1 env: TAVILY_API_KEY: ${TAVILY_API_KEY} disabled: false autoApprove: []这样做的好处:
- 安全:密钥不会写在代码里,Cherry Studio CI/CD 会自动注入。
- 灵活:不同环境(dev/stage/prod)可以配置不同的变量。
按上面任一方案改完后,重启/重新触发你的 Cherry Studio 流水线,就能正常跑起来了。有什么问题继续吼我!😄
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.