Provides search functionality through Perplexity AI's continuously refreshed index with support for web, academic, and SEC search modes, geographic filtering, and customizable result limits
Perplexity Search MCP
This tool wraps the search functionality of Perplexity AI into a standardized tool using the Model Context Protocol (MCP). It allows you to perform advanced search queries with filtering and customization options.
This project is built with TypeScript and runs on the Bun runtime.
✨ Features
Provides the
perplexity-searchtool via MCP.Supports various parameters for Perplexity search:
query: A single search query or an array of queries for multi-query search.max_results: Specifies the maximum number of search results to return (maximum 20).country: Filters search results by geographic location (e.g., 'US', 'GB', 'DE').max_tokens_per_page: Controls the maximum number of tokens retrieved from each webpage during search processing. Higher values provide more comprehensive content extraction but may increase processing time.search_domain_filter: A list of domains/URLs to restrict search results. For example:["science.org", "pnas.org", "cell.com"]
Communicates with the host environment via standard input/output (Stdio).
🚀 Getting Started
1. Prerequisites
Ensure you have Bun installed.
Obtain an API key from Perplexity AI.
2. Installation
After cloning the project, run the following command in the root directory to install the required dependencies:
3. Configuration
Set the PERPLEXITY_API_KEY environment variable with your Perplexity API key.
4. Running the Server (Development)
To run the server directly from the TypeScript source for development, execute the following command:
The server will start and listen for MCP messages on standard I/O.
5. Building the Project
You can build the project into a single, optimized JavaScript file:
This compiles index.ts and places the output in dist/perplexity-search-mcp.js.
After building, you can run the compiled file directly:
or
🛠️ Tool Definition
perplexity-search
Description: Retrieve ranked search results from Perplexity’s continuously refreshed index, with advanced filtering and customization options.
Input Parameters:
Parameter | Type | Description | Default |
|
or
| The search query or queries to execute. Can be a single query or a list of queries for multi-query search. | Required |
|
| The maximum number of search results to return (must be a positive integer no greater than 20). |
|
|
| Country code to filter search results by geographic location (e.g., 'US', 'GB', 'DE'). | Optional |
|
| Maximum number of tokens to retrieve from each webpage. Higher values yield more comprehensive content extraction but may increase processing time. |
|
|
| An optional list of domains/URLs to which search results should be limited (e.g.,
). | Optional |
Output:
The tool returns a JSON string containing an array of search results from the Perplexity API.
This server cannot be installed