本项目主要用于将 Perplexity 工具集成到相关环境中,借助该工具可在 Claude 中实现对各类信息的搜索,如 AI 最新发展、量子计算历史、气候变化信息等。
在使用该工具前,需要完成一系列的安装和配置工作,具体步骤如下。
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- 然后安装 Git:
brew install git
- **Windows 系统**:
- 从 [git-scm.com](https://git-scm.com/downloads) 下载并安装 Git。
- 运行安装程序。
brew install node
- **Windows 系统**:
- 访问 [nodejs.org](https://nodejs.org/) 下载安装程序。
- 运行安装程序。
git --version
node --version
git clone https://github.com/letsbuildagent/perplexity-tool
cd perplexity-tool
npm install
server.js 文件。const PERPLEXITY_API_KEY = "YOUR-API-KEY-HERE";
- 用你的 Perplexity API 密钥替换 `"YOUR-API-KEY-HERE"`。
.env 文件:# 对于 Mac/Linux:
touch .env
open .env
# 对于 Windows:
notepad .env
也可以在文本编辑器中新建一个名为 .env 的文件。
- 在 .env 文件中添加你的 API 密钥:
PERPLEXITY_API_KEY=your-api-key-here
- 安装 dotenv:
npm install dotenv
- 更新 `server.js` 文件:
import 'dotenv/config'
const PERPLEXITY_API_KEY = process.env.PERPLEXITY_API_KEY;
~/Library/Application Support/Claude/claude_desktop_config.json 文件。{
"mcpServers": {
"perplexity-tool": {
"command": "node",
"args": [
"/full/path/to/perplexity-tool/server.js"
]
}
}
}
将 /full/path/to 替换为你克隆仓库的实际路径。
5. 重启 Claude Desktop
完成上述配置后,重启 Claude Desktop 使配置生效。
安装完成后,你可以通过以下命令在 Claude 中使用该工具:
你可以指定额外参数来控制工具的行为:
temperature:控制响应随机性(取值范围 0 - 2)max_tokens:限制响应长度search_domain_filter:限制搜索域search_lang_filter:过滤搜索语言以下是一个示例配置:
{
"mcpServers": {
"perplexity-tool": {
"command": "node",
"args": [
"./server.js"
],
"config": {
"temperature": 0.7,
"max_tokens": 2048,
"search_domain_filter": ["example.com"],
"search_lang_filter": ["en"]
}
}
}
}
git --versionnode --version.env 文件是否正确加载。