@perplexity-ai/mcp-server 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,14 +6,14 @@
6
6
  },
7
7
  "metadata": {
8
8
  "description": "Official Perplexity AI plugin providing real-time web search, reasoning, and research capabilities",
9
- "version": "1.2.0"
9
+ "version": "1.3.0"
10
10
  },
11
11
  "plugins": [
12
12
  {
13
13
  "name": "perplexity",
14
14
  "source": "./",
15
15
  "description": "Real-time web search, reasoning, and research through Perplexity's API",
16
- "version": "1.2.0",
16
+ "version": "1.3.0",
17
17
  "author": {
18
18
  "name": "Perplexity AI",
19
19
  "email": "api@perplexity.ai"
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Perplexity API Platform MCP Server
2
2
 
3
- [![Install in Cursor](https://custom-icon-badges.demolab.com/badge/Install_in_Cursor-000000?style=for-the-badge&logo=cursor-ai-white)](https://cursor.com/en/install-mcp?name=perplexity&config=eyJ0eXBlIjoic3RkaW8iLCJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBwZXJwbGV4aXR5LWFpL21jcC1zZXJ2ZXIiXSwiZW52Ijp7IlBFUlBMRVhJVFlfQVBJX0tFWSI6IiJ9fQ==)
3
+ [![Install in Cursor](https://custom-icon-badges.demolab.com/badge/Install_in_Cursor-000000?style=for-the-badge&logo=cursor-ai-white)](https://cursor.com/install-mcp?name=perplexity&config=eyJ1cmwiOiJodHRwczovL2FwaS5wZXJwbGV4aXR5LmFpL21jcCIsImhlYWRlcnMiOnsiQXV0aG9yaXphdGlvbiI6IkJlYXJlciBZT1VSX0FQSV9LRVkifX0%3D)
4
4
   
5
- [![Install in VS Code](https://custom-icon-badges.demolab.com/badge/Install_in_VS_Code-007ACC?style=for-the-badge&logo=vsc&logoColor=white)](https://vscode.dev/redirect/mcp/install?name=perplexity&config=%7B%22type%22%3A%22stdio%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40perplexity-ai%2Fmcp-server%22%5D%2C%22env%22%3A%7B%22PERPLEXITY_API_KEY%22%3A%22%22%7D%7D)
5
+ [![Install in VS Code](https://custom-icon-badges.demolab.com/badge/Install_in_VS_Code-007ACC?style=for-the-badge&logo=vsc&logoColor=white)](https://vscode.dev/redirect/mcp/install?name=perplexity&config=%7B%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fapi.perplexity.ai%2Fmcp%22%2C%22headers%22%3A%7B%22Authorization%22%3A%22Bearer%20%24%7Binput%3Aperplexity-api-key%7D%22%7D%7D&inputs=%5B%7B%22type%22%3A%22promptString%22%2C%22id%22%3A%22perplexity-api-key%22%2C%22description%22%3A%22Perplexity%20API%20Key%22%2C%22password%22%3Atrue%7D%5D)
6
6
   
7
7
  [![Add to Kiro](https://img.shields.io/badge/Add_to_Kiro-9046FF?style=for-the-badge&logo=data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTkxIiBoZWlnaHQ9IjIyNi44MTQiIHZpZXdCb3g9IjAgMCAxOTEgMjI2LjgxNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMzUuNjA5IDE3My4xNjVjLTIzLjExMSA1MS4yMzUgMjYuMTA2IDY0LjA2OCA2Mi4zOTYgMzQuMTA2IDEwLjY2IDMzLjYwNSA1MC42OTggOC41MzQgNjUuMDU5LTE3LjUxMSAzMS42MzQtNTcuMzgzIDE4Ljg2Mi0xMTUuOTM3IDE1LjU3OS0xMjguMDE3LTIyLjUwMi04Mi4zNTctMTM0LjkyOS04Mi40MjktMTU0LjI4MS40MTgtNC41MjMgMTQuNTA1LTQuNTk1IDMxLjAwMy03LjE2MSA0OC4xMzItMS4yOSA4LjYzMS0yLjE5OCAxNC4xNDUtNS41MzkgMjMuMjMtMS45MjEgNS4yMTgtNC41NTkgOS44NDktOC43MTQgMTcuNjY2LTguMjEzIDEyLjU0NS4xNTUgMzguMiAzMi42NSAyMi4wMDF6IiBmaWxsPSIjZmZmIi8+PHBhdGggZD0iTTEwMi42MDMgOTYuODk4Yy05LjIyOSAwLTEwLjYxMy0xMS4wMzEtMTAuNjEzLTE3LjU5NyAwLTUuOTMyIDEuMDc0LTEwLjY0OSAzLjA2Ny0xMy42NDRhOC41OCA4LjU4IDAgMCAxIDcuNTIxLTMuOTY0YzMuMjM2IDAgNi4wMDQgMS4zNjIgNy45NjEgNC4wMzYgMi4yMDkgMy4wNDUgMy4zOTEgNy43NTkgMy4zOTEgMTMuNTg2IDAgMTEuMDE3LTQuMjM4IDE3LjU5Ny0xMS4zNDEgMTcuNTk3em0zNy45NDggMGMtOS4yNCAwLTEwLjYyNC0xMS4wMzEtMTAuNjI0LTE3LjU5NyAwLTUuOTMyIDEuMDc0LTEwLjY0OSAzLjA4MS0xMy42NDRhOC41OCA4LjU4IDAgMCAxIDcuNTIxLTMuOTY0IDkuNTEgOS41MSAwIDAgMSA3Ljk1IDQuMDM2YzIuMjIgMy4wNDUgMy40MDIgNy43NTkgMy40MDIgMTMuNTg2IDAgMTEuMDE3LTQuMjM4IDE3LjU5Ny0xMS4zNDEgMTcuNTk3eiIgZmlsbD0iIzAwMCIvPlw8L3N2Zz4=&logoColor=white)](https://kiro.dev/launch/mcp/add?name=perplexity&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40perplexity-ai%2Fmcp-server%22%5D%2C%22env%22%3A%7B%22PERPLEXITY_API_KEY%22%3A%22your_key_here%22%7D%7D)
8
8
   
@@ -10,28 +10,27 @@
10
10
 
11
11
  The official MCP server implementation for the Perplexity API Platform, providing AI assistants with real-time web search, reasoning, and research capabilities through the [Agent API](https://docs.perplexity.ai/docs/agent-api/quickstart) and the Search API.
12
12
 
13
- ## Available Tools
13
+ ## Remote MCP Server
14
14
 
15
- ### **perplexity_search**
16
- Direct web search using the Perplexity Search API. Returns ranked search results with metadata, perfect for finding current information. Supports recency filters (`search_recency_filter`) and domain restrictions (`search_domain_filter`).
15
+ The remote MCP server is hosted by Perplexity and is the easiest way to get started: same tools, nothing to install or update. The Cursor and VS Code buttons at the top of this page connect to it with one click. If your MCP client does not support remote servers yet, skip to the [local server](#local-mcp-server) setup below. Connect over Streamable HTTP with your [Perplexity API key](https://console.perplexity.ai):
17
16
 
18
- ### **perplexity_ask**
19
- General-purpose conversational AI with real-time web search, backed by the Agent API `fast` preset. Great for quick questions and everyday searches.
17
+ ```
18
+ https://api.perplexity.ai/mcp
19
+ ```
20
20
 
21
- ### **perplexity_research**
22
- Deep, comprehensive research backed by the Agent API `high` preset. Ideal for thorough analysis and detailed reports. Runs can take minutes; the server streams the run and reports progress to clients that request it.
21
+ For Claude Code:
23
22
 
24
- ### **perplexity_reason**
25
- Advanced reasoning and problem-solving backed by the Agent API `medium` preset. Perfect for complex analytical tasks.
23
+ ```bash
24
+ claude mcp add --transport http perplexity https://api.perplexity.ai/mcp --header "Authorization: Bearer YOUR_API_KEY"
25
+ ```
26
26
 
27
- > [!NOTE]
28
- > Presets are managed configurations (model, search setup, step budget) that Perplexity keeps tuned over time; see the [presets guide](https://docs.perplexity.ai/docs/agent-api/presets). Earlier versions of this server called the legacy `sonar-pro`, `sonar-reasoning-pro`, and `sonar-deep-research` models and accepted `strip_thinking` / `reasoning_effort` parameters. Those parameters are no longer part of the tool schemas and are ignored if sent; the Agent API produces no `<think>` tags.
27
+ See the [MCP integration docs](https://docs.perplexity.ai/docs/getting-started/integrations/mcp-server) for manual Cursor/VS Code configuration, usage from the Anthropic API, and setup for other clients.
29
28
 
30
- ## Configuration
29
+ ## Local MCP Server
31
30
 
32
31
  ### Get Your API Key
33
32
 
34
- 1. Get your Perplexity API Key from the [API Portal](https://www.perplexity.ai/account/api/group)
33
+ 1. Get your Perplexity API Key from the [API Portal](https://console.perplexity.ai)
35
34
  2. Replace `your_key_here` in the configurations below with your API key
36
35
  3. (Optional) Set timeout: `PERPLEXITY_TIMEOUT_MS=600000` (default: 5 minutes)
37
36
  4. (Optional) Set custom base URL: `PERPLEXITY_BASE_URL=https://your-custom-url.com` (default: https://api.perplexity.ai)
@@ -57,7 +56,11 @@ claude
57
56
  codex mcp add perplexity --env PERPLEXITY_API_KEY="your_key_here" -- npx -y @perplexity-ai/mcp-server
58
57
  ```
59
58
 
60
- ### Cursor, Claude Desktop, Kiro, Windsurf, and VS Code
59
+ ### Agent Plugins
60
+
61
+ This repository is packaged as an [Agent Plugin](https://agent-plugins.org), so clients that support the standard can install it directly from this repository. The Agent Plugins format does not carry secrets, so set the `PERPLEXITY_API_KEY` environment variable through your client's plugin or MCP settings.
62
+
63
+ ### Other MCP Clients
61
64
 
62
65
  Most clients can be configured manually using the same `mcpServers` wrapper in their client config (as shown for Cursor). If a client has a different schema, check its docs for the exact wrapper format.
63
66
 
@@ -116,7 +119,7 @@ If you'd rather use the standard variables, we support `HTTPS_PROXY` and `HTTP_P
116
119
  > The server checks proxy settings in this order: `PERPLEXITY_PROXY` → `HTTPS_PROXY` → `HTTP_PROXY`. If none are set, it connects directly to the internet.
117
120
  > URLs must include `https://`. Typical ports are `8080`, `3128`, and `80`.
118
121
 
119
- ### HTTP Server Deployment
122
+ ### Self-Hosted HTTP Mode
120
123
 
121
124
  For cloud or shared deployments, run the server in HTTP mode.
122
125
 
@@ -147,6 +150,23 @@ npm install && npm run build && npm run start:http
147
150
 
148
151
  The server will be accessible at `http://localhost:8080/mcp`
149
152
 
153
+ ## Available Tools
154
+
155
+ ### **perplexity_search**
156
+ Direct web search using the Perplexity Search API. Returns ranked search results with metadata, perfect for finding current information. Supports recency filters (`search_recency_filter`), domain restrictions (`search_domain_filter`), and [Fast Search](https://docs.perplexity.ai/docs/search/fast-search) (`search_type: "fast"`) for lower latency and cost.
157
+
158
+ ### **perplexity_ask**
159
+ General-purpose conversational AI with real-time web search, backed by the Agent API `fast` preset. Great for quick questions and everyday searches.
160
+
161
+ ### **perplexity_research**
162
+ Deep, comprehensive research backed by the Agent API `high` preset. Ideal for thorough analysis and detailed reports. Runs can take minutes; the server streams the run and reports progress to clients that request it.
163
+
164
+ ### **perplexity_reason**
165
+ Advanced reasoning and problem-solving backed by the Agent API `medium` preset. Perfect for complex analytical tasks.
166
+
167
+ > [!NOTE]
168
+ > Presets are managed configurations (model, search setup, step budget) that Perplexity keeps tuned over time; see the [presets guide](https://docs.perplexity.ai/docs/agent-api/presets). Earlier versions of this server called the legacy `sonar-pro`, `sonar-reasoning-pro`, and `sonar-deep-research` models and accepted `strip_thinking` / `reasoning_effort` parameters. Those parameters are no longer part of the tool schemas and are ignored if sent; the Agent API produces no `<think>` tags.
169
+
150
170
  ## Use as a Library
151
171
 
152
172
  The package also exports the server factory for embedding in your own Node process:
package/dist/server.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Message, AgentResponse, AgentToolOptions, AgentCallHooks, ApiKeyProvider, PerplexityServerOptions, SearchResponse } from "./types.js";
1
+ import type { Message, AgentResponse, AgentToolOptions, AgentCallHooks, ApiKeyProvider, PerplexityServerOptions, SearchOptions, SearchResponse } from "./types.js";
2
2
  export type { ApiKeyProvider, PerplexityServerOptions } from "./types.js";
3
3
  export declare const ASK_PRESET = "fast";
4
4
  export declare const REASON_PRESET = "medium";
@@ -25,7 +25,7 @@ export declare function extractAgentText(response: AgentResponse): string;
25
25
  export declare function formatAgentResponseText(response: AgentResponse): string;
26
26
  export declare function performAgentResponse(messages: Message[], preset: string, serviceOrigin?: string, options?: AgentToolOptions, hooks?: AgentCallHooks, apiKey?: ApiKeyProvider): Promise<string>;
27
27
  export declare function formatSearchResults(data: SearchResponse): string;
28
- export declare function performSearch(query: string, maxResults?: number, maxTokensPerPage?: number, country?: string, filters?: Pick<AgentToolOptions, "search_recency_filter" | "search_domain_filter">, serviceOrigin?: string, apiKey?: ApiKeyProvider): Promise<string>;
28
+ export declare function performSearch(query: string, maxResults?: number, maxTokensPerPage?: number, country?: string, filters?: SearchOptions, serviceOrigin?: string, apiKey?: ApiKeyProvider): Promise<string>;
29
29
  export declare function createPerplexityServer(serviceOrigin?: string, serverOptions?: PerplexityServerOptions): import("@modelcontextprotocol/sdk/server/index.js").Server<{
30
30
  method: string;
31
31
  params?: {
package/dist/server.js CHANGED
@@ -4,7 +4,7 @@ import { fetch as undiciFetch, ProxyAgent } from "undici";
4
4
  import { AgentResponseSchema, SearchResponseSchema } from "./validation.js";
5
5
  const PERPLEXITY_API_KEY = process.env.PERPLEXITY_API_KEY;
6
6
  const PERPLEXITY_BASE_URL = process.env.PERPLEXITY_BASE_URL || "https://api.perplexity.ai";
7
- const VERSION = "1.2.0";
7
+ const VERSION = "1.3.0";
8
8
  // Agent API presets backing each tool: https://docs.perplexity.ai/docs/agent-api/presets
9
9
  export const ASK_PRESET = "fast";
10
10
  export const REASON_PRESET = "medium";
@@ -82,6 +82,7 @@ async function makeApiRequest(endpoint, body, serviceOrigin, signal, apiKey) {
82
82
  "Authorization": `Bearer ${resolvedApiKey}`,
83
83
  "User-Agent": `perplexity-mcp/${VERSION}`,
84
84
  "X-Source": "pplx-mcp-server",
85
+ "X-Pplx-Integration": `perplexity-mcp/${VERSION}`,
85
86
  };
86
87
  if (serviceOrigin) {
87
88
  headers["X-Service"] = serviceOrigin;
@@ -424,6 +425,7 @@ export async function performSearch(query, maxResults = 10, maxTokensPerPage = 1
424
425
  ...(country && { country }),
425
426
  ...(filters?.search_recency_filter && { search_recency_filter: filters.search_recency_filter }),
426
427
  ...(filters?.search_domain_filter && { search_domain_filter: filters.search_domain_filter }),
428
+ ...(filters?.search_type && { search_type: filters.search_type }),
427
429
  };
428
430
  const response = await makeApiRequest("search", body, serviceOrigin, undefined, apiKey);
429
431
  let data;
@@ -462,7 +464,7 @@ export function createPerplexityServer(serviceOrigin, serverOptions) {
462
464
  version: VERSION,
463
465
  }, {
464
466
  instructions: "Perplexity AI server for web-grounded search, research, and reasoning, backed by the Perplexity Agent API. " +
465
- "Use perplexity_search for finding URLs, facts, and recent news. Supports recency filters and domain restrictions. " +
467
+ "Use perplexity_search for finding URLs, facts, and recent news. Supports recency filters, domain restrictions, and fast search. " +
466
468
  "Use perplexity_ask for quick AI-answered questions with citations. Supports recency filters, domain restrictions, and search context size control. " +
467
469
  "Use perplexity_research for in-depth multi-source investigation (slow, can take minutes). " +
468
470
  "Use perplexity_reason for complex analysis requiring step-by-step logic. Supports recency filters, domain restrictions, and search context size control. " +
@@ -587,6 +589,8 @@ export function createPerplexityServer(serviceOrigin, serverOptions) {
587
589
  .describe("ISO 3166-1 alpha-2 country code for regional results (e.g., 'US', 'GB')"),
588
590
  search_recency_filter: searchRecencyFilterField,
589
591
  search_domain_filter: searchDomainFilterField,
592
+ search_type: z.enum(["web", "fast"]).optional()
593
+ .describe("Search backend. 'web' (default) is the standard web search. 'fast' is lower latency and lower cost; prefer it for routine lookups inside agent loops, and keep 'web' for rare or ambiguous questions."),
590
594
  };
591
595
  const searchOutputSchema = {
592
596
  results: z.string().describe("Formatted search results, each with title, URL, snippet, and date"),
@@ -596,7 +600,7 @@ export function createPerplexityServer(serviceOrigin, serverOptions) {
596
600
  description: "Search the web and return a ranked list of results with titles, URLs, snippets, and dates. " +
597
601
  "Best for: finding specific URLs, checking recent news, verifying facts, discovering sources. " +
598
602
  "Returns formatted results (title, URL, snippet, date) with no AI synthesis. " +
599
- "Supports recency filters and domain restrictions. " +
603
+ "Supports recency filters, domain restrictions, and a lower-latency fast search mode. " +
600
604
  "For AI-generated answers with citations, use perplexity_ask instead.",
601
605
  inputSchema: searchInputSchema,
602
606
  outputSchema: searchOutputSchema,
@@ -607,13 +611,14 @@ export function createPerplexityServer(serviceOrigin, serverOptions) {
607
611
  destructiveHint: false,
608
612
  },
609
613
  }, async (args) => {
610
- const { query, max_results, max_tokens_per_page, country, search_recency_filter, search_domain_filter } = args;
614
+ const { query, max_results, max_tokens_per_page, country, search_recency_filter, search_domain_filter, search_type } = args;
611
615
  const maxResults = typeof max_results === "number" ? max_results : 10;
612
616
  const maxTokensPerPage = typeof max_tokens_per_page === "number" ? max_tokens_per_page : 1024;
613
617
  const countryCode = typeof country === "string" ? country : undefined;
614
618
  const filters = {
615
619
  ...(search_recency_filter && { search_recency_filter }),
616
620
  ...(search_domain_filter && { search_domain_filter }),
621
+ ...(search_type && { search_type }),
617
622
  };
618
623
  const result = await performSearch(query, maxResults, maxTokensPerPage, countryCode, filters, serviceOrigin, serverOptions?.apiKey);
619
624
  return {
@@ -621,5 +626,31 @@ export function createPerplexityServer(serviceOrigin, serverOptions) {
621
626
  structuredContent: { results: result },
622
627
  };
623
628
  });
629
+ advertiseJsonSchema202012(server.server);
624
630
  return server.server;
625
631
  }
632
+ // The MCP TypeScript SDK stamps draft-07 on tools/list schemas
633
+ // (modelcontextprotocol/typescript-sdk#2084); 2020-12-only clients reject
634
+ // them. The schemas are valid under both dialects, so only the declared
635
+ // dialect needs rewriting. Remove once typescript-sdk#2085 ships.
636
+ const JSON_SCHEMA_2020_12 = "https://json-schema.org/draft/2020-12/schema";
637
+ function advertiseJsonSchema202012(server) {
638
+ // _requestHandlers is private SDK state; goes away with this shim.
639
+ const handlers = server._requestHandlers;
640
+ const listTools = handlers.get("tools/list");
641
+ if (!listTools) {
642
+ return;
643
+ }
644
+ handlers.set("tools/list", async (request, extra) => {
645
+ const result = await listTools(request, extra);
646
+ for (const tool of result.tools ?? []) {
647
+ if (tool.inputSchema?.$schema) {
648
+ tool.inputSchema.$schema = JSON_SCHEMA_2020_12;
649
+ }
650
+ if (tool.outputSchema?.$schema) {
651
+ tool.outputSchema.$schema = JSON_SCHEMA_2020_12;
652
+ }
653
+ }
654
+ return result;
655
+ });
656
+ }
package/dist/types.d.ts CHANGED
@@ -73,6 +73,10 @@ export interface SearchRequestBody {
73
73
  max_tokens_per_page: number;
74
74
  country?: string;
75
75
  }
76
+ export type SearchType = "web" | "fast";
77
+ export interface SearchOptions extends Pick<AgentToolOptions, "search_recency_filter" | "search_domain_filter"> {
78
+ search_type?: SearchType;
79
+ }
76
80
  export interface AgentToolOptions {
77
81
  search_recency_filter?: "hour" | "day" | "week" | "month" | "year";
78
82
  search_domain_filter?: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perplexity-ai/mcp-server",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "mcpName": "ai.perplexity/mcp-server",
5
5
  "description": "Real-time web search, reasoning, and research through Perplexity's API",
6
6
  "keywords": [