MCP ExplorerExplorer

Mcp Perplexity

@martinbechardon 9 months ago
1 MIT
FreeCommunity
AI Systems
MCP server for AI-powered internet searches with source citations.

Overview

What is Mcp Perplexity

mcp-perplexity is an MCP (Model Context Protocol) server implementation that integrates with Perplexity’s AI-powered internet search API, allowing AI assistants to perform internet searches and receive enhanced answers with source citations.

Use cases

Use cases include developing AI assistants that provide accurate information from the internet, automating customer support queries with sourced answers, and enhancing research tools that require real-time data retrieval.

How to use

To use mcp-perplexity, install it using ‘pnpm install’, configure it with your Perplexity API key via command line or environment variables, and start the server with ‘pnpm start’. You can also specify optional domain filters for search results.

Key features

Key features include internet search capabilities with AI-powered answers, source citations included with responses, optional domain filtering, configurable API parameters, a comprehensive logging system, MCP protocol compliance, and a command line interface.

Where to use

mcp-perplexity can be used in various fields such as AI development, customer support automation, research assistance, and any application requiring enhanced internet search capabilities.

Content

Perplexity MCP Server

An MCP (Model Context Protocol) server implementation that integrates with Perplexity’s AI-powered internet search API. This server enables AI assistants to perform internet searches and receive AI-enhanced answers with source citations.

Features

  • Internet search capabilities with AI-powered answers
  • Source citations included with responses
  • Optional domain filtering for search results
  • Configurable API parameters
  • Comprehensive logging system
  • MCP protocol compliance
  • Command line interface

Installation

pnpm install

Configuration

The server can be configured through command line arguments or environment variables:

Command Line Arguments

  • --api-key <key> - Perplexity API key
  • -h, --help - Display help information

Environment Variables

  • PERPLEXITY_API_KEY - Perplexity API key (if not provided via command line)

Claude Desktop Configuration

To use this server with Claude Desktop, add the following to your Claude Desktop configuration file (usually located at ~/.claude-desktop/config.json):

{
  "mcpServers": {
    "perplexity": {
      "command": "node",
      "args": [
        "/path/to/your/dev/mcp-perplexity/dist/stdio-server.js",
        "--api-key",
        "your-perplexity-api-key"
      ]
    }
  }
}

Replace /path/to/your/dev/mcp-perplexity with the actual path to your local development directory, and your-perplexity-api-key with your actual Perplexity API key.

Usage

Starting the Server

pnpm start

Or with direct API key:

pnpm start --api-key YOUR_API_KEY_HERE

Tool Capabilities

The server exposes a single tool named perplexity_search with the following input schema:

{
  messages: {
    role: 'system' | 'user',
    content: string
  }[],
  searchDomainFilter?: string[]  // Optional list of domains to restrict search results
}

Server Logs

Logs can be accessed through the MCP protocol at the resource URI logs://current.

Development

Project Structure

  • /src
    • /server - Core server implementation
    • /types - TypeScript type definitions
    • index.ts - Main exports
    • stdio-server.ts - Command line interface

Building

pnpm build

Running Tests

pnpm test

API Constants

Default configurations can be found in src/types/Constants.ts:

  • Default Model: llama-3.1-sonar-small-128k-online
  • Default Temperature: 0.2
  • Default Top P: 0.9
  • Maximum Search Domains: 3
  • Request Timeout: 30 seconds

Error Handling

The server implements comprehensive error handling:

  • Input validation using Zod schemas
  • API error handling with retry logic
  • Clear error messages in MCP responses
  • Detailed logging of all operations

Contributing

  1. Fork the repository
  2. Create your feature branch: git checkout -b feature/my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin feature/my-new-feature
  5. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

Martin Bechard [email protected]

Acknowledgments

  • Uses the Perplexity API for AI-powered internet search
  • Built with the Anthropic MCP SDK

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers