Perplexity MCP Server
This Perplexity MCP Server is a Node.js implementation of Anthropic's Model Context Protocol that enables Claude to interact with Perplexity AI's language models through two main tools:
perplexity_chat: Generate advanced chat completions with full message history support, temperature control, and access to models like
mixtral-8x7b-instruct,codellama-34b-instruct,sonar-small-chat, andsonar-small-online.perplexity_ask: Send simple, single-query requests to models including
llama-3.1-sonar-small-128k-online,llama-3.1-sonar-large-128k-online, andllama-3.1-sonar-huge-128k-online.
The server is type-safe, modular, secure, and can be integrated with Claude Desktop through configuration.
Enables interaction with Perplexity AI's language models, providing capabilities to generate chat completions with full message history support and send simple queries for quick answers using various Llama-based models.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Perplexity MCP Server explain quantum computing in simple terms"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Perplexity MCP Server
Overview
The Perplexity MCP Server is a Node.js implementation of Anthropic's Model Context Protocol (MCP) that enables Claude to interact with Perplexity's language models. This server provides a secure bridge between Claude and Perplexity AI's capabilities, allowing for enhanced AI interactions through tool use.
Related MCP server: Perplexity MCP Server
Available Tools
The server currently implements two main tools:
1. perplexity_chat
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"
}
}2. perplexity_ask
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"
}
}Installation
Clone the repository:
git clone https://github.com/yourusername/perplexity-mcp-server.git cd perplexity-mcp-serverInstall dependencies:
npm installCreate
.envfile:PERPLEXITY_API_KEY=your-api-key-hereBuild the project:
npm run build
Claude Desktop Configuration
To add this server to Claude Desktop, update your claude_desktop_config.json:
{
"mcpServers": {
//more servers...
"perplexity": {
"command": "node",
"args": ["path\\to\\perplexity-mcp-server\\dist\\index.js"],
"env": {
"PERPLEXITY_API_KEY": "YOUR_PERPLEXITY_API_KEY"
}
}
//more servers...
}
}The configuration file is typically located at:
Windows:
%APPDATA%/Claude/config/claude_desktop_config.jsonmacOS:
~/Library/Application Support/Claude/config/claude_desktop_config.jsonLinux:
~/.config/Claude/config/claude_desktop_config.json
Development
Start the development server with automatic recompilation:
npm run devThe server uses TypeScript and implements the MCP protocol using the @modelcontextprotocol/sdk package.
Architecture
Core Components
PerplexityServer Class
Implements MCP server protocol
Handles tool registration and execution
Manages error handling and server lifecycle
Tools System
Modular tool definitions
Type-safe tool handlers
Structured input validation
Technical Details
Built with TypeScript for type safety
Uses
@modelcontextprotocol/sdkfor MCP implementationCommunicates via stdio transport
Environment-based configuration
Error Handling
The server implements comprehensive error handling:
API error reporting
Invalid tool requests handling
Connection error management
Process signal handling
Dependencies
@modelcontextprotocol/sdk: ^1.0.3dotenv: ^16.4.7isomorphic-fetch: ^3.0.0
Contributing
Fork the repository
Create your feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add some amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
Security
API keys are managed through environment variables
Input validation for all tool parameters
Error messages are sanitized before output
Process isolation through MCP protocol
License
This project is licensed under the ISC License.
Troubleshooting
Common issues and solutions:
Server Not Found
Verify the path in
claude_desktop_config.jsonis correctEnsure the server is built (
npm run build)Check if Node.js is in your PATH
Authentication Errors
Verify your Perplexity API key in .env
Check if the API key has the required permissions
Tool Execution Errors
Verify the tool parameters match the schema
Check network connectivity
Review server logs for detailed error messages
Available Tools
2 toolsperplexity_askB
Send a simple query to Perplexity AI
Inputs: query (required), model.
perplexity_chatC
Generate a chat completion using Perplexity AI
Inputs: messages (required), model, temperature.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
Both tools involve querying Perplexity AI, with only subtle differences in description ('simple query' vs 'chat completion'). An agent would likely struggle to decide which to use, as the boundaries are unclear.
Both tools follow a consistent 'perplexity_<verb>' pattern. The verbs 'ask' and 'chat' are different but semantically related, and no mixing of naming conventions is present.
With only 2 tools, the server feels minimal for a service like Perplexity AI, which typically offers more nuanced capabilities (e.g., different models, streaming). However, it covers basic query and chat needs.
The tool surface covers basic query and chat interactions but lacks operations such as specifying model parameters, context handling, or result streaming. This may limit agent flexibility.
Related MCP Connectors
Persistent context for Claude. Your AI always knows your projects and next actions across sessions.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Agent personas for Claude. 16 tools, 13 personas, 3 workflows. Zero extra API cost. Free.
Create projects, nodes, and tasks in UluP Spaces by conversation with Claude.
Related MCP Servers
- AlicenseBqualityDmaintenanceA Node.js/TypeScript implementation of a Model Context Protocol server for the Deepseek R1 language model, optimized for reasoning tasks with a large context window and fully integrated with Claude Desktop.168MIT
- AlicenseNot gradedqualityFmaintenanceA custom Model Context Protocol implementation that integrates Perplexity AI with Claude Desktop, allowing users to access Perplexity's AI models for both single questions and multi-turn conversations.34 npmISC
- AlicenseNot gradedqualityDmaintenanceInterfaces with the Perplexity AI API to provide advanced question answering capabilities through the standardized Model Context Protocol, supporting multiple Perplexity models.MIT
- AlicenseBqualityDmaintenanceA Node.js implementation of the Kagi Model Context Protocol server that enables Claude AI to search the web and summarize documents, videos, and audio using Kagi's APIs.217 npmMIT