This MCP server provides an advanced integration for the Perplexity and OpenRouter APIs, allowing you to perform simple and complex queries with AI models. It's designed for optimal performance when handling codebases and can be easily integrated with code editors like Cline or Cursor.
For Claude Desktop users, the easiest installation method is via Smithery:
npx -y @smithery/cli install @code-yeongyu/perplexity-advanced-mcp --client claude
To run the MCP server using uvx:
uvx perplexity-advanced-mcp -o <openrouter_api_key> # or -p <perplexity_api_key>
You can also configure API keys using environment variables:
export OPENROUTER_API_KEY="your_key_here"
# or
export PERPLEXITY_API_KEY="your_key_here"
uvx perplexity-advanced-mcp
Important notes:
The MCP server supports two types of queries:
For optimal integration with AI assistants (Cursor, Claude for Desktop), add this configuration to your project instructions:
<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>
The server uses specific models for different query types:
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.