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 分