perplexity-deep-mcp

perplexity-deep-mcp

An MCP server that makes Perplexity's Sonar Deep Research usable from MCP clients that enforce a request timeout by using Perplexity's async API.

Category
访问服务器

README

perplexity-deep-mcp

An MCP server that makes Perplexity's Sonar Deep Research usable from MCP clients that enforce a request timeout.

No dependencies. One file. Runs on node server.js.

The problem

Perplexity's sonar-deep-research model runs for two to twenty minutes depending on reasoning effort. MCP clients don't wait that long. Claude Desktop cancels the tool call and returns:

MCP error -32001: Request timed out

The official Perplexity MCP server calls the synchronous /chat/completions endpoint, so deep research is effectively unavailable from inside the client. Raising the timeout doesn't help. The limit lives in the client's bundled MCP SDK, which on a packaged install sits inside a signed application bundle you can't edit. Config keys like timeout and MCP_SERVER_REQUEST_TIMEOUT are ignored.

Perplexity solved this on their side with an async API. This server exposes it.

How it works

The job is split across three requests that each return in under a second:

pplx_deep_research_start   POST /v1/async/sonar        submit, get a job id back
pplx_deep_research_check   GET  /v1/async/sonar/{id}   poll status, fetch result
pplx_deep_research_list    GET  /v1/async/sonar        recover ids, see what's running

Nothing blocks. Research length stops being a constraint. Results stay retrievable for seven days, so a job started in one conversation can be collected in another.

check takes an optional wait_seconds (max 40). The server holds and polls internally, which cuts the number of round trips without going near the client's limit.

Install

Node 18 or later. Nothing else.

git clone https://github.com/Aakashanil67/perplexity-deep-mcp.git

Get an API key from the Perplexity API portal.

Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "perplexity-deep": {
      "command": "node",
      "args": ["/absolute/path/to/perplexity-deep-mcp/server.js"],
      "env": {
        "PERPLEXITY_API_KEY": "pplx-your-key-here"
      }
    }
  }
}

On Windows, use "C:\\Program Files\\nodejs\\node.exe" as the command if bare node doesn't resolve. Quit the app fully — from the system tray, not just the window — and reopen.

Claude Code

claude mcp add perplexity-deep --env PERPLEXITY_API_KEY="pplx-your-key-here" -- node /absolute/path/to/server.js

Environment

Variable Required Default
PERPLEXITY_API_KEY yes —
PERPLEXITY_BASE_URL no https://api.perplexity.ai

Tools

pplx_deep_research_start

Submits a job and returns immediately.

Parameter Type Notes
query string, required Longer and more structured prompts produce noticeably better reports here
reasoning_effort minimal | low | medium | high Default medium. high runs many more searches and takes considerably longer
search_mode web | academic | sec academic for peer-reviewed sources, sec for US company filings
search_recency_filter hour | day | week | month | year
search_domain_filter string[] Max 10. Prefix with - to exclude, e.g. ["-pinterest.com"]
search_after_date_filter string MM/DD/YYYY
system_prompt string Shapes tone and structure of the report

pplx_deep_research_check

Parameter Type Notes
job_id string, required From start
wait_seconds number, 0–40 Hold and poll internally before reporting back
strip_thinking boolean Strips <think> blocks. Default true

Returns the full report with sources and cost once the job reaches COMPLETED. While it's running you get the status and elapsed time. A FAILED job surfaces Perplexity's error message.

pplx_deep_research_list

Optional status and limit. Returns a table of recent jobs.

Known limitation

The async endpoint returns citations: [] and search_results: [] even on jobs that ran many searches, and the model omits inline [n] markers. The synchronous endpoint doesn't have this problem. Verified 25 July 2026 against two jobs that ran eight and four search queries respectively; both came back with empty source arrays. Injecting a system prompt instructing the model to write full URLs into the prose was tried and did not work.

The practical effect is that you get a long, well-organised, unattributed report. That is fine for scoping an unfamiliar topic and not fine for anything you intend to cite.

The server handles this rather than hiding it. If the citation arrays are empty it scans the report body for URLs and lists whatever it finds, labelled as recovered rather than cited. If nothing turns up it says so in plain language at the end of the report. formatCompleted() reads the proper fields first, so if Perplexity ships a fix the correct sources appear with no code change.

This is upstream. There are open reports on the Perplexity community forum describing the same behaviour.

Why there are no dependencies

The MCP TypeScript SDK is the normal way to build one of these. It's a good SDK. It also means a build step, a node_modules tree, and a lockfile to keep current, all to wrap a protocol that is JSON-RPC 2.0 over newline-delimited stdio.

For a server with three tools and two endpoints that trade wasn't worth making. server.js implements the protocol directly: initialize echoes the client's requested version, tools/list returns the schemas, tools/call dispatches, and resources/list and prompts/list return empty rather than erroring, which keeps stricter clients happy. Notifications get no reply. Unknown methods return -32601.

Two details worth knowing if you adapt this:

Everything written to stdout has to be a JSON-RPC frame. A stray console.log corrupts the stream and the client drops the connection with no useful error. All logging here goes to stderr.

The process tracks in-flight requests and won't exit on stdin close while a call is still awaiting the API. Without that guard a closing client can drop a reply that was about to be written.

Errors

Failures return isError: true with a message aimed at whoever has to fix it, not a stack trace. A 401 says the key was rejected. A 404 on a job lookup mentions the seven-day expiry. A 429 says to wait. Network timeouts distinguish themselves from research timeouts, because the two look identical from the client side and the fix is different.

Development

node --check server.js

Drive it by hand over stdio:

printf '%s\n' \
  '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{}}}' \
  '{"jsonrpc":"2.0","id":2,"method":"tools/list"}' \
  | PERPLEXITY_API_KEY=your-key node server.js

Or use the official inspector:

npx @modelcontextprotocol/inspector node server.js

Cost

Billed by Perplexity per request. Observed on short test jobs: $0.08 for four search queries, $0.13 for eight. Real research runs at high effort cost substantially more. Each result reports its own cost.

License

MIT. See LICENSE.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选