MCP Server for the Perplexity API.
Project description
Perplexity MCP Server
MCP Server for the Perplexity API.
Components
Tools
- ask_perplexity: Request expert programming assistance through Perplexity. Focuses on coding solutions, error debugging, and technical explanations. Returns responses with source citations and alternative suggestions.
- chat_perplexity: Maintains ongoing conversations with Perplexity AI. Creates new chats or continues existing ones with full history context. Returns chat ID for future continuation.
Key Features
-
Model Configuration via Environment Variable: Allows you to specify the Perplexity model using the
PERPLEXITY_MODELenvironment variable for flexible model selection.You can also specify
PERPLEXITY_MODEL_ASKandPERPLEXITY_MODEL_CHATto use different models for theask_perplexityandchat_perplexitytools, respectively.These will override
PERPLEXITY_MODEL. You can check which models are available on the Perplexity documentation. -
Persistent Chat History: The
chat_perplexitytool maintains ongoing conversations with Perplexity AI. Creates new chats or continues existing ones with full history context. Returns chat ID for future continuation. -
Streaming Responses with Progress Reporting: Uses progress reporting to prevent timeouts on slow responses.
Quickstart
Installation
Prerequisites
- Python 3.10+
- uvx (recommended)
Automated Installation
We provide automated installation scripts that will:
- Install uvx if not present
- Download and install mcp-starter
- Guide you through creating the configuration file
Windows Installation
- Download the
install.ps1script - Open PowerShell as Administrator
- Allow script execution and run:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force
.\install.ps1
The script will:
- Check for required dependencies (curl, PowerShell)
- Install uvx if not present
- Install mcp-starter to
%USERPROFILE%\.local\bin - Create a configuration file at
%USERPROFILE%\.config\mcp-starter\config.json - Prompt for your Perplexity API key and model preferences
Unix Installation (Linux/MacOS)
- Download the
install.shscript - Open Terminal
- Navigate to the directory containing the script
- Make the script executable and run it:
chmod +x install.sh # Only needed if downloaded directly from browser
./install.sh
The script will:
- Check for required dependencies (curl)
- Install uvx if not present
- Install mcp-starter to
$HOME/.local/bin - Create a configuration file at
$HOME/.config/mcp-starter/config.json - Prompt for your Perplexity API key and model preferences
Configure your MCP Client
To use this MCP server, you need to configure your MCP client to connect to it. The configuration method will vary depending on your specific client.
Below is an example configuration in JSON format:
"mcpServers": {
"mcp-perplexity": {
"command": "uvx",
"args": [
"mcp-perplexity"
],
"env": {
"PERPLEXITY_API_KEY": "your-perplexity-api-key",
"PERPLEXITY_MODEL": "sonar-pro",
"PERPLEXITY_MODEL_ASK": "sonar-pro",
"PERPLEXITY_MODEL_CHAT": "sonar-reasoning-pro",
"DB_PATH": "path/to/custom.db"
}
}
}
Important notes:
- Replace
"your-perplexity-api-key"with your actual Perplexity API key - Environment variables configuration:
PERPLEXITY_MODEL: Default model for both toolsPERPLEXITY_MODEL_ASK: Overrides default model forask_perplexitytoolPERPLEXITY_MODEL_CHAT: Overrides default model forchat_perplexitytoolDB_PATH: Custom path for SQLite chat history database (default: chats.db)
- Consult the Perplexity model docs for available models
- Use the mcp-starter script to easily add this MCP server to Cursor IDE.
Using Smithery CLI
Smithery is a CLI tool that allows you to easily add MCP servers to your Cursor IDE.
Replace the values of the configuration object with your own values.
npx -y @smithery/cli@latest run @daniel-lxs/mcp-perplexity --config "{\"perplexityApiKey\":\"abc\",\"perplexityModel\":\"sonar-pro\", \"modelAsk\":\"sonar-pro\", \"modelChat\":\"sonar-reasoning-pro\", \"dbPath\":\"path/to/custom.db\"}"
perplexityApiKey:PERPLEXITY_API_KEYperplexityModel:PERPLEXITY_MODELmodelAsk:PERPLEXITY_MODEL_ASKmodelChat:PERPLEXITY_MODEL_CHATdbPath:DB_PATH
Usage
ask_perplexity
The ask_perplexity tool is used for specific questions, this tool doesn't maintain a chat history, every request is a new chat.
The tool will return a response from Perplexity AI using the PERPLEXITY_MODEL_ASK model if specified, otherwise it will use the PERPLEXITY_MODEL model.
chat_perplexity
The chat_perplexity tool is used for ongoing conversations, this tool maintains a chat history.
A chat is identified by a chat ID, this ID is returned by the tool when a new chat is created. Chat IDs look like this: wild-horse-12.
This tool is useful for debugging, research, and any other task that requires a chat history.
The tool will return a response from Perplexity AI using the PERPLEXITY_MODEL_CHAT model if specified, otherwise it will use the PERPLEXITY_MODEL model.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_perplexity-0.3.4.tar.gz.
File metadata
- Download URL: mcp_perplexity-0.3.4.tar.gz
- Upload date:
- Size: 18.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a81d0719470d126b199edcf95fac7067a2fd30a0dfbc3316fdbd8e503636a58
|
|
| MD5 |
3f9b0ec520a732688c07fd66d894f99f
|
|
| BLAKE2b-256 |
32f62191b27b83bd19532222737e5be247fa64a10c68979e3c71b94f90cedc9b
|
Provenance
The following attestation bundles were made for mcp_perplexity-0.3.4.tar.gz:
Publisher:
pypi-publish.yml on daniel-lxs/mcp-perplexity
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_perplexity-0.3.4.tar.gz -
Subject digest:
9a81d0719470d126b199edcf95fac7067a2fd30a0dfbc3316fdbd8e503636a58 - Sigstore transparency entry: 171100747
- Sigstore integration time:
-
Permalink:
daniel-lxs/mcp-perplexity@6fa845bb4451613a1650d638d9ef574881811abf -
Branch / Tag:
refs/heads/main - Owner: https://github.com/daniel-lxs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@6fa845bb4451613a1650d638d9ef574881811abf -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file mcp_perplexity-0.3.4-py3-none-any.whl.
File metadata
- Download URL: mcp_perplexity-0.3.4-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2aac2b43e016fa0e52b6781d668a1fadb423292412f378322a10186b5f4886d4
|
|
| MD5 |
1c45c6e1e9ab9e095ad9a94163a1aa00
|
|
| BLAKE2b-256 |
ac3ff75a0744e0c1335b550445345328c2fbf4cba31e32e64b642901fe97ea33
|
Provenance
The following attestation bundles were made for mcp_perplexity-0.3.4-py3-none-any.whl:
Publisher:
pypi-publish.yml on daniel-lxs/mcp-perplexity
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_perplexity-0.3.4-py3-none-any.whl -
Subject digest:
2aac2b43e016fa0e52b6781d668a1fadb423292412f378322a10186b5f4886d4 - Sigstore transparency entry: 171100752
- Sigstore integration time:
-
Permalink:
daniel-lxs/mcp-perplexity@6fa845bb4451613a1650d638d9ef574881811abf -
Branch / Tag:
refs/heads/main - Owner: https://github.com/daniel-lxs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@6fa845bb4451613a1650d638d9ef574881811abf -
Trigger Event:
workflow_dispatch
-
Statement type: