Labsco
spences10 logo

Perplexity Search

โ˜… 8

from spences10

Web search and chat completion powered by the Perplexity AI API.

๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedAccount requiredAdvanced setup

mcp-perplexity-search


โš ๏ธ Notice

This repository is no longer maintained.

The functionality of this tool is now available in mcp-omnisearch, which combines multiple MCP tools in one unified package.

Please use mcp-omnisearch instead.


A Model Context Protocol (MCP) server for integrating Perplexity's AI API with LLMs. This server provides advanced chat completion capabilities with specialized prompt templates for various use cases.

Features

  • ๐Ÿค– Advanced chat completion using Perplexity's AI models
  • ๐Ÿ“ Predefined prompt templates for common scenarios:
    • Technical documentation generation
    • Security best practices analysis
    • Code review and improvements
    • API documentation in structured format
  • ๐ŸŽฏ Custom template support for specialized use cases
  • ๐Ÿ“Š Multiple output formats (text, markdown, JSON)
  • ๐Ÿ” Optional source URL inclusion in responses
  • โš™๏ธ Configurable model parameters (temperature, max tokens)
  • ๐Ÿš€ Support for various Perplexity models including Sonar and LLaMA

API

The server implements a single MCP tool with configurable parameters:

chat_completion

Generate chat completions using the Perplexity API with support for specialized prompt templates.

Parameters:

  • messages (array, required): Array of message objects with:
    • role (string): 'system', 'user', or 'assistant'
    • content (string): The message content
  • prompt_template (string, optional): Predefined template to use:
    • technical_docs: Technical documentation with code examples
    • security_practices: Security implementation guidelines
    • code_review: Code analysis and improvements
    • api_docs: API documentation in JSON format
  • custom_template (object, optional): Custom prompt template with:
    • system (string): System message for assistant behaviour
    • format (string): Output format preference
    • include_sources (boolean): Whether to include sources
  • format (string, optional): 'text', 'markdown', or 'json' (default: 'text')
  • include_sources (boolean, optional): Include source URLs (default: false)
  • model (string, optional): Perplexity model to use (default: 'sonar')
  • temperature (number, optional): Output randomness (0-1, default: 0.7)
  • max_tokens (number, optional): Maximum response length (default: 1024)

Development

Setup

  1. Clone the repository
  2. Install dependencies:
pnpm install
  1. Build the project:
pnpm build
  1. Run in development mode:
pnpm dev

Publishing

The project uses changesets for version management. To publish:

  1. Create a changeset:
pnpm changeset
  1. Version the package:
pnpm changeset version
  1. Publish to npm:
pnpm release