modelcontextprotocol
by: ppl-ai
A Model Context Protocol Server connector for Perplexity API, to enable web search without leaving the MCP ecosystem.
📌Overview
Purpose: To provide a real-time, web-wide research tool for Claude by integrating the Sonar API through an MCP server implementation.
Overview: The Perplexity Ask MCP Server enables users to interact with the Sonar API, allowing Claude to conduct live web searches and access a broader range of information seamlessly.
Key Features:
-
Real-Time Web Searches: Engage with the Sonar API for up-to-date information retrieval during conversations, enhancing the user experience with relevant and current data.
-
Easy Configuration: Simple setup process involving cloning the repository, obtaining an API key, and configuring the Claude desktop application, making it accessible for various users and applications.
Perplexity Ask MCP Server
An MCP server implementation that integrates the Sonar API to provide Claude with unparalleled real-time, web-wide research.
Tools
- perplexity_ask
- Engage in a conversation with the Sonar API for live web searches.
- Inputs:
messages
(array): An array of conversation messages.- Each message must include:
role
(string): The role of the message (e.g.,system
,user
,assistant
).content
(string): The content of the message.
- Each message must include:
Configuration
Step 1: Clone and Install
Clone this repository:
git clone git@github.com:ppl-ai/modelcontextprotocol.git
Navigate to the perplexity-ask
directory and install the necessary dependencies:
cd modelcontextprotocol/perplexity-ask && npm install
Step 2: Get a Sonar API Key
- Sign up for a Sonar API account at https://docs.perplexity.ai/guides/getting-started.
- Generate your API key from the developer dashboard.
- Set the API key in your environment as
PERPLEXITY_API_KEY
.
Step 3: Configure Claude Desktop
-
Download Claude desktop from https://claude.ai/download.
-
Add the following to your
claude_desktop_config.json
:
{
"mcpServers": {
"perplexity-ask": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"PERPLEXITY_API_KEY",
"mcp/perplexity-ask"
],
"env": {
"PERPLEXITY_API_KEY": "YOUR_API_KEY_HERE"
}
}
}
}
You can also use NPX configuration:
{
"mcpServers": {
"perplexity-ask": {
"command": "npx",
"args": [
"-y",
"server-perplexity-ask"
],
"env": {
"PERPLEXITY_API_KEY": "YOUR_API_KEY_HERE"
}
}
}
}
Access the file using:
vim ~/Library/Application\ Support/Claude/claude_desktop_config.json
Step 4: Build the Docker Image
Build the Docker image:
docker build -t mcp/perplexity-ask:latest -f Dockerfile .
Step 5: Testing
After setup, check if Claude for Desktop detects the provided tools by looking for the hammer icon. Clicking it will show tools from the Filesystem MCP Server, indicating the integration is active.
This means Claude can now use Perplexity Ask as a tool, functioning similarly to the Perplexity web app.
Step 6: Advanced Parameters
The default search parameters are used in index.ts
. Modify any search parameter directly in this script as needed. Refer to the official API documentation for details: https://docs.perplexity.ai/api-reference/chat-completions.
Troubleshooting
For issues, refer to the Claude documentation troubleshooting guide at https://modelcontextprotocol.io/docs/tools/debugging. For additional support, contact api@perplexity.ai or file a bug at https://github.com/ppl-ai/api-discussion/issues.
Cursor Integration
You can also use this MCP server with Cursor or any other app supporting MCP.
Step 1: Navigate to your Cursor settings.
Step 2: Go to the MCP directory and click on "Add new global MCP server".
Step 3: Insert the MCP Server Configuration from above.
After this, the application should appear in your available tools.
License
This MCP server is licensed under the MIT License. You are free to use, modify, and distribute the software under the terms of the MIT License. See the LICENSE file in the project repository for details.