Answer any question with live web search, citations, and AI reasoning — all in one call.
A Model Context Protocol (MCP) server that exposes Perplexity AI's API for real-time web search and conversational queries with cited sources.
The Perplexity MCP Server provides AI-powered web search with grounded, citation-backed responses:
- Query the live web and get LLM-synthesized answers with source references
- Control response length, temperature, and the underlying search model
- Browse available Perplexity models to choose the right capability for each task
Perfect for:
- Giving AI assistants access to current events, news, and real-time information
- Answering research questions that require up-to-date facts beyond the model's training cutoff
- Enriching AI workflows with cited, verifiable web sources
health_check — Check server readiness
Returns a status object confirming the server is running and reachable.
Inputs: (none)
Output:
{
"status": "ok",
"server": "CL Perplexity MCP Server"
}search — Search the web with Perplexity AI
Sends a query to Perplexity's online search models and returns an LLM-generated answer with citations from live web sources.
Inputs:
- `query` (string, required) — Search query to look up on the web
- `model` (string, optional) — Model to use (default: llama-3.1-sonar-small-128k-online)
- `max_tokens` (integer, optional) — Maximum tokens in the response, 1–4096
- `temperature` (float, optional) — Sampling temperature 0–2; higher = more creative (default: model default)
Output:
{
"success": true,
"query": "latest AI research papers 2025",
"response": "Recent AI research has focused on...",
"model": "llama-3.1-sonar-small-128k-online",
"usage": {
"prompt_tokens": 12,
"completion_tokens": 320,
"total_tokens": 332
}
}get_models — List available Perplexity models
Returns all models available through the Perplexity API, grouped into online (web search) and offline (non-search) categories.
Inputs: (none)
Output:
{
"success": true,
"total_models": 6,
"online_models": [
"llama-3.1-sonar-small-128k-online",
"llama-3.1-sonar-large-128k-online",
"llama-3.1-sonar-huge-128k-online"
],
"other_models": [
"llama-3.1-sonar-small-128k-chat",
"llama-3.1-sonar-large-128k-chat"
],
"all_models": [...]
}Model Selection
Online models (include live web search):
llama-3.1-sonar-small-128k-online— Fast, cost-efficient; default for web searchllama-3.1-sonar-large-128k-online— Higher quality answers, more thorough searchllama-3.1-sonar-huge-128k-online— Best quality, most comprehensive; highest cost
Use get_models to retrieve the current full list — new models are added periodically.
Generation Parameters
temperature— Controls randomness;0.0for focused factual answers,1.0+for creative responses (range: 0–2)max_tokens— Caps response length; useful for controlling cost and latency (range: 1–4096)
Steps
- Go to the Perplexity API Settings
- Sign in or create a Perplexity account
- Under API Keys, click + Generate
- Copy the generated key — store it securely, it will not be shown again
Perplexity API usage is billed per request based on the model and token count. Online models consume additional credits for web search.
Missing or Invalid Headers
- Cause: API key not provided in request headers or incorrect format
- Solution:
- Verify
Authorization: Bearer YOUR_API_KEYandX-Mewcp-Credential-Id: CREDENTIAL-IDheaders are present - Check API key is active in your MewCP account
- Verify
Insufficient Credits
- Cause: API calls have exceeded your request limits
- Solution:
- Check credit usage in your Curious Layer dashboard
- Upgrade to a paid plan or add credits for higher limits
- Contact support for credit adjustments
Credential Not Connected
- Cause: No Perplexity credential linked to your account
- Solution:
- Go to Credentials in your MewCP dashboard
- Add your Perplexity API key
- Retry the request with the correct
X-Mewcp-Credential-Idheader
Malformed Request Payload
- Cause: JSON payload is invalid or missing required fields
- Solution:
- Validate JSON syntax before sending
- Ensure the
queryparameter is included and is a non-empty string - Check that
temperatureis between 0.0 and 2.0 andmax_tokensis between 1 and 4096
Server Not Found
- Cause: Incorrect server name in the API endpoint
- Solution:
- Verify endpoint format:
{server-name}/mcp/{tool-name} - Use correct server name from documentation
- Check available servers in your Curious Layer account
- Verify endpoint format:
Perplexity API Error
- Cause: Upstream Perplexity API returned an error
- Solution:
- Check Perplexity service status at Perplexity Status Page
- Verify your API key has sufficient credits for the selected model
- Review the error message for specific details (e.g. rate limit exceeded, invalid model ID)
Resources
- Perplexity API Documentation — Official API reference
- Perplexity Model Cards — Model capabilities and pricing
- FastMCP Docs — FastMCP specification
- FastMCP Credentials — FastMCP Credentials package for credential handling