Home
Login
ppl-ai/modelcontextprotocol

A Model Context Protocol server connector for the Perplexity API, enabling web search functionality without leaving the MCP ecosystem.

MITJavaScript 1.2kppl-ai Last Updated: 2025-04-27
https://github.com/ppl-ai/modelcontextprotocol

Model Context Protocol - Perplexity API Connector

Project Overview

The Model Context Protocol (MCP) is an innovative server implementation project specifically designed to integrate Perplexity's Sonar API. The core objective of this project is to provide AI assistants like Claude with unparalleled real-time web search capabilities, allowing users to access the latest online information without leaving the MCP ecosystem.

Project Address: https://github.com/ppl-ai/modelcontextprotocol

License: MIT License

Core Features and Characteristics

🌐 Real-time Web Search

  • Sonar API Integration: Directly integrates Perplexity's powerful search engine.
  • Real-time Information Retrieval: Provides the latest and most accurate online information.
  • Seamless Experience: Completes all search operations within the MCP ecosystem.

🛠️ Developer-Friendly

  • Multiple Deployment Options: Supports Docker containerized deployment and direct NPM installation.
  • TypeScript Support: Developed using TypeScript, providing better type safety.
  • Flexible Configuration: Customizable search parameters and API call settings.

🔧 Tools and Interfaces

perplexity_ask Tool

This tool is the core functionality of the project, providing the following capabilities:

Functionality Description: Engages in conversational interaction with the Sonar API to achieve real-time web search.

Input Parameters:

  • messages (array): An array of conversation messages.
    • role (string): The message role (e.g., system, user, assistant).
    • content (string): The message content.

🖥️ Supported Platforms

Claude Desktop

  • Native Integration: Perfectly supports the Claude desktop application.
  • Simple Configuration: Can be enabled via a JSON configuration file.
  • Tool Visualization: Displays a hammer icon in the interface to indicate that the tool is activated.

Cursor IDE

  • Development Environment Integration: Supports the Cursor code editor.
  • Global MCP Server: Can be configured as a globally available tool.
  • Developer Workflow: Seamlessly integrates into the developer's daily workflow.

Quick Start

Environment Preparation

  1. Obtain API Key

    • Register for a Sonar API account.
    • Generate an API key from the developer dashboard.
    • Set the environment variable PERPLEXITY_API_KEY.
  2. Install Project

    git clone git@github.com:ppl-ai/modelcontextprotocol.git
    cd modelcontextprotocol/perplexity-ask
    npm install
    

Deployment Options

Option 1: Docker Deployment

{
  "mcpServers": {
    "perplexity-ask": {
      "command": "docker",
      "args": [
        "run", "-i", "--rm", "-e", "PERPLEXITY_API_KEY",
        "mcp/perplexity-ask"
      ],
      "env": {
        "PERPLEXITY_API_KEY": "YOUR_API_KEY_HERE"
      }
    }
  }
}

Option 2: Direct NPM Execution

{
  "mcpServers": {
    "perplexity-ask": {
      "command": "npx",
      "args": ["-y", "server-perplexity-ask"],
      "env": {
        "PERPLEXITY_API_KEY": "YOUR_API_KEY_HERE"
      }
    }
  }
}

Technical Architecture

System Components

  • MCP Server: The core service component, handling protocol communication.
  • Sonar API Client: The interface layer to the Perplexity API.
  • Message Processor: Processes conversation messages and search requests.
  • Configuration Management: A flexible parameter configuration system.

Data Flow

  1. Request Reception: Claude or other clients send search requests.
  2. Message Processing: The MCP server parses the conversation messages.
  3. API Call: Sends a search request to the Sonar API.
  4. Result Return: Real-time search results are returned to the client.

Use Cases

📚 Research and Learning

  • Real-time Information Inquiry: Obtain the latest news and technology trends.
  • Academic Research: Quickly find relevant literature and materials.
  • Fact-Checking: Verify the accuracy and timeliness of information.

💼 Business Applications

  • Market Analysis: Obtain the latest market trends and competitive information.
  • Customer Service: Provide customers with the latest product information and solutions.
  • Content Creation: Obtain the latest information for content creation.

🛠️ Developer Tools

  • Technical Documentation Inquiry: Quickly find the latest technical documentation and API information.
  • Problem Solving: Find the latest solutions and best practices.
  • Trend Tracking: Understand technology development trends and emerging technologies.

Customization and Extension

Search Parameter Configuration

The project allows developers to directly modify search parameters in the index.ts file, including:

  • Search mode settings
  • Result quantity limits
  • Language preference settings
  • Time range filtering

Project Advantages

✅ Open Source and Transparent

  • MIT License: Fully open source, free to use, modify, and distribute.
  • Community-Driven: Contributors are welcome to participate in project development.

✅ Easy to Integrate

  • Standardized Protocol: Based on the MCP standard, with strong compatibility.
  • Multi-Platform Support: Supports various AI assistants and development environments.

✅ Highly Customizable

  • Flexible Configuration: Supports various search parameter customizations.
  • Highly Extensible: Can be functionally extended according to needs.

Summary

The Model Context Protocol - Perplexity API Connector is a powerful and easy-to-use open-source project that provides AI assistants with powerful real-time web search capabilities. By integrating Perplexity's Sonar API, this project allows users to access the latest and most accurate online information without leaving their current work environment.

Whether for research and learning, business applications, or development work, this project can significantly improve the practicality and accuracy of AI assistants. Its open-source nature and flexible configuration options make it an ideal choice for developers and businesses.

Suitable for:

  • AI application developers
  • Researchers and scholars
  • Content creators
  • Business users who need real-time information

Core Value:

  • Enhances the information retrieval capabilities of AI assistants
  • Simplifies the integration process of real-time search
  • Provides a reliable and accurate source of online information