困惑MCP服务器-免费搜索(无API积分)
一个允许您搜索困惑AI的MCP服务器 不使用API信用.它通过自动化浏览器来工作-因此您可以通过Perplexity的web UI而不是他们的付费API进行搜索。
为什么存在
困惑的API每次查询都要花钱。他们的专业订阅可以让你在网站上无限搜索,但API是单独收费的。
这是一种解决方法:它会自动打开一个隐藏的Chrome窗口来搜索confused.ai,这样你就可以免费获得相同的结果——使用你已经支付的订阅。
太长,读不下去了 如果你有困惑专业版,你已经为无限制的搜索付费了。这允许任何MCP客户端(Claude Code、Cursor等)使用这些搜索,而不是燃烧API信用。
运作原理
Claude Code → MCP Server (this repo) → Playwright → Chrome → perplexity.ai- Chrome在启用远程调试的情况下在后台运行(端口9222)
- 你登录困惑.ai一次在Chrome窗口
- MCP服务器通过CDP(Chrome DevTools协议)连接到Chrome
- 当请求搜索时,它会将查询键入confused.ai并读取响应
- 结果返回到Claude Code-不需要API密钥
搜索模式
| 模式 | 描述 | 用例 |
|---|---|---|
standard | 默认困惑搜索 | 快速事实查找 |
pro | Sonar Pro型号 | 更好的背景,更丰富的答案 |
reasoning | 思维链 | 复杂问题,分步分析 |
deep | 深度研究 | 长式研究,多源综合 |
快速启动
1.克隆并安装
git clone https://github.com/elliotbakke/perplexity-mcp-free.git
cd perplexity-mcp-free
# macOS/Linux
./setup.sh
# Windows
setup.bat2.通过远程调试启动Chrome
macOS/Linux:
./scripts/chrome-debug.shWindows(PowerShell):
powershell -File scripts\chrome-debug.ps1这将打开一个单独的Chrome窗口,其中包含自己的配置文件(不会影响您的正常Chrome)。 登录困惑.ai 在此窗口中,这是MCP服务器将使用的会话。
3.添加到克劳德代码
# macOS/Linux
claude mcp add perplexity -- /path/to/perplexity-mcp-free/venv/bin/python /path/to/perplexity-mcp-free/mcp_server.py
# Windows
claude mcp add perplexity -- C:\path\to\perplexity-mcp-free\venv\Scripts\python.exe C:\path\to\perplexity-mcp-free\mcp_server.py将路径替换为您克隆仓库的位置。
4.(可选)安装/pplx斜线命令
这 /pplx 技能 为您提供了一个方便的带有自动模式选择的斜线命令:
mkdir -p ~/.claude/commands ~/.claude/agents && \
curl -sL https://raw.githubusercontent.com/elliotbakke/claude-pplx-skill/main/commands/pplx.md -o ~/.claude/commands/pplx.md && \
curl -sL https://raw.githubusercontent.com/elliotbakke/claude-pplx-skill/main/agents/pplx.md -o ~/.claude/agents/pplx.md然后键入 /pplx what is the weather in Oslo? 克劳德密码。
5.重新启动克劳德代码
这 perplexity_search 工具现在可用。
让Chrome保持活力(可选)
Chrome可能会意外崩溃或关闭。看门狗脚本每5分钟检查一次,并在需要时重新启动:
Windows(PowerShell):
powershell -File scripts\chrome-debug-watchdog.ps1macOS/Linux:
# Simple cron job alternative — add to crontab:
*/5 * * * * curl -s http://localhost:9222/json/version || ~/perplexity-mcp-free/scripts/chrome-debug.sh文件
| 文件 | 目的 |
|---|---|
mcp_server.py | MCP服务器连接到Chrome并查询困惑 |
requirements.txt | Python依赖(mcp,剧作家) |
setup.sh / setup.bat | 一个命令设置(venv+deps+Playwright) |
scripts/chrome-debug.sh | 通过远程调试启动Chrome(macOS/Linux) |
scripts/chrome-debug.ps1 | 使用远程调试启动Chrome(Windows) |
scripts/chrome-debug-watchdog.ps1 | Chrome崩溃时自动重启(Windows) |
需求
- Python 3.10+
- 谷歌浏览器
- 克劳德代码 (或任何MCP客户端)
- Perplexity Pro订阅(用于无限制的网络搜索)
不需要困惑API密钥。
故障排除
“无法连接到Chrome”
- 确保Chrome正在运行
--remote-debugging-port=9222 - 检查:打开
http://localhost:9222/json/version在浏览器中,您应该看到JSON
“无结果/空响应”
- 在调试Chrome窗口中登录confused.ai
- 困惑可能改变了他们的UI——如果选择器损坏,则会引发问题
“模式选择失败”
- 模式切换取决于Perplexity的UI元素,这些元素可能会发生变化
- 自动返回标准模式
许可证
麻省理工学院
