MCP Hub
Back to servers

noodle-perplexity-mcp

Requires Setup

A Perplexity API Model Context Protocol (MCP) server that unlocks Perplexity's search-augmented AI capabilities for LLM agents. Features robust error handling, secure input validation, transparent reasoning, and multimodal support with file attachments (P

Updated
Nov 25, 2025
Validated
Jan 9, 2026

Quick Install

npx -y noodle-perplexity-mcp

Noodle Perplexity MCP

TypeScript Model Context Protocol Version License Status npm

Supercharge your AI agents with Perplexity's Search API!

An MCP (Model Context Protocol) server providing comprehensive access to the Perplexity AI API. It enables LLMs and AI agents to perform fast, search-augmented queries and conduct exhaustive, multi-source deep research, all through a standardized, secure, and easy-to-integrate protocol.

Built on the cyanheads/mcp-ts-template, this server follows a modular architecture with robust error handling, logging, and security features.

🚀 Core Capabilities: Perplexity Tools 🛠️

This server equips your AI with specialized tools to leverage Perplexity's unique capabilities:

Tool NameDescriptionKey Features
perplexity_askFactual lookup from documentation, library references, and authoritative sources using sonar-pro model. Best for simple fact-finding and documentation lookups.- Multi-source research coverage.
- Filter by recency, domain, or date range.
- Academic search mode for scholarly sources.
- Optional related questions suggestions.
perplexity_reasonGenerate code, combine concepts, and perform step-by-step analysis using sonar-reasoning-pro model. Best for code generation, problem-solving, and technical reasoning.- Code generation and debugging.
- Step-by-step analysis.
- Combine multiple libraries/concepts.
- Mathematical problem solving.
- Optional showThinking parameter to expose reasoning process.
perplexity_researchConduct exhaustive, multi-source deep research using sonar-deep-research model. Generates comprehensive 10,000+ word reports with expert-level insights.- 10-20+ searches per query.
- Reasoning transparency with <think> blocks.
- Detailed cost breakdown (6 components).
- Configurable reasoning effort (low/medium/high).
- Citations and search results included.

Table of Contents

OverviewFeaturesInstallation
ConfigurationProject Structure
ToolsDevelopmentLicense

Overview

The Noodle Perplexity MCP acts as a bridge, allowing applications (MCP Clients) that understand the Model Context Protocol (MCP)—like advanced AI assistants (LLMs), IDE extensions, or custom research tools—to interact directly and efficiently with the Perplexity AI API.

Instead of complex, one-off API integrations, your tools can leverage this server to:

  • Automate Research: Enable agents to perform quick lookups or deep-dive research programmatically.
  • Enhance AI Reasoning: Provide LLMs with up-to-date, verifiable information from the web to ground their responses.
  • Integrate Search into Workflows: Seamlessly add search-augmented generation to any AI-driven task.

Built on the robust mcp-ts-template, this server provides a standardized, secure, and efficient way to expose Perplexity's functionality via the MCP standard.

Developer Note: This repository includes a .clinerules file that serves as a developer cheat sheet for your LLM coding agent with quick reference for the codebase patterns, file locations, and code snippets.

Features

Core Utilities

Leverages the robust utilities provided by the mcp-ts-template:

  • Logging: Structured, configurable logging with file rotation and optional MCP notifications.
  • Error Handling: Centralized error processing with standardized McpError types.
  • Configuration: Environment variable loading (dotenv) with Zod validation.
  • Input Validation/Sanitization: Uses zod for schema validation and a dedicated sanitization utility.
  • Request Context: Operation tracking and correlation via unique request IDs using AsyncLocalStorage.
  • Type Safety: Strong typing enforced by TypeScript and Zod schemas.
  • HTTP Transport: High-performance HTTP server using Hono, featuring session management and CORS support.
  • Authentication: Robust authentication layer supporting JWT and OAuth 2.1.

Perplexity Integration

  • Triple Model Support: Specialized tools using fixed, optimized models - perplexity_ask (sonar-pro) for factual lookups, perplexity_reason (sonar-reasoning-pro) for code generation and reasoning, and perplexity_research (sonar-deep-research) for exhaustive multi-source research.
  • Advanced Domain Filtering: Powerful domain control with four filtering modes - Allowlist (include only specific domains), Denylist (exclude domains with - prefix), URL-level filtering (target specific pages), and SEC filings (special ["sec"] value). Supports up to 20 domains/URLs per request.
  • Advanced Search Control: Fine-grained control over search parameters, including recency filters, date range filtering, and academic source prioritization.
  • Cost Tracking & Transparency: Detailed cost breakdown with 6 itemized components (input/output/citation/reasoning tokens, search queries), helping manage expenses and understand API usage.
  • Reasoning Transparency: Optional showThinking parameter and automatic <think> block parsing to expose model reasoning process.
  • Resilient API Client: A dedicated service for interacting with the Perplexity API, featuring built-in error handling and request/response logging.

Installation

Prerequisites

Setup

Quick Start (Recommended)

Run directly with npx (no installation required):

npx -y noodle-perplexity-mcp

Global Installation

Install globally for easy access:

npm install -g noodle-perplexity-mcp
noodle-perplexity-mcp

Development Setup

For development or custom builds:

  1. Clone the repository:

    git clone https://github.com/fahd-noodleseed/perplexity-mcp-server.git
    cd perplexity-mcp-server
    
  2. Install dependencies:

    npm install
    
  3. Build the project:

    npm run build
    

Configuration

Environment Variables

Configure the server by creating a .env file in the project root (you can copy .env.example). These variables can also be set in your MCP client's configuration.

VariableDescriptionDefault
PERPLEXITY_API_KEYRequired. Your API key for Perplexity.""
MCP_TRANSPORT_TYPETransport mechanism: stdio or http.stdio
MCP_HTTP_PORTPort for the HTTP server (if MCP_TRANSPORT_TYPE=http).3010
MCP_HTTP_HOSTHost address for the HTTP server.127.0.0.1
MCP_LOG_LEVELLogging level (debug, info, warn, error).info
MCP_AUTH_MODEAuthentication for HTTP: jwt or oauth.jwt
MCP_AUTH_SECRET_KEYRequired for jwt auth. A secure secret key (min 32 chars).""

MCP Client Settings

Add the following to your MCP client's configuration file (e.g., cline_mcp_settings.json):

{
  "mcpServers": {
    "noodle-perplexity-mcp": {
      "command": "npx",
      "args": ["-y", "noodle-perplexity-mcp"],
      "env": {
        "PERPLEXITY_API_KEY": "YOUR_PERPLEXITY_API_KEY_HERE"
      }
    }
  }
}

Project Structure

The codebase follows a modular structure within the src/ directory:

src/
├── index.ts              # Entry point: Initializes and starts the server
├── config/               # Configuration loading (env vars, package info)
│   └── index.ts
├── mcp-server/           # Core MCP server logic and capability registration
│   ├── server.ts         # Server setup, capability registration
│   ├── transports/       # Transport handling (stdio, http)
│   └── tools/            # MCP Tool implementations (subdirs per tool)
├── services/             # External service integrations (Perplexity API client)
├── types-global/         # Shared TypeScript type definitions
└── utils/                # Common utility functions (logger, error handler, etc.)

For a detailed file tree, run npm run tree or see docs/tree.md.

Tools

The Perplexity MCP Server provides three specialized tools, each optimized with a specific model for different use cases:

Tool NameModel UsedDescriptionKey Arguments
perplexity_asksonar-proFactual lookup from documentation, library references, and authoritative sources. Supports file attachments for multimodal analysis (PDFs, documents, images). Best for simple fact-finding and documentation lookups.query, files?, search_recency_filter?, search_domain_filter?, search_mode?, return_related_questions?
perplexity_reasonsonar-reasoning-proGenerate code, combine concepts, and perform step-by-step analysis. Supports file attachments for code analysis, debugging, and document review. Best for code generation, problem-solving, and technical reasoning.query, files?, search_recency_filter?, search_domain_filter?, search_mode?, showThinking?
perplexity_researchsonar-deep-researchConduct exhaustive, multi-source deep research generating comprehensive 10,000+ word reports. Best for academic research, market analysis, and due diligence.query, reasoning_effort?, search_recency_filter?, search_domain_filter?, search_mode?, return_related_questions?

Note: All tools support comprehensive error handling, advanced domain filtering, and return structured JSON responses with detailed cost tracking. perplexity_ask and perplexity_reason now support file attachments (PDF, DOC, DOCX, TXT, RTF, PNG, JPEG, WEBP, GIF) for multimodal analysis.

Advanced Domain Filtering

All three Perplexity tools support powerful domain filtering via the search_domain_filter parameter, enabling precise control over search sources.

Four Filtering Modes

1. Allowlist Mode (Include Only Specific Domains)

{
  "search_domain_filter": ["nasa.gov", "wikipedia.org", "space.com"]
}
  • Only searches the specified domains
  • Use simple domain names without https:// or www.
  • Main domain includes all subdomains automatically

2. Denylist Mode (Exclude Specific Domains)

{
  "search_domain_filter": ["-pinterest.com", "-reddit.com", "-quora.com"]
}
  • Excludes specified domains from search results
  • Prefix domain with - to exclude
  • Useful for filtering out noise and low-quality sources

3. URL-Level Filtering (Target Specific Pages)

{
  "search_domain_filter": [
    "https://en.wikipedia.org/wiki/Chess",
    "https://chess.com"
  ]
}
  • Use complete URLs with protocol for page-level control
  • Can target specific articles or pages
  • Can also exclude specific pages with - prefix

4. SEC Filings (Special Value)

{
  "search_domain_filter": ["sec"]
}
  • Special value "sec" searches SEC regulatory filings
  • Includes 10-K (annual), 10-Q (quarterly), and 8-K (current) reports
  • Ideal for financial analysis and due diligence

Common Use Cases

Healthcare Research:

{ "search_domain_filter": ["nih.gov", "who.int", "cdc.gov", "nejm.org"] }

Finance & SEC Filings:

{ "search_domain_filter": ["sec", "bloomberg.com", "wsj.com", "ft.com"] }

Academic Research:

{ "search_domain_filter": ["arxiv.org", "scholar.google.com", "pnas.org", "nature.com"] }

Legal Research:

{ "search_domain_filter": ["justia.com", "findlaw.com", "law.cornell.edu"] }

Best Practices

  • Maximum 20 domains/URLs per request
  • Cannot mix allowlist and denylist modes in a single request
  • Use simple domain names for broad filtering across entire sites
  • Use complete URLs for granular page-level control
  • Test URL accessibility before adding to allowlist

Development

Build and Test

# Build the project (compile TS to JS in dist/)
npm run build

# Clean build artifacts
npm run clean

# Generate a file tree representation for documentation
npm run tree

# Clean build artifacts and then rebuild the project
npm run rebuild

# Start the server using stdio (default)
npm start

License

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

Credits

This project is a derivative work based on the original Perplexity MCP Server created by Casey Hand (@cyanheads).

Original Author: Casey Hand (@cyanheads) Current Maintainer: Fahd Rafi (@fahd-noodleseed)

The original project provided the foundation and architecture. This fork includes significant enhancements including tool refactoring, CLI improvements, and extended functionality. See NOTICE for detailed attribution and modifications.


Built with the Model Context Protocol

Reviews

No reviews yet

Sign in to write a review