@perplexity-ai/mcp-server 1.2.0 → 1.2.1
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.
- package/.claude-plugin/marketplace.json +2 -2
- package/README.md +37 -17
- package/dist/server.js +28 -1
- package/package.json +1 -1
|
@@ -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.
|
|
9
|
+
"version": "1.2.1"
|
|
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.
|
|
16
|
+
"version": "1.2.1",
|
|
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
|
-
[](https://cursor.com/
|
|
3
|
+
[](https://cursor.com/install-mcp?name=perplexity&config=eyJ1cmwiOiJodHRwczovL2FwaS5wZXJwbGV4aXR5LmFpL21jcCIsImhlYWRlcnMiOnsiQXV0aG9yaXphdGlvbiI6IkJlYXJlciBZT1VSX0FQSV9LRVkifX0%3D)
|
|
4
4
|
|
|
5
|
-
[](https://vscode.dev/redirect/mcp/install?name=perplexity&config=%7B%22type%22%3A%
|
|
5
|
+
[](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
|
[](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
|
-
##
|
|
13
|
+
## Remote MCP Server
|
|
14
14
|
|
|
15
|
-
|
|
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
|
-
|
|
19
|
-
|
|
17
|
+
```
|
|
18
|
+
https://api.perplexity.ai/mcp
|
|
19
|
+
```
|
|
20
20
|
|
|
21
|
-
|
|
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
|
-
|
|
25
|
-
|
|
23
|
+
```bash
|
|
24
|
+
claude mcp add --transport http perplexity https://api.perplexity.ai/mcp --header "Authorization: Bearer YOUR_API_KEY"
|
|
25
|
+
```
|
|
26
26
|
|
|
27
|
-
|
|
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
|
-
##
|
|
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://
|
|
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
|
-
###
|
|
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
|
|
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`) and domain restrictions (`search_domain_filter`).
|
|
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.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.
|
|
7
|
+
const VERSION = "1.2.1";
|
|
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;
|
|
@@ -621,5 +622,31 @@ export function createPerplexityServer(serviceOrigin, serverOptions) {
|
|
|
621
622
|
structuredContent: { results: result },
|
|
622
623
|
};
|
|
623
624
|
});
|
|
625
|
+
advertiseJsonSchema202012(server.server);
|
|
624
626
|
return server.server;
|
|
625
627
|
}
|
|
628
|
+
// The MCP TypeScript SDK stamps draft-07 on tools/list schemas
|
|
629
|
+
// (modelcontextprotocol/typescript-sdk#2084); 2020-12-only clients reject
|
|
630
|
+
// them. The schemas are valid under both dialects, so only the declared
|
|
631
|
+
// dialect needs rewriting. Remove once typescript-sdk#2085 ships.
|
|
632
|
+
const JSON_SCHEMA_2020_12 = "https://json-schema.org/draft/2020-12/schema";
|
|
633
|
+
function advertiseJsonSchema202012(server) {
|
|
634
|
+
// _requestHandlers is private SDK state; goes away with this shim.
|
|
635
|
+
const handlers = server._requestHandlers;
|
|
636
|
+
const listTools = handlers.get("tools/list");
|
|
637
|
+
if (!listTools) {
|
|
638
|
+
return;
|
|
639
|
+
}
|
|
640
|
+
handlers.set("tools/list", async (request, extra) => {
|
|
641
|
+
const result = await listTools(request, extra);
|
|
642
|
+
for (const tool of result.tools ?? []) {
|
|
643
|
+
if (tool.inputSchema?.$schema) {
|
|
644
|
+
tool.inputSchema.$schema = JSON_SCHEMA_2020_12;
|
|
645
|
+
}
|
|
646
|
+
if (tool.outputSchema?.$schema) {
|
|
647
|
+
tool.outputSchema.$schema = JSON_SCHEMA_2020_12;
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
return result;
|
|
651
|
+
});
|
|
652
|
+
}
|