The Perplexity MCP Server implements Anthropic's Model Context Protocol (MCP) to enable Claude to interact with Perplexity's language models. This server acts as a bridge, allowing Claude to use Perplexity AI's capabilities through tool integration for enhanced AI interactions.
The server provides two main tools:
Advanced chat completion tool with full message history support.
{
"name": "perplexity_chat",
"description": "Generate a chat completion using Perplexity AI",
"parameters": {
"model": "string (optional) - One of: llama-3.1-sonar-small-128k-online, llama-3.1-sonar-large-128k-online, llama-3.1-sonar-huge-128k-online",
"messages": "array of {role, content} objects - The conversation history",
"temperature": "number (optional) - Sampling temperature between 0-2"
}
}
Simplified single-query interface for quick questions.
{
"name": "perplexity_ask",
"description": "Send a simple query to Perplexity AI",
"parameters": {
"query": "string - The question or prompt to send",
"model": "string (optional) - One of: llama-3.1-sonar-small-128k-online, llama-3.1-sonar-large-128k-online, llama-3.1-sonar-huge-128k-online"
}
}
Follow these steps to install the Perplexity MCP Server:
Clone the repository:
git clone https://github.com/yourusername/perplexity-mcp-server.git
cd perplexity-mcp-server
Install dependencies:
npm install
Create a .env
file with your Perplexity API key:
PERPLEXITY_API_KEY=your-api-key-here
Build the project:
npm run build
To integrate this server with Claude Desktop, update your claude_desktop_config.json
file:
{
"mcpServers": {
"perplexity": {
"command": "node",
"args": ["path\\to\\perplexity-mcp-server\\dist\\index.js"],
"env": {
"PERPLEXITY_API_KEY": "YOUR_PERPLEXITY_API_KEY"
}
}
}
}
The configuration file is typically located at:
%APPDATA%/Claude/config/claude_desktop_config.json
~/Library/Application Support/Claude/config/claude_desktop_config.json
~/.config/Claude/config/claude_desktop_config.json
If you encounter issues with the server:
claude_desktop_config.json
is correctnpm run build
)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.