# modelcontextprotocol

> MCP Server

This repository provides an MCP server implementation, "perplexity-ask," that integrates the Sonar API, enabling Claude to perform real-time web research and engage in conversations with live web searches.

## Overview

- **Category:** AI
- **Language:** JavaScript
- **Stars:** 2519
- **Forks:** 68
- **Owner:** ppl-ai
- **GitHub:** https://github.com/ppl-ai/modelcontextprotocol
- **Created:** 2025-03-10T19:44:02+00:00
- **Updated:** 2025-03-28T23:30:49+00:00
- **Source:** https://model-context-protocol.com/servers/model-context-protocol-perplexity-web-search

## Setup

## Setup

**Step 1:**

Clone the repository:

```bash
git clone git@github.com:ppl-ai/modelcontextprotocol.git
```

Navigate to the `perplexity-ask` directory and install dependencies:

```bash
cd modelcontextprotocol/perplexity-ask && npm install
```

**Step 2: Get a Sonar API Key**

1. Sign up for a [Sonar API account](https://docs.perplexity.ai/guides/getting-started).
2. Follow the account setup instructions and generate your API key from the developer dashboard.
3. Set the API key in your environment as `PERPLEXITY_API_KEY`.

**Step 3: Configure Claude Desktop**

1. Download Claude desktop [here](https://claude.ai/download).
2. Add the following to your `claude_desktop_config.json`:

```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"
      }
    }
  }
}
```

NPX:

```json
{
  "mcpServers": {
    "perplexity-ask": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-perplexity-ask"
      ],
      "env": {
        "PERPLEXITY_API_KEY": "YOUR_API_KEY_HERE"
      }
    }
  }
}
```

You can access the file using:

```bash
vim ~/Library/Application\ Support/Claude/claude_desktop_config.json
```

**Step 4: Build the Docker Image**

Docker build:

```bash
docker build -t mcp/perplexity-ask:latest -f Dockerfile .
```

**Step 5: Testing**

Verify Claude for Desktop picks up the exposed tools by looking for the hammer icon and checking the available integrations.

**Step 6: Advanced parameters**

Modify search parameters in the `index.ts` script, referring to the official [API documentation](https://docs.perplexity.ai/api-reference/chat-completions).

## Tools

## Available Tools

		1. **perplexity_ask** (Engage in a conversation with the Sonar API for live web searches.)

