perplexity-webui-mcp
mcp server for querying perplexity pro via webui session token.
______________________________________________________________________
快速开始
此包是一个本地mcp包装器(stdio传输),用于启动上游 perplexity-webui-scraper mcp服务器通过 uvx.
默认情况下,它将上游流道固定到:
perplexity-webui-scraper[mcp]@git+https://github.com/henrique-coder/perplexity-webui-scraper.git@prod仅当您需要测试不同的上游构建时,才覆盖它:
PERPLEXITY_UPSTREAM_FROM="perplexity-webui-scraper[mcp]@git+https://github.com/henrique-coder/perplexity-webui-scraper.git@" \
PERPLEXITY_SESSION_TOKEN="your_token_here" \
npx perplexity-webui-mcp手动运行:
PERPLEXITY_SESSION_TOKEN="your_token_here" npx perplexity-webui-mcp通过代理手动运行:
PERPLEXITY_SESSION_TOKEN="your_token_here" \
PERPLEXITY_PROXY_URL="socks5://127.0.0.1:1080" \
npx perplexity-webui-mcp使用flaresolverr手动运行:
docker run -d --name flaresolverr -p 8191:8191 ghcr.io/flaresolverr/flaresolverr:latest
PERPLEXITY_SESSION_TOKEN="your_token_here" \
PERPLEXITY_FLARESOLVERR_URL="http://127.0.0.1:8191" \
npx perplexity-webui-mcp重要: 这使用了conference的内部webuiapi和会话cookie。仅用于个人/局部修补,与困惑人工智能无关。
______________________________________________________________________
概述
confused webui mcp是一个本地stdio mcp包装器,它启动上游 perplexity-webui-scraper mcp服务器通过 uvx这使得包保持在npm上,同时使用上游webui实现进行浏览器模拟、重试逻辑、特定于模型的工具和令牌工具。
______________________________________________________________________
快速安装
将此内容粘贴到llm代理会话中:
Install and configure perplexity-webui-mcp by following the instructions here:
https://raw.githubusercontent.com/Microck/perplexity-webui-mcp/refs/heads/master/INSTALL.mdnpm(推荐)
npm install -g perplexity-webui-mcp运行时间要求:
uv --version如果 uv 缺少,请从安装https://docs.astral.sh/uv/getting-started/installation/
______________________________________________________________________
手动安装
来自源头
git clone https://github.com/Microck/perplexity-webui-mcp.git
cd perplexity-webui-mcp
npm install
npm run build______________________________________________________________________
获取会话令牌
最快方法(通过CLI自动):
uvx --with rich --from "perplexity-webui-scraper@git+https://github.com/henrique-coder/perplexity-webui-scraper.git@prod" get-perplexity-session-token此交互式CLI会询问您的电子邮件,处理OTP/magic链接验证,并打印会话令牌。
您可以从任何目录运行该命令。
手动方法(浏览器):
- 打开 困惑.ai 在浏览器中登录
- 打开开发工具(f12或cmd+opt+i)
- 首选 应用 > 饼干 >
https://www.perplexity.ai - 复制值
__Secure-next-auth.session-token
由以下令牌提取流程提供动力:https://github.com/henrique-coder/perplexity-webui-scraper
______________________________________________________________________
配置
因为此服务器使用 stdio,将其配置为本地命令,并通过以下方式传递令牌 env.
代理支持:
- 标准代理环境变量已经通过:
HTTP_PROXY,HTTPS_PROXY,ALL_PROXY,NO_PROXY以及它们的小写变体 - 对于更简单的单值设置,请设置
PERPLEXITY_PROXY_URL;在启动上游MCP服务器之前,包装器将其扩展为标准代理环境变量 - 可选旁路列表:
PERPLEXITY_NO_PROXY - 如果困惑持续返回cloudflare挑战页面,请设置
PERPLEXITY_FLARESOLVERR_URL指向正在运行的flaresolverr实例。包装器解决了https://www.perplexity.ai/search/new,将返回的Cookie注入上游curl_cffi会话,并停止在该模式下转发标准代理env变量 - 可选的flaresolverr覆盖:
- PERPLEXITY_FLARESOLVERR_SOLVE_URL -先解决备用网址。违约: https://www.perplexity.ai/search/new - PERPLEXITY_FLARESOLVERR_MAX_TIMEOUT -flaresolverr以毫秒为单位解决超时问题。违约: 60000
注意:深入研究可能需要60秒以上的时间。如果您的客户支持,请设置更高的 timeout (例如:10分钟)。
mcp客户端配置(claude桌面、opencode等)
{
"mcpServers": {
"perplexity": {
"command": "perplexity-webui-mcp",
"timeout": 600000,
"env": {
"PERPLEXITY_SESSION_TOKEN": "your_session_token_here",
"PERPLEXITY_FLARESOLVERR_URL": "http://127.0.0.1:8191"
}
}
}
}来自源头
{
"mcpServers": {
"perplexity": {
"command": "node",
"args": ["/path/to/perplexity-webui-mcp/dist/index.js"],
"timeout": 600000,
"env": {
"PERPLEXITY_SESSION_TOKEN": "your_session_token_here",
"PERPLEXITY_FLARESOLVERR_URL": "http://127.0.0.1:8191"
}
}
}
}当cloudflare阻塞您的主机时使用flaresolverr
启动flaresolverr:
docker run -d --name flaresolverr -p 8191:8191 ghcr.io/flaresolverr/flaresolverr:latest
curl http://127.0.0.1:8191/然后将包装指向它:
PERPLEXITY_SESSION_TOKEN="your_token_here" \
PERPLEXITY_FLARESOLVERR_URL="http://127.0.0.1:8191" \
npx perplexity-webui-mcpflaresolver模式:
- 包装器首先在flaresolverr中解决cloudflare墙问题,然后将返回的cookie注入上游会话
- 包装器不转发
HTTP_PROXY,HTTPS_PROXY,ALL_PROXY,或NO_PROXY在此模式下,由于已解决的Cookie需要与flaresolverr浏览器路由保持绑定 - 如果flaresolver本身需要代理,请在flaresolver端而不是在
perplexity-webui-mcp
尾秤远程部署(可选)
如果您的云计算机被cloudflare阻止,但您的家庭计算机可以工作,请在家庭计算机上运行上游mcp服务器,并作为远程mcp从opencode连接到它。
- 从该仓库复制模板:
deploy/systemd/perplexity-webui-mcp.env.exampledeploy/systemd/perplexity-webui-mcp-sse.shdeploy/systemd/perplexity-webui-mcp.service
- 在家用计算机上安装并启用服务(用户服务):
mkdir -p ~/.config ~/.config/systemd/user ~/.local/bin
cp deploy/systemd/perplexity-webui-mcp.env.example ~/.config/perplexity-webui-mcp.env
cp deploy/systemd/perplexity-webui-mcp-sse.sh ~/.local/bin/perplexity-webui-mcp-sse.sh
cp deploy/systemd/perplexity-webui-mcp.service ~/.config/systemd/user/perplexity-webui-mcp.service
chmod 600 ~/.config/perplexity-webui-mcp.env
chmod 755 ~/.local/bin/perplexity-webui-mcp-sse.sh
systemctl --user daemon-reload
systemctl --user enable --now perplexity-webui-mcp.service- 将opencode(云主机)指向尾标端点:
{
"mcp": {
"perplexity-webui": {
"type": "remote",
"url": "http://:8790/sse",
"enabled": true,
"timeout": 600000,
"oauth": false
}
}
}- 验证:
opencode mcp list______________________________________________________________________
特征
| 工具 | 描述 |
|---|---|
pplx_ask | 最佳模型查询(自动模型选择) |
pplx_deep_research | 深度研究模式 |
pplx_sonar | 声纳模型 |
pplx_gpt54 / pplx_gpt54_thinking | gpt-5.4变体 |
pplx_claude_o46 / pplx_claude_o46_think | 克劳德作品4.6变体 |
pplx_claude_s46 / pplx_claude_s46_think | 克劳德十四行诗4.6变奏曲 |
pplx_gemini31_pro / pplx_gemini31_pro_think | gemini 3.1 pro变体 |
pplx_gemini_flash / pplx_gemini_flash_think | 双子座闪光变体 |
pplx_grok41 / pplx_grok41_think | grok 4.1变体 |
pplx_nemotron3_super_think | nemotron 3超级思维 |
所有上游模型工具支持 source_focus 值: web, academic, social, finance, all.
这与v1.0.0有何不同
- 旧v1.0.0:一个自定义工具(
perplexity_search)在本地TypeScript HTTP逻辑中实现。 - 当前:委托给上游
perplexity-webui-scraperMCP,公开了完整的上游模型特定工具集。 - 结果:与困惑抗bot保护的兼容性明显更好。
______________________________________________________________________
故障排除
| 问题 | 解决方案 |
|---|---|
| 令牌无效/401 | 从浏览器Cookie中获取新令牌 |
uvx 未找到 | 安装uv(uv --version 应该工作) |
| 没有回复 | 检查利率限制或您的帐户是否可以访问所选型号 |
| 澄清问题错误 | 使用推荐/默认澄清选项重试一次深入研究;如果仍然出现这种情况,则困惑拒绝了跳过,需要更具体的查询 |
云耀斑挑战/ Just a moment... | 运行flaresolverr并设置 PERPLEXITY_FLARESOLVERR_URL=http://127.0.0.1:8191 |
| 超时 | 深入的研究可能需要几分钟的时间——要有耐心 |
快速验证这两种模式
PERPLEXITY_SESSION_TOKEN="your_token_here" npm run self-test这将检查以下两项:
- 定期搜索(
best) - 深入研究(
deep-research)
并按模式打印通过/失败。
______________________________________________________________________
项目结构
perplexity-webui-mcp/
├── deploy/
│ └── systemd/
│ ├── perplexity-webui-mcp.env.example
│ ├── perplexity-webui-mcp-sse.sh
│ └── perplexity-webui-mcp.service
├── src/
│ └── index.ts # proxy launcher for upstream MCP
├── package.json
├── tsconfig.json
├── .env.example
├── .gitignore
├── LICENSE
├── INSTALL.md
└── README.md______________________________________________________________________
许可证
麻省理工学院
______________________________________________________________________
作者
______________________________________________________________________
喊话
特别感谢 henrique编码器/困惑webui抓取器 对于帮助此项目的WebUI逆向工程和令牌CLI工作流。
