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.
Comparison with [perplexity-mcp](https://github.com/jsonallen/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:
Note: Code block was split into 2 parts due to size limits.
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:
Quick Start with [uvx](https://docs.astral.sh/uv/guides/tools/)
The easiest way to run the MCP server is using uvx:
You can also configure the API keys using environment variables:
Note:
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.
Complex Queries: Engages in detailed reasoning and supports file attachments formatted as XML.
Configuration
API Keys: Configure either the OPENROUTER_API_KEY or PERPLEXITY_API_KEY through command-line options or environment variables.
Model Selection: The configuration (in src/perplexity_advanced_mcp/config.py) maps query types to specific models:
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:**
2. **Install Dependencies:**
3. **Contribute:**
Contributions are welcome! Please follow the existing code style and commit guidelines.
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.
Comparison with [perplexity-mcp](https://github.com/jsonallen/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:
Note: Code block was split into 2 parts due to size limits.
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:
Quick Start with [uvx](https://docs.astral.sh/uv/guides/tools/)
The easiest way to run the MCP server is using uvx:
You can also configure the API keys using environment variables:
Note:
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.
Complex Queries: Engages in detailed reasoning and supports file attachments formatted as XML.
Configuration
API Keys: Configure either the OPENROUTER_API_KEY or PERPLEXITY_API_KEY through command-line options or environment variables.
Model Selection: The configuration (in src/perplexity_advanced_mcp/config.py) maps query types to specific models:
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:**
2. **Install Dependencies:**
3. **Contribute:**
Contributions are welcome! Please follow the existing code style and commit guidelines.