jrajasekera/perplexica-mcp
If you are the rightful owner of perplexica-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
The Perplexica MCP Server is a minimal Model Context Protocol (MCP) tool server that facilitates high-quality web and academic searches through Perplexica's API, providing synthesized answers and sources.
Perplexica MCP Server
A minimal Model Context Protocol (MCP) tool server that exposes perplexica.search, a proxy to Perplexica’s /api/search. It lets local LLM agents (e.g., Codex CLI, Claude Desktop, Open WebUI) perform high-quality web/academic searches and receive a synthesized answer plus sources.
What is Perplexica?
Perplexica is an open‑source, privacy‑respecting, AI‑powered metasearch engine. It orchestrates search (web, academic, YouTube, Reddit, Wolfram Alpha, etc.), retrieves and ranks results, and uses LLMs to synthesize clear, source‑grounded answers. You can self‑host it or connect to a remote instance.
TL;DR (Quickstart)
- Prerequisites
- Node.js ≥ 18.17
- pnpm (recommended):
npm i -g pnpm - A running Perplexica instance (default assumed at
http://localhost:3000).
- Clone, install, build
git clone https://github.com/jrajasekera/perplexica-mcp.git
cd perplexica-mcp
pnpm install
pnpm build
- Run with MCP Inspector (fastest way to try)
- One‑liner (after build):
pnpm dlx @modelcontextprotocol/inspector -- node dist/server.js
- Or run in dev (TypeScript, no build):
pnpm dlx @modelcontextprotocol/inspector -- node --loader tsx src/server.ts
- Optional: use a config file
mcp.jsonfor cleaner env/args:
{
"mcpServers": {
"perplexica": {
"type": "stdio",
"command": "node",
"args": ["dist/server.js"],
"env": { "PERPLEXICA_BASE_URL": "http://localhost:3000" }
}
}
}
Run Inspector with config:
pnpm dlx @modelcontextprotocol/inspector --config ./mcp.json --server perplexica
- Test a call in Inspector
Use this input for the perplexica.search tool:
{
"query": "Latest CUDA updates in 2025",
"focusMode": "webSearch"
}
You should see a final answer and a numbered Sources list.
What this server provides
- Tool:
perplexica.search(stdio transport) - Runtime: Node, TypeScript, ESM (NodeNext), pnpm
- HTTP timeouts via
AbortController(default 120s) - Clean result text containing a synthesized answer plus formatted sources
This MCP server simply forwards requests to PERPLEXICA_BASE_URL/api/search, handling timeouts and surfacing any upstream errors clearly.
Using in your agent
Add a stdio MCP server entry in your agent’s configuration that launches node dist/server.js and sets PERPLEXICA_BASE_URL if it differs from the default.
Example (generic MCP config shape):
{
"mcpServers": {
"perplexica": {
"type": "stdio",
"command": "node",
"args": ["dist/server.js"],
"env": { "PERPLEXICA_BASE_URL": "http://localhost:3000" }
}
}
}
After starting your agent, call the perplexica.search tool with the input schema below.
Tool API
Tool name: perplexica.search
Input (Zod shape):
query(string, required): The user’s question/search.focusMode(enum):webSearch | academicSearch | writingAssistant | wolframAlphaSearch | youtubeSearch | redditSearch(defaultwebSearch).optimizationMode(enum):speed | balanced(defaultbalanced).baseUrl(string): Perplexica base URL (defaults toPERPLEXICA_BASE_URLorhttp://localhost:3000).chatModel(object, optional):{ provider, name, customOpenAIBaseURL?, customOpenAIKey? }.embeddingModel(object, optional):{ provider, name }.systemInstructions(string, optional): Extra guidance for Perplexica.history(array, optional): Tuples like[role, text][]where role ∈human | assistant.stream(boolean): Currently returns final result only (defaultfalse).timeoutMs(number): HTTP abort timeout (default 120000).
Output:
- A single text block containing the synthesized answer followed by a numbered Sources list (
1. Title: URL).
Environment variables
PERPLEXICA_BASE_URL(defaulthttp://localhost:3000): Where to reach Perplexica.MCP_REQUEST_TIMEOUT_MS(default120000): Default HTTP timeout used by the tool. Lower this to avoid Inspector‑side timeouts on slow searches.
Development
- Install deps:
pnpm install - Type‑check & build:
pnpm build - Live dev (no build):
pnpm dev - Start (built):
pnpm start(runsnode dist/server.js)
Recommended workflow:
# 1) Install and build
pnpm install && pnpm build
# 2) Try it fast via Inspector
pnpm dlx @modelcontextprotocol/inspector -- node dist/server.js
# 3) Iterate in TypeScript
pnpm dlx @modelcontextprotocol/inspector -- node --loader tsx src/server.ts
Project notes:
- ESM only (NodeNext). Uses
async/awaitandAbortControllerfor timeouts. - Input validation is done with Zod; the MCP inspector UI is driven by the Zod shape.
- Source links are formatted and sorted as
1. **Title**: URL.
Troubleshooting
-
Inspector shows no input boxes / sends
{}- Ensure the server uses
registerToolwith a Zod shape and restart the Inspector so it re‑fetches the schema.
- Ensure the server uses
-
--server requires --configerror- Either run Inspector without
--serverand pass the command directly, or provide--config mcp.json --server perplexica.
- Either run Inspector without
-
Inspector says:
Command not found, transports removed- Inspector couldn’t spawn
pnpm. Workarounds: build then run withnode dist/server.js, use an absolute path to pnpm, or start Inspector with no command and connect via UI.
- Inspector couldn’t spawn
-
Type errors about
processor missing DOM types- Ensure
@types/nodeis installed andtsconfig.jsonincludes"types": ["node"], "lib": ["ES2022", "DOM"].
- Ensure
-
Zod type mismatch (
ZodRawShapevsz.object)registerToolexpects a Zod shape (record of Zod types), not az.object(...)instance.
-
Multiple Zod copies in the tree
- Pin/dedupe via
pnpm.overridesforzodthenpnpm install && pnpm dedupe.
- Pin/dedupe via
-
Inspector timeouts on slow searches
- Lower the tool input
timeoutMs(e.g.,20000) or setMCP_REQUEST_TIMEOUT_MSbelow the Inspector’s timeout so the tool returns a clear error.
- Lower the tool input
-
Can’t reach Perplexica
- Verify
PERPLEXICA_BASE_URLand that your Perplexica instance is running and accessible (defaulthttp://localhost:3000).
- Verify
Example: quick invocation
Inside Inspector, call perplexica.search with:
{
"query": "Best 2025 LLM eval threads",
"focusMode": "redditSearch",
"optimizationMode": "balanced"
}
Expect a concise answer followed by a numbered list of source links.
Why this exists
MCP makes it easy for tools to interoperate across AI agents. This server offers a small, audited surface area that cleanly bridges local agents to Perplexica’s powerful search and synthesis, without leaking secrets or adding heavy dependencies.