Skip to main content

MCP Server for the Perplexity API.

Project description

Perplexity MCP Server

MCP Server for the Perplexity API.

smithery badge PyPI Publish

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_MODEL environment variable for flexible model selection.

    You can also specify PERPLEXITY_MODEL_ASK and PERPLEXITY_MODEL_CHAT to use different models for the ask_perplexity and chat_perplexity tools, respectively.

    These will override PERPLEXITY_MODEL. You can check which models are available on the Perplexity documentation.

  • Persistent Chat History: The chat_perplexity tool 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

Installing uvx

Windows Installation

Open PowerShell as Administrator and run:

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

Windows Installation Notes:

  • Ensure Python 3.10+ is installed and added to PATH

Unix Installation (Linux/MacOS)

Run the following command in your terminal:

curl -LsSf https://astral.sh/uv/install.sh | sh

Unix Installation Notes:

  • The script will install uvx to ~/.cargo/bin by default
  • You may need to restart your terminal session after installation

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 tools
    • PERPLEXITY_MODEL_ASK: Overrides default model for ask_perplexity tool
    • PERPLEXITY_MODEL_CHAT: Overrides default model for chat_perplexity tool
    • DB_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 (Currently not working for MacOS).

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_KEY
  • perplexityModel: PERPLEXITY_MODEL
  • modelAsk: PERPLEXITY_MODEL_ASK
  • modelChat: PERPLEXITY_MODEL_CHAT
  • dbPath: DB_PATH

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_perplexity-0.3.2.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_perplexity-0.3.2-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file mcp_perplexity-0.3.2.tar.gz.

File metadata

  • Download URL: mcp_perplexity-0.3.2.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for mcp_perplexity-0.3.2.tar.gz
Algorithm Hash digest
SHA256 2913f7302cb6142e7e4c32935eca4668f8dc7cc5dbe3c39f33d01658c206d6e8
MD5 dbbdc991014a89bffb741d3c6bed3dd8
BLAKE2b-256 3628ecd523c10fe43029c5c52125e999e9b84cecd71e27c68480b6431f47fb3a

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_perplexity-0.3.2.tar.gz:

Publisher: pypi-publish.yml on daniel-lxs/mcp-perplexity

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcp_perplexity-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: mcp_perplexity-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for mcp_perplexity-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c4ed181295f945c7c1e5291602abd3581cc4af87efd5956ecd0e65b0e9c33590
MD5 0e515ae56ced3d578c9bad8e356c4637
BLAKE2b-256 1917314d1bd8d96cd2ebe154a7dc4d800b447fe4cb9f4bc166c3a068764dce65

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_perplexity-0.3.2-py3-none-any.whl:

Publisher: pypi-publish.yml on daniel-lxs/mcp-perplexity

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page