Perplexity Advanced MCP
The Perplexity Advanced MCP server enables AI-powered query processing with the following capabilities:
Query Processing: Handles both simple and complex queries, optimizing for cost and performance
Multi-Vendor Support: Integrates with both OpenRouter and Perplexity APIs
File Attachment Support: Allows including file contents as context for more precise responses
Search Functionality: Uses the
ask_perplexitytool to search the internet and provide answersRobust Retry Mechanism: Ensures reliable API communication
Command-Line Interface: Manages configuration and operations via a user-friendly CLI
Customizable Logging: Offers flexible logging options for debugging
Provides integration with GitHub for source code hosting and version control.
Provides a tool for asking internet search queries through Perplexity AI, supporting both simple and complex queries with file attachment capabilities. Optimized for different query types to balance cost and performance.
Enables distribution of the package through the Python Package Index, allowing users to install the MCP via pip or uvx.
Implements a command-line interface using Typer for managing API key configuration and running the MCP server.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Perplexity Advanced MCPfind recent advancements in quantum computing and summarize key breakthroughs"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Perplexity Advanced MCP
Overview
Perplexity Advanced MCP is an advanced integration package that leverages the OpenRouter and Perplexity APIs to provide enhanced query processing capabilities. With an intuitive command-line interface and a robust API client, this package facilitates seamless interactions with AI models for both simple and complex queries.
Related MCP server: Perplexity MCP Server
Comparison with perplexity-mcp
While perplexity-mcp provides basic web search functionality using Perplexity AI's API, Perplexity Advanced MCP offers several additional features:
Multi-vendor Support: Supports both Perplexity and OpenRouter APIs, giving you flexibility in choosing your provider
Query Type Optimization: Distinguishes between simple and complex queries, optimizing for cost and performance
File Attachment Support: Allows including file contents as context in your queries, enabling more precise and contextual responses
Enhanced Retry Logic: Implements robust retry mechanisms for improved reliability
Overall, this is the most suitable MCP for handling codebases when integrated with editors like Cline or Cursor.
Features
Unified API Client: Supports both OpenRouter and Perplexity APIs with configurable models for handling simple and complex queries.
Command-Line Interface (CLI): Manage API key configuration and run the MCP server using Typer.
Advanced Query Processing: Incorporates file attachment processing, allowing you to include contextual data in your queries.
Robust Retry Mechanism: Utilizes Tenacity for retry logic to ensure consistent and reliable API communications.
Customizable Logging: Flexible logging configuration for detailed debugging and runtime monitoring.
Optimal AI Configuration
For the best experience with AI assistants (e.g., Cursor, Claude for Desktop), I recommend adding the following configuration to your project instructions or AI rules:
<perplexity-advanced-mcp>
<description>
Perplexity is an LLM that can search the internet, gather information, and answer users' queries.
For example, let's suppose we want to find out the latest version of Python.
1. You would search on Google.
2. Then read the top two or three results directly to verify.
Perplexity does that work for you.
To answer a user's query, Perplexity searches, opens the top search results, finds information on those websites, and then provides the answer.
Perplexity can be used with two types of queries: simple and complex. Choosing the right query type to fulfill the user's request is most important.
</description>
<simple-query>
<description>
It's cheap and fast. However, it's not suitable for complex queries. On average, it's more than 10 times cheaper and 3 times faster than complex queries.
Use it for simple questions such as "What is the latest version of Python?"
</description>
<pricing>
$1/M input tokens
$1/M output tokens
</pricing>
</simple-query>
<complex-query>
<description>
It's slower and more expensive. Compared to simple queries, it's on average more than 10 times more expensive and 3 times slower.
Use it for more complex requests like "Analyze the attached code to examine the current status of a specific library and create a migration plan."
</description>
<pricing>
$1/M input tokens
$5/M output tokens
</pricing>
</complex-query>
<instruction>
When reviewing the user's request, if you find anything unexpected, uncertain, or questionable, **and you think you can get answer from the internet**, do not hesitate to use the "ask_perplexity" tool to consult Perplexity. However, if the internet is not required to satisfy users' request, it's meaningless to ask to perplexity.
Since Perplexity is also an LLM, prompt engineering techniques are paramount.
Remember the basics of prompt engineering, such as providing clear instructions, sufficient context, and examples
Include as much context and relevant files as possible to smoothly fulfill the user's request. When adding files as attachments, make sure they are absolute paths.
</instruction>
</perplexity-advanced-mcp>This configuration helps AI assistants better understand when and how to use the Perplexity search functionality, optimizing for both cost and performance.
Usage
Installing via Smithery
To install Perplexity Advanced MCP for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @code-yeongyu/perplexity-advanced-mcp --client claudeQuick Start with uvx
The easiest way to run the MCP server is using uvx:
uvx perplexity-advanced-mcp -o <openrouter_api_key> # or -p <perplexity_api_key>You can also configure the API keys using environment variables:
export OPENROUTER_API_KEY="your_key_here"
# or
export PERPLEXITY_API_KEY="your_key_here"
uvx perplexity-advanced-mcpNote:
Providing both OpenRouter and Perplexity API keys simultaneously will result in an error
When both CLI arguments and environment variables are provided, CLI arguments take precedence
The CLI is built with Typer, ensuring a user-friendly command-line experience.
MCP Search Tool
The package includes an MCP search tool integrated via the ask_perplexity function. It supports both simple and complex queries and processes file attachments to provide additional context.
Simple Queries: Provides fast, efficient responses.
Complex Queries: Engages in detailed reasoning and supports file attachments formatted as XML.
Configuration
API Keys: Configure either the
OPENROUTER_API_KEYorPERPLEXITY_API_KEYthrough command-line options or environment variables.Model Selection: The configuration (in
src/perplexity_advanced_mcp/config.py) maps query types to specific models:Simple Queries:
perplexity/sonarComplex Queries:
perplexity/sonar-reasoning
Simple Queries:
sonar-proComplex Queries:
sonar-reasoning-pro
Development Background & Philosophy
This project emerged from my personal curiosity and experimentation. Following the recent "vibe coding" trend, over 95% of the code was written through Cline + Cursor IDE. They say "talk is cheap, show me the code" - well, with Wispr Flow's speech-to-text magic, I literally just talked and the code showed up! Most of the development was done by me saying things like "Write me the code for x y z, fix the bug here x y z." and pressing enter. Remarkably, creating this fully functional project took less than a few hours.
From project scaffolding to file structure, everything was written and reviewed through LLM. Even the GitHub Actions workflow for PyPI publishing and the release approval process were handled through Cursor. As a human developer, my role was to:
Starting and stopping the MCP server to help AI conduct proper testing
Copying and providing error logs when issues occurred
Finding and providing Python MCP SDK documentation and examples from the internet
Requesting modifications for code that didn't seem correct
In today's world where many things can be automated and replaced, I hope this MCP can help developers like you who use it to discover value beyond just writing code. May this tool assist you in becoming a new era developer who can make higher-level decisions and considerations.
Development
To contribute or modify this package:
1. Clone the Repository:
gh repo clone code-yeongyu/perplexity-advanced-mcp2. Install Dependencies:
uv sync3. Contribute:
Contributions are welcome! Please follow the existing code style and commit guidelines.
License
This project is licensed under the MIT License.
Available Tools
1 toolask_perplexityA
Perplexity is fundamentally an LLM that can search the internet, gather information, and answer users' queries.
For example, let's suppose we want to find out the latest version of Python.
1. You would search on Google.
2. Then read the top two or three results directly to verify.
Perplexity does that work for you.
To answer a user's query, Perplexity searches, opens the top search results, finds information on those websites, and then provides the answer.
Perplexity can be used with two types of queries: simple and complex. Choosing the right query type to fulfill the user's request is most important.
SIMPLE Query:
- Cheap and fast (on average, 10x cheaper and 3x faster than complex queries).
- Suitable for straightforward questions such as "What is the latest version of Python?"
- Pricing: $1/M input tokens, $1/M output tokens.
COMPLEX Query:
- Slower and more expensive (on average, 10x more expensive and 3x slower).
- Suitable for tasks requiring multiple steps of reasoning or deep analysis, such as "Analyze the attached code to examine the current status of a specific library and create a migration plan."
- Pricing: $1/M input tokens, $5/M output tokens.
Instructions:
- When reviewing the user's request, if you find anything unexpected, uncertain, or questionable, do not hesitate to use the "ask_perplexity" tool to consult Perplexity.
- Since Perplexity is also an LLM, prompt engineering techniques are paramount.
- Remember the basics of prompt engineering, such as providing clear instructions, sufficient context, and examples.
- Include as much context and relevant files as possible to smoothly fulfill the user's request.
- IMPORTANT: When adding files as attachments, you MUST use absolute paths (e.g., '/absolute/path/to/file.py'). Relative paths will not work.
Note: All queries must be in English for optimal results.
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | The query to search for | |
| query_type | Yes | Type of query to determine model selection | |
| attachment_paths | Yes | An optional list of absolute file paths to attach as context for the search query |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, so description carries full burden. It explains that Perplexity is an LLM that searches, opens results, finds info, and answers. Details query types and file attachment behavior. Lacks mention of potential inaccuracies or response format, but overall sufficiently transparent.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Description is lengthy but well-structured with sections, examples, and bullet points. Front-loaded with core purpose. Could be slightly more concise, but each section serves a purpose in guiding usage.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Covers main use cases, query types, file attachments, language requirement, and prompt engineering. No output schema, but output is implied to be an answer. Adequate for an LLM-based search tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, but description adds significant value: explains the 'simple' vs 'complex' enum with cost/speed implications, and clarifies that 'attachment_paths' must be absolute paths. Provides context for 'query' via examples.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description clearly states that Perplexity searches the internet and answers queries, with explicit differentiation between simple and complex queries. The verb 'ask' and resource 'perplexity' are well-defined, and no sibling tools exist to cause confusion.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Provides explicit guidance on when to use simple vs complex queries, including cost and speed trade-offs. Includes instructions to use the tool for uncertain queries and emphasizes English-only queries. Offers prompt engineering tips and absolute path requirements for attachments.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
Only one tool exists, so there is no possibility of confusion with other tools. The tool's purpose is clearly defined.
With a single tool, naming consistency is trivially satisfied. The name 'ask_perplexity' follows a clear verb_noun pattern in snake_case.
A single tool is borderline for a server claiming to offer a 'toolkit'. However, the tool is versatile and handles both simple and complex queries, justifying its singular existence.
The domain is to answer user queries by searching the internet. The single tool covers all necessary functionality (simple and complex queries) without obvious gaps.
Maintenance
Related MCP Connectors
Real-time web search, reasoning, and research through Perplexity's API
Enable AI assistants to perform web searches using Perplexity's Sonar Pro.
Provides AI assistants with access to Seltz's powerful Web Search capabilities.
Web search, fetch, extract, and research for AI agents. Markdown output + AI-synthesized answers.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides AI-powered search, research, and reasoning capabilities through integration with Perplexity.ai, offering three specialized tools: general conversational AI, deep research with citations, and advanced reasoning.132MIT
- AlicenseAqualityDmaintenanceIntegrates Perplexity AI's chat capabilities with real-time web search, enabling users to ask questions and receive AI-powered answers with up-to-date information and citations from verified web sources.1751Apache 2.0
- AlicenseAqualityDmaintenanceEnables advanced web search across multiple search engines (Brave, DuckDuckGo, Google, Bing, Yandex) with intelligent backend selection, full content extraction, and advanced filtering by time, language, geography, and content type.3MIT
- AlicenseBqualityDmaintenanceEnables web search using Perplexity AI's API, allowing users to search the web with optional recency filters and integration with Claude, Cursor, and other MCP clients.1MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/code-yeongyu/perplexity-advanced-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server