Interfaces with the Perplexity AI API to provide advanced question answering capabilities through the standardized Model Context Protocol, supporting multiple Perplexity models.
An MCP server implementation for interfacing with the Perplexity AI API, providing advanced question answering capabilities through the standardised Model Context Protocol.
npm install
Create a .env
file with the following variables:
PERPLEXITY_API_KEY=your_api_key_here
Run the server:
npm start
The server exposes the following tools:
perplexity_ask
- Send a direct question to Perplexity AIperplexity_search
- Perform a search query with Perplexity AIBoth tools support the following Perplexity models:
sonar-reasoning
(default) - Perplexity's reasoning-focused model, best for general questionssonar-pro
- Enhanced model with improved capabilities for professional use casessonar-deep-research
- Specialised for in-depth research and complex queriesTo specify a model when using the tools, include the model
parameter in your request:
Ask Perplexity using sonar-deep-research: What are the latest advancements in quantum computing?
You can also customise the system prompt and maximum token count:
Search with Perplexity using sonar-pro with system prompt "You are a helpful research assistant" and max tokens 2000: Latest developments in renewable energy
The server follows the MCP specification for tool responses:
{ content: [ { type: "text", text: "Response content from Perplexity AI" } ], isError: false // or true if an error occurred }
Build the server:
npm run build
Open Windsurf and navigate to Settings
Find the "AI Settings" or "Model Context Protocol" section
Add a new MCP server with the following details:
index.js
filePERPLEXITY_API_KEY=your_api_key_here
Enable the server and restart Windsurf if necessary
Here's an example configuration for the mcp_config.json
file:
"perplexity-ask": { "command": "node", "args": [ "/path/to/perplexity-insight-MCP/dist/index.js" ], "cwd": "/path/to/perplexity-insight-MCP", "env": { "PERPLEXITY_API_KEY": "pplx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" } }
Replace /path/to/perplexity-insight-MCP
with the actual path to your installation directory and use your actual Perplexity API key.
For local development:
npm run dev
If you encounter issues with the MCP server:
.env
fileMIT
Discover shared experiences
Shared threads will appear here, showcasing real-world applications and insights from the community. Check back soon for updates!