Navigation
MCP Perplexity Server: High-Performance Real-Time APIs - MCP Implementation

MCP Perplexity Server: High-Performance Real-Time APIs

MCP Perplexity Server delivers high-performance API solutions with TypeScript, supporting stdio and SSE for real-time, scalable enterprise workloads.

Developer Tools
4.2(64 reviews)
96 saves
44 comments

82% of users reported increased productivity after just one week

About MCP Perplexity Server

What is MCP Perplexity Server: High-Performance Real-Time APIs?

MCP Perplexity Server is a versatile API gateway designed to simplify interaction with Perplexity models. It exposes real-time endpoints that allow users to query advanced AI models like Sonar and Sonar Pro through standardized protocols. Built with flexibility in mind, this server supports both stdio and Server-Sent Events (SSE) transport mechanisms, making it compatible with diverse integration needs.

How to Use MCP Perplexity Server: High-Performance Real-Time APIs?

Getting Started with Docker

  1. Create a docker-compose.yml file with the following content:
  2. 
    services:
      mcp-sse-server:
        image: ghcr.io/sibbl/mcp-perplexity-api:main
        ports:
          - "8080:8080"
        restart: unless-stopped
        environment:
          - MCP_PERPLEXITY_API_KEY=YOUR_API_KEY_HERE
        
  3. Run docker compose up to start the server.

Local Node.js Setup

  1. Install dependencies: pnpm install
  2. Configure environment variables (see .env.sample)
  3. Choose transport method:
    • For stdio: pnpm start
    • For SSE: MCP_TRANSPORT=sse pnpm start

MCP Perplexity Server Features

Key Features of MCP Perplexity Server: High-Performance Real-Time APIs?

  • Transport Flexibility: Switch between stdio (default) and SSE for real-time streaming
  • Model Control: Specify default models (sonar-pro by default) and supported models via comma-separated lists
  • Security Options: Optional Bearer Token authentication for SSE endpoints
  • Customization: Adjust endpoint paths (/sse default), port (8080 default), and tool description suffixes

Use Cases of MCP Perplexity Server: High-Performance Real-Time APIs?

Common applications include:

  • Building chatbots with real-time conversational AI
  • Integrating Perplexity models into existing applications via REST/SSE APIs
  • Developing custom tooling that requires programmatic model access
  • Testing different Perplexity models in production environments

MCP Perplexity Server FAQ

FAQ from MCP Perplexity Server: High-Performance Real-Time APIs?

How do I get a Perplexity API key?
Visit the official Perplexity website to create an account and generate your API key.
Can I use multiple models simultaneously?
Yes! Configure MCP_PERPLEXITY_MODELS with comma-separated model names like "sonar,sonar-pro".
What's the difference between stdio and SSE transports?
The stdio is simpler for local development, while SSE provides better streaming capabilities for production use cases.
Is authentication mandatory?
Bearer token authentication is optional - leave MCP_SSE_AUTH_HEADER_VALUE unset for open access.

Content

MCP Perplexity Server

Overview

This repository contains the code for the Model Context Protocol (MCP) Perplexity Server, which is a server that provides an API to ask a question to a model behind the Perplexity API.

Quickstart via Portainer or Docker Compose

Use the following docker-compose.yml to quickly set up the server via Portainer (as a stack) or Docker Compose:

services:
  mcp-sse-server:
    image: ghcr.io/sibbl/mcp-perplexity-api:main
    ports:
      - "8080:8080"
    restart: unless-stopped
    environment:
      - MCP_TRANSPORT=sse
      - MCP_PERPLEXITY_API_KEY=ENTER_YOUR_PERPLEXITY_API_KEY
      # - MCP_SSE_AUTH_HEADER_VALUE=Bearer some_token_which_is_required # enables optional bearer authentication against the MCP server with hard coded value

Save it for Docker compose in a new directory and run docker compose up in it. http://localhost:8080/sse is your endpoint.

Prerequisites

  • Nodejs
  • pnpm
  • Docker

Important : Copy the .env.sample to .env and set your Perplexity API key.

Installation via Docker

To quickly set up the server, run:

docker compose up

Installation via Node.js

To install the required dependencies, run the following command:

pnpm install

To start the server, run:

# with stdio transport
export MCP_TRANSPORT=stdio # optional, stdio is default
pnpm start

# or

# with SSE transport
export MCP_TRANSPORT=sse
pnpm start

Configuration

All configuration options:

  • MCP_PERPLEXITY_API_KEY: Perplexity API key to use. Required.
  • MCP_TRANSPORT: Either stdio or sse. Default is stdio.
  • MCP_PERPLEXITY_DEFAULT_MODEL: The perplexity default model to use. Default is sonar-pro.
  • MCP_PERPLEXITY_MODELS: Comma separated list of models to use. Default is sonar,sonar-pro.
  • MCP_PERPLEXITY_TOOL_DESCRIPTION_SUFFIX: The suffix to use for the tool description. Empty by default.
  • MCP_SSE_ENDPOINT: The endpoint to use for SSE. Default is /sse.
  • MCP_SSE_PORT: The port to use for SSE. Default is 8080.
  • MCP_SSE_AUTH_HEADER_KEY: The auth header key to use for SSE. Default is Authorization.
  • MCP_SSE_AUTH_HEADER_VALUE: The auth header value to use for SSE. By default no value is set, which means that no authorization is required.

Related MCP Servers & Clients