diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index c3355fc..fa9d8ce 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -6,14 +6,14 @@ }, "metadata": { "description": "Official Perplexity AI plugin providing real-time web search, reasoning, and research capabilities", - "version": "1.2.1" + "version": "1.3.0" }, "plugins": [ { "name": "perplexity", "source": "./", "description": "Real-time web search, reasoning, and research through Perplexity's API", - "version": "1.2.1", + "version": "1.3.0", "author": { "name": "Perplexity AI", "email": "api@perplexity.ai" diff --git a/README.md b/README.md index 9b8f6fe..6d167b1 100644 --- a/README.md +++ b/README.md @@ -153,7 +153,7 @@ The server will be accessible at `http://localhost:8080/mcp` ## Available Tools ### **perplexity_search** -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`). +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. ### **perplexity_ask** General-purpose conversational AI with real-time web search, backed by the Agent API `fast` preset. Great for quick questions and everyday searches. diff --git a/package-lock.json b/package-lock.json index 5145f15..74e98bd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@perplexity-ai/mcp-server", - "version": "1.2.1", + "version": "1.3.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@perplexity-ai/mcp-server", - "version": "1.2.1", + "version": "1.3.0", "license": "MIT", "dependencies": { "@modelcontextprotocol/sdk": "^1.29.0", diff --git a/package.json b/package.json index 66491ef..1bf438d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@perplexity-ai/mcp-server", - "version": "1.2.1", + "version": "1.3.0", "mcpName": "ai.perplexity/mcp-server", "description": "Real-time web search, reasoning, and research through Perplexity's API", "keywords": [ diff --git a/plugin.json b/plugin.json index 30c96d7..1c94e8f 100644 --- a/plugin.json +++ b/plugin.json @@ -1,7 +1,7 @@ { "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json", "name": "perplexity", - "version": "1.2.1", + "version": "1.3.0", "description": "Real-time web search, reasoning, and research through Perplexity's API", "author": { "name": "Perplexity AI", diff --git a/server.json b/server.json index 7434249..1ba6b4a 100644 --- a/server.json +++ b/server.json @@ -3,12 +3,12 @@ "name": "ai.perplexity/mcp-server", "title": "Perplexity API Platform", "description": "Real-time web search, reasoning, and research through Perplexity's API", - "version": "1.2.1", + "version": "1.3.0", "packages": [ { "registryType": "npm", "identifier": "@perplexity-ai/mcp-server", - "version": "1.2.1", + "version": "1.3.0", "transport": { "type": "stdio" } diff --git a/src/index.test.ts b/src/index.test.ts index dd82e95..d89eb2b 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -127,9 +127,9 @@ describe("Perplexity MCP Server", () => { headers: { "Content-Type": "application/json", Authorization: "Bearer test-api-key", - "User-Agent": "perplexity-mcp/1.2.1", + "User-Agent": "perplexity-mcp/1.3.0", "X-Source": "pplx-mcp-server", - "X-Pplx-Integration": "perplexity-mcp/1.2.1", + "X-Pplx-Integration": "perplexity-mcp/1.3.0", }, body: JSON.stringify({ preset: "fast", diff --git a/src/server.ts b/src/server.ts index 743c7d9..c78a160 100644 --- a/src/server.ts +++ b/src/server.ts @@ -9,7 +9,9 @@ import type { AgentCallHooks, ApiKeyProvider, PerplexityServerOptions, + SearchOptions, SearchResponse, + SearchType, UndiciRequestOptions } from "./types.js"; import { AgentResponseSchema, SearchResponseSchema } from "./validation.js"; @@ -18,7 +20,7 @@ export type { ApiKeyProvider, PerplexityServerOptions } from "./types.js"; const PERPLEXITY_API_KEY = process.env.PERPLEXITY_API_KEY; const PERPLEXITY_BASE_URL = process.env.PERPLEXITY_BASE_URL || "https://api.perplexity.ai"; -const VERSION = "1.2.1"; +const VERSION = "1.3.0"; // Agent API presets backing each tool: https://docs.perplexity.ai/docs/agent-api/presets export const ASK_PRESET = "fast"; @@ -481,7 +483,7 @@ export async function performSearch( maxResults: number = 10, maxTokensPerPage: number = 1024, country?: string, - filters?: Pick, + filters?: SearchOptions, serviceOrigin?: string, apiKey?: ApiKeyProvider, ): Promise { @@ -492,6 +494,7 @@ export async function performSearch( ...(country && { country }), ...(filters?.search_recency_filter && { search_recency_filter: filters.search_recency_filter }), ...(filters?.search_domain_filter && { search_domain_filter: filters.search_domain_filter }), + ...(filters?.search_type && { search_type: filters.search_type }), }; const response = await makeApiRequest("search", body, serviceOrigin, undefined, apiKey); @@ -547,7 +550,7 @@ export function createPerplexityServer(serviceOrigin?: string, serverOptions?: P { instructions: "Perplexity AI server for web-grounded search, research, and reasoning, backed by the Perplexity Agent API. " + - "Use perplexity_search for finding URLs, facts, and recent news. Supports recency filters and domain restrictions. " + + "Use perplexity_search for finding URLs, facts, and recent news. Supports recency filters, domain restrictions, and fast search. " + "Use perplexity_ask for quick AI-answered questions with citations. Supports recency filters, domain restrictions, and search context size control. " + "Use perplexity_research for in-depth multi-source investigation (slow, can take minutes). " + "Use perplexity_reason for complex analysis requiring step-by-step logic. Supports recency filters, domain restrictions, and search context size control. " + @@ -727,6 +730,8 @@ export function createPerplexityServer(serviceOrigin?: string, serverOptions?: P .describe("ISO 3166-1 alpha-2 country code for regional results (e.g., 'US', 'GB')"), search_recency_filter: searchRecencyFilterField, search_domain_filter: searchDomainFilterField, + search_type: z.enum(["web", "fast"]).optional() + .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."), }; const searchOutputSchema = { @@ -740,7 +745,7 @@ export function createPerplexityServer(serviceOrigin?: string, serverOptions?: P description: "Search the web and return a ranked list of results with titles, URLs, snippets, and dates. " + "Best for: finding specific URLs, checking recent news, verifying facts, discovering sources. " + "Returns formatted results (title, URL, snippet, date) with no AI synthesis. " + - "Supports recency filters and domain restrictions. " + + "Supports recency filters, domain restrictions, and a lower-latency fast search mode. " + "For AI-generated answers with citations, use perplexity_ask instead.", inputSchema: searchInputSchema as any, outputSchema: searchOutputSchema as any, @@ -752,20 +757,22 @@ export function createPerplexityServer(serviceOrigin?: string, serverOptions?: P }, }, async (args: any) => { - const { query, max_results, max_tokens_per_page, country, search_recency_filter, search_domain_filter } = args as { + const { query, max_results, max_tokens_per_page, country, search_recency_filter, search_domain_filter, search_type } = args as { query: string; max_results?: number; max_tokens_per_page?: number; country?: string; search_recency_filter?: "hour" | "day" | "week" | "month" | "year"; search_domain_filter?: string[]; + search_type?: SearchType; }; const maxResults = typeof max_results === "number" ? max_results : 10; const maxTokensPerPage = typeof max_tokens_per_page === "number" ? max_tokens_per_page : 1024; const countryCode = typeof country === "string" ? country : undefined; - const filters = { + const filters: SearchOptions = { ...(search_recency_filter && { search_recency_filter }), ...(search_domain_filter && { search_domain_filter }), + ...(search_type && { search_type }), }; const result = await performSearch(query, maxResults, maxTokensPerPage, countryCode, filters, serviceOrigin, serverOptions?.apiKey); diff --git a/src/transport.test.ts b/src/transport.test.ts index f6ef72f..a778cf3 100644 --- a/src/transport.test.ts +++ b/src/transport.test.ts @@ -422,6 +422,7 @@ describe("Transport Integration Tests", () => { query: "test", search_recency_filter: "week", search_domain_filter: ["wikipedia.org", "-reddit.com"], + search_type: "fast", }, }); @@ -433,6 +434,7 @@ describe("Transport Integration Tests", () => { query: "test", search_recency_filter: "week", search_domain_filter: ["wikipedia.org", "-reddit.com"], + search_type: "fast", }); } finally { await client.close(); diff --git a/src/types.ts b/src/types.ts index bd3b3e3..1a0b036 100644 --- a/src/types.ts +++ b/src/types.ts @@ -86,6 +86,12 @@ export interface SearchRequestBody { country?: string; } +export type SearchType = "web" | "fast"; + +export interface SearchOptions extends Pick { + search_type?: SearchType; +} + export interface AgentToolOptions { search_recency_filter?: "hour" | "day" | "week" | "month" | "year"; search_domain_filter?: string[];