Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
},
"metadata": {
"description": "Official Perplexity AI plugin providing real-time web search, reasoning, and research capabilities",
"version": "0.6.2"
"version": "0.7.0"
},
"plugins": [
{
"name": "perplexity",
"source": "./",
"description": "Real-time web search, reasoning, and research through Perplexity's API",
"version": "0.6.2",
"version": "0.7.0",
"author": {
"name": "Perplexity AI",
"email": "api@perplexity.ai"
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@perplexity-ai/mcp-server",
"version": "0.6.2",
"version": "0.7.0",
"mcpName": "io.github.perplexityai/mcp-server",
"description": "Real-time web search, reasoning, and research through Perplexity's API",
"keywords": [
Expand Down
4 changes: 2 additions & 2 deletions server.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"name": "io.github.perplexityai/mcp-server",
"title": "Perplexity API Platform",
"description": "Real-time web search, reasoning, and research through Perplexity's API",
"version": "0.6.2",
"version": "0.7.0",
"packages": [
{
"registryType": "npm",
"identifier": "@perplexity-ai/mcp-server",
"version": "0.6.2",
"version": "0.7.0",
"transport": {
"type": "stdio"
}
Expand Down
37 changes: 29 additions & 8 deletions src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -473,14 +473,35 @@ describe("Perplexity MCP Server", () => {
const models = ["sonar-pro", "sonar-deep-research", "sonar-reasoning-pro"];

for (const model of models) {
const mockResponse = {
choices: [{ message: { content: `Response from ${model}` } }],
};

global.fetch = vi.fn().mockResolvedValue({
ok: true,
json: async () => mockResponse,
} as Response);
if (model === "sonar-deep-research") {
// sonar-deep-research uses streaming, so provide an SSE mock
const sseData = [
`data: ${JSON.stringify({ choices: [{ delta: { content: "Response " } }] })}\n\n`,
`data: ${JSON.stringify({ choices: [{ delta: { content: `from ${model}` } }] })}\n\n`,
`data: [DONE]\n\n`,
].join("");

const stream = new ReadableStream({
start(controller) {
controller.enqueue(new TextEncoder().encode(sseData));
controller.close();
},
});

global.fetch = vi.fn().mockResolvedValue({
ok: true,
body: stream,
} as unknown as Response);
} else {
const mockResponse = {
choices: [{ message: { content: `Response from ${model}` } }],
};

global.fetch = vi.fn().mockResolvedValue({
ok: true,
json: async () => mockResponse,
} as Response);
}

const messages = [{ role: "user", content: "test" }];
const result = await performChatCompletion(messages, model);
Expand Down
Loading
Loading