Answersearch

io.github.CloudCorpRecords由 GitHub 帳號 CloudCorpRecords 發布v0.1.0更新於 Nov 3, 2026

Perplexity answers: ask, search, reason, and deep research through the Sonar API.

概覽

AI 產生的概覽

封裝 Perplexity 的 Sonar 模型,讓助理能提出有網路搜尋依據的問題、取得排序後的網頁結果、逐步推理或進行深度研究。

可以做什麼
  • 提問並取得以即時網路搜尋為依據的對話式回答
  • 直接搜尋網路並回傳附中繼資料的排序結果
  • 用推理模型逐步分析複雜問題
  • 針對某個主題執行較慢的多來源深度研究
適用情境
適合需要助理結合最新網路資訊與來源作答,或把較吃重的調查與推理工作交給 Perplexity 模型處理、而非在對話中直接完成的場合。
執行需求
需要 Perplexity API 金鑰,透過環境變數 PERPLEXITY_API_KEY 提供,未設定時所有呼叫都會失敗。以 stdio 方式在本機執行,可用 npx(需 Node.js)或 Docker 映像啟動。需要能連線至 Perplexity API 的網路。
安裝前請注意
需要付費的 Perplexity API 金鑰,用量由 Perplexity 計費;深度研究呼叫耗時明顯較長。查詢與訊息內容會傳送到 Perplexity 的 API。工具結果是上游 JSON 原樣以文字回傳。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Answersearch,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

answersearch

answersearch puts Perplexity's models within reach of a terminal or an agent. You can put a question to a search-grounded model and get an answer with its sources, pull ranked web results on their own, hand a hard problem to the reasoning model, or commission a slower, deeper research pass that reads widely before it writes. It runs as a small CLI or as an MCP server, and it needs a Perplexity API key.

Setup

Get a key from the Perplexity API portal and export it:

bash
export PERPLEXITY_API_KEY=<redacted>

Without the variable set, every command and tool call fails with an error that names PERPLEXITY_API_KEY — nothing is sent anywhere.

Install

bash
npx @reneturcios/answersearch ask "what changed in the latest Node LTS?"

Or run the container image:

bash
docker run -i -e PERPLEXITY_API_KEY ghcr.io/cloudcorprecords/answersearch

The container defaults to the MCP server (see below). Pass CLI arguments to use it as a CLI instead.

CLI

bash
# Conversational answer grounded in live web search (sonar-pro)answersearch ask "who won the marathon last weekend?"
# Ranked search results only, with optional budgetsanswersearch search "composting basics" --max-results 5 --max-tokens 4000 --max-tokens-per-page 512
# Step-by-step reasoning (sonar-reasoning-pro)answersearch reason "prove that the square root of two is irrational"
# Deep, multi-source research (sonar-deep-research) — this one takes a whileanswersearch research "compare the failure modes of lithium and sodium batteries"
answersearch --version

Successful calls print the API's JSON response. Exit codes: 0 on success, 1 when the API call fails (including a missing key), 2 for usage errors.

MCP server

One bin serves both faces. The mcp subcommand starts a stdio MCP server:

bash
npx -y @reneturcios/answersearch mcp

MCP client configuration:

json
{  "mcpServers": {    "answersearch": {      "command": "npx",      "args": ["-y", "@reneturcios/answersearch", "mcp"],      "env": { "PERPLEXITY_API_KEY": "your-key-here" }    }  }}

Tools

ToolInputWhat it does
perplexity_askmessages (array of {role, content}, required)Conversational answer with live web search, via the sonar-pro model on the chat-completions endpoint.
perplexity_searchquery (string, required), max_results, max_tokens, max_tokens_per_page (integers, optional)Direct call to the Search API; returns its ranked results and metadata as returned upstream.
perplexity_reasonmessages (required, same shape)Analytical reasoning via sonar-reasoning-pro.
perplexity_researchmessages (required, same shape)Deep research via sonar-deep-research; expect a longer wait than the other tools.

Tool results are the upstream JSON, pretty-printed as text. Upstream failures (bad key, quota, HTTP errors) come back as tool errors carrying the status and the API's own message.

Development

bash
npm installnpm run build   # tsc -> dist/npm test        # node test runner over test/*.test.ts, no network (fake fetch fixtures)npm run dev     # run the CLI from source via tsx

License

MIT — see LICENSE.

來源:README.md,提交 760dcf4

工具

4

perplexity_ask

Ask a question and get a conversational answer backed by live web search, using the sonar-pro model.

輸入參數messages必填

perplexity_reason

Work through a hard analytical problem step by step using the sonar-reasoning-pro model.

輸入參數messages必填

perplexity_research

Run an in-depth, multi-source research pass on a topic using the sonar-deep-research model.

輸入參數messages必填

版本歷史

1
  1. v0.1.0最新Oct 31, 2026

評分

已滿足適用檢查項的 90%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分
  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分