@perplexity-ai/mcp-server 0.6.1 → 0.6.2

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": "0.6.1"
9
+ "version": "0.6.2"
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": "0.6.1",
16
+ "version": "0.6.2",
17
17
  "author": {
18
18
  "name": "Perplexity AI",
19
19
  "email": "api@perplexity.ai"
package/README.md CHANGED
@@ -34,7 +34,8 @@ Advanced reasoning and problem-solving using the `sonar-reasoning-pro` model. Pe
34
34
  1. Get your Perplexity API Key from the [API Portal](https://www.perplexity.ai/account/api/group)
35
35
  2. Replace `your_key_here` in the configurations below with your API key
36
36
  3. (Optional) Set timeout: `PERPLEXITY_TIMEOUT_MS=600000` (default: 5 minutes)
37
- 4. (Optional) Set log level: `PERPLEXITY_LOG_LEVEL=DEBUG|INFO|WARN|ERROR` (default: ERROR)
37
+ 4. (Optional) Set custom base URL: `PERPLEXITY_BASE_URL=https://your-custom-url.com` (default: https://api.perplexity.ai)
38
+ 5. (Optional) Set log level: `PERPLEXITY_LOG_LEVEL=DEBUG|INFO|WARN|ERROR` (default: ERROR)
38
39
 
39
40
  ### Claude Code
40
41
 
@@ -145,6 +146,7 @@ For cloud or shared deployments, run the server in HTTP mode.
145
146
  | Variable | Description | Default |
146
147
  |----------|-------------|---------|
147
148
  | `PERPLEXITY_API_KEY` | Your Perplexity API key | *Required* |
149
+ | `PERPLEXITY_BASE_URL` | Custom base URL for API requests | `https://api.perplexity.ai` |
148
150
  | `PORT` | HTTP server port | `8080` |
149
151
  | `BIND_ADDRESS` | Network interface to bind to | `0.0.0.0` |
150
152
  | `ALLOWED_ORIGINS` | CORS origins (comma-separated) | `*` |
package/dist/server.js CHANGED
@@ -3,6 +3,7 @@ import { z } from "zod";
3
3
  import { fetch as undiciFetch, ProxyAgent } from "undici";
4
4
  import { ChatCompletionResponseSchema, SearchResponseSchema } from "./validation.js";
5
5
  const PERPLEXITY_API_KEY = process.env.PERPLEXITY_API_KEY;
6
+ const PERPLEXITY_BASE_URL = process.env.PERPLEXITY_BASE_URL || "https://api.perplexity.ai";
6
7
  export function getProxyUrl() {
7
8
  return process.env.PERPLEXITY_PROXY ||
8
9
  process.env.HTTPS_PROXY ||
@@ -48,7 +49,7 @@ export async function performChatCompletion(messages, model = "sonar-pro", strip
48
49
  }
49
50
  // Read timeout fresh each time to respect env var changes
50
51
  const TIMEOUT_MS = parseInt(process.env.PERPLEXITY_TIMEOUT_MS || "300000", 10);
51
- const url = new URL("https://api.perplexity.ai/chat/completions");
52
+ const url = new URL(`${PERPLEXITY_BASE_URL}/chat/completions`);
52
53
  const body = {
53
54
  model: model,
54
55
  messages: messages,
@@ -143,7 +144,7 @@ export async function performSearch(query, maxResults = 10, maxTokensPerPage = 1
143
144
  }
144
145
  // Read timeout fresh each time to respect env var changes
145
146
  const TIMEOUT_MS = parseInt(process.env.PERPLEXITY_TIMEOUT_MS || "300000", 10);
146
- const url = new URL("https://api.perplexity.ai/search");
147
+ const url = new URL(`${PERPLEXITY_BASE_URL}/search`);
147
148
  const body = {
148
149
  query: query,
149
150
  max_results: maxResults,
@@ -199,7 +200,7 @@ export async function performSearch(query, maxResults = 10, maxTokensPerPage = 1
199
200
  export function createPerplexityServer(serviceOrigin) {
200
201
  const server = new McpServer({
201
202
  name: "io.github.perplexityai/mcp-server",
202
- version: "0.6.1",
203
+ version: "0.6.2",
203
204
  });
204
205
  const messageSchema = z.object({
205
206
  role: z.string().describe("Role of the message (e.g., system, user, assistant)"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perplexity-ai/mcp-server",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "mcpName": "io.github.perplexityai/mcp-server",
5
5
  "description": "Real-time web search, reasoning, and research through Perplexity's API",
6
6
  "keywords": [