perplexity-user-mcp 0.8.37 → 0.8.38
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/README.md +86 -0
- package/dist/daemon/attach.mjs +1 -1
- package/dist/daemon/index.mjs +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.mjs +41 -4
- package/package.json +1 -1
- /package/dist/{chunk-SVPRB62V.mjs → chunk-YUGDOXIN.mjs} +0 -0
package/README.md
CHANGED
|
@@ -165,6 +165,92 @@ Claude Desktop (`claude_desktop_config.json`) uses the same shape.
|
|
|
165
165
|
- `perplexity_login` — returns login instructions (interactive login runs via the CLI / extension)
|
|
166
166
|
- `perplexity_doctor` — run diagnostic checks across browser, profile, auth, and network and return a Markdown report (pass `probe:true` for a live search probe)
|
|
167
167
|
|
|
168
|
+
## Search sources and advanced queries
|
|
169
|
+
|
|
170
|
+
Search-style tools support Perplexity source focus through a `sources` argument:
|
|
171
|
+
|
|
172
|
+
- `web` — general web search. This is the default.
|
|
173
|
+
- `scholar` — scholarly / academic source focus.
|
|
174
|
+
- `social` — social discussion source focus.
|
|
175
|
+
|
|
176
|
+
The source selector is explicit. If `sources` is omitted, the server sends `["web"]`.
|
|
177
|
+
|
|
178
|
+
Examples:
|
|
179
|
+
|
|
180
|
+
```json
|
|
181
|
+
{
|
|
182
|
+
"tool": "perplexity_search",
|
|
183
|
+
"arguments": {
|
|
184
|
+
"query": "recent papers on retrieval augmented generation evaluation",
|
|
185
|
+
"sources": ["scholar"],
|
|
186
|
+
"language": "en-US"
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
```json
|
|
192
|
+
{
|
|
193
|
+
"tool": "perplexity_ask",
|
|
194
|
+
"arguments": {
|
|
195
|
+
"query": "What are practitioners saying about Cursor versus Windsurf for large TypeScript repos?",
|
|
196
|
+
"sources": ["social"],
|
|
197
|
+
"mode": "copilot"
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
```json
|
|
203
|
+
{
|
|
204
|
+
"tool": "perplexity_research",
|
|
205
|
+
"arguments": {
|
|
206
|
+
"query": "Compare academic evidence and practitioner discussion around code review automation",
|
|
207
|
+
"sources": ["scholar", "social"],
|
|
208
|
+
"language": "en-US"
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Natural-language prompts usually work too when they name the desired source mode:
|
|
214
|
+
|
|
215
|
+
- "Use Perplexity scholar sources for recent papers on agentic search evaluation."
|
|
216
|
+
- "Search social sources for developer reports about Claude Code memory issues."
|
|
217
|
+
- "Run deep research using both scholar and web sources, and cite every claim."
|
|
218
|
+
- "Use `perplexity_ask` with `sources: [\"social\"]` and keep the answer concise."
|
|
219
|
+
|
|
220
|
+
Useful shorthand:
|
|
221
|
+
|
|
222
|
+
- "search ..." usually maps to `perplexity_search` for quick lookup and source discovery.
|
|
223
|
+
- "ask Perplexity ..." usually maps to `perplexity_ask` for a synthesized answer with citations.
|
|
224
|
+
- "reason through ..." usually maps to `perplexity_reason` for multi-step analysis.
|
|
225
|
+
- "research deeply ..." usually maps to `perplexity_research` for longer reports.
|
|
226
|
+
- "use ASI", "Computer mode", "run a compute task", or "do code/execution-style analysis" maps to `perplexity_compute` when the account has Computer-mode access.
|
|
227
|
+
|
|
228
|
+
For ASI / Computer mode, ask for `perplexity_compute` by name when precision matters:
|
|
229
|
+
|
|
230
|
+
```json
|
|
231
|
+
{
|
|
232
|
+
"tool": "perplexity_compute",
|
|
233
|
+
"arguments": {
|
|
234
|
+
"query": "Model the true cost of a 5 kW residential solar installation in the Philippines versus investing the same cash at 6% annually over 10 and 20 years. Show assumptions, calculations, and sensitivity cases.",
|
|
235
|
+
"language": "en-US"
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### Defaults
|
|
241
|
+
|
|
242
|
+
| Tool | Model default | Mode default | Sources default | Language default |
|
|
243
|
+
|---|---|---|---|---|
|
|
244
|
+
| `perplexity_search` | Authenticated: `pplx_pro`; anonymous: `turbo` | Authenticated: `copilot`; anonymous: `concise` | `["web"]` | `en-US` |
|
|
245
|
+
| `perplexity_ask` | `PERPLEXITY_SEARCH_MODEL` or `pplx_pro` | `copilot` | `["web"]` | `en-US` |
|
|
246
|
+
| `perplexity_reason` | `PERPLEXITY_REASON_MODEL` or `claude46sonnetthinking` | `copilot` | `["web"]` | `en-US` |
|
|
247
|
+
| `perplexity_research` | `PERPLEXITY_RESEARCH_MODEL` or `pplx_alpha` | `copilot` | `["web"]` | `en-US` |
|
|
248
|
+
| `perplexity_compute` | Tool argument, then `PERPLEXITY_COMPUTE_MODEL`, then account ASI default, then `pplx_asi` | `asi` | web-only Computer mode | `en-US` |
|
|
249
|
+
|
|
250
|
+
Model defaults are configurable with `PERPLEXITY_SEARCH_MODEL`, `PERPLEXITY_REASON_MODEL`, `PERPLEXITY_RESEARCH_MODEL`, and `PERPLEXITY_COMPUTE_MODEL`. `perplexity_ask`, `perplexity_reason`, and `perplexity_compute` also accept a per-call `model` argument. `perplexity_ask` accepts `mode: "concise" | "copilot"`.
|
|
251
|
+
|
|
252
|
+
Under the hood, search-style tools post a Perplexity web-app style request from the logged-in browser session to `https://www.perplexity.ai/rest/sse/perplexity_ask`. The response is a Server-Sent Events stream, which the MCP runtime parses into answer text, citation sources, media items, suggested follow-ups, follow-up context, and the Perplexity thread URL.
|
|
253
|
+
|
|
168
254
|
## Library use
|
|
169
255
|
|
|
170
256
|
Subpath exports are published for embedding the same runtime inside other Node tooling:
|
package/dist/daemon/attach.mjs
CHANGED
package/dist/daemon/index.mjs
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -154,6 +154,10 @@ declare function __resetVaultPreflightForTests(): void;
|
|
|
154
154
|
* don't need cookies (perplexity_doctor, anonymous perplexity_search).
|
|
155
155
|
*/
|
|
156
156
|
declare function runVaultPreflight(stderr?: NodeJS.WritableStream): Promise<void>;
|
|
157
|
+
declare function waitForStdioInputClose(stdin?: NodeJS.ReadableStream): Promise<void>;
|
|
158
|
+
declare function shutdownClientWithTimeout(c: {
|
|
159
|
+
shutdown: () => Promise<void>;
|
|
160
|
+
} | undefined, timeoutMs?: number): Promise<void>;
|
|
157
161
|
declare function main(): Promise<void>;
|
|
158
162
|
|
|
159
|
-
export { type HistoryEntry, PerplexityClient, type ToolProfile, __resetVaultPreflightForTests, buildAnswerPreview, buildHistoryBody, buildHistoryEntry, buildIssueBody, buildIssueUrl, buildStoredHistoryEntry, decideTransport, exportThread, formatResponse, getEnabledTools, loadToolConfig, main, redactIssueBody, registerPrompts, registerResources, registerTools, runVaultPreflight, saveToolConfig, watchToolConfig };
|
|
163
|
+
export { type HistoryEntry, PerplexityClient, type ToolProfile, __resetVaultPreflightForTests, buildAnswerPreview, buildHistoryBody, buildHistoryEntry, buildIssueBody, buildIssueUrl, buildStoredHistoryEntry, decideTransport, exportThread, formatResponse, getEnabledTools, loadToolConfig, main, redactIssueBody, registerPrompts, registerResources, registerTools, runVaultPreflight, saveToolConfig, shutdownClientWithTimeout, waitForStdioInputClose, watchToolConfig };
|
package/dist/index.mjs
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "./chunk-DPGMKSSA.mjs";
|
|
13
13
|
import {
|
|
14
14
|
attachToDaemon
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-YUGDOXIN.mjs";
|
|
16
16
|
import {
|
|
17
17
|
ensureDaemon,
|
|
18
18
|
startDaemon
|
|
@@ -122,6 +122,35 @@ async function runVaultPreflight(stderr = process.stderr) {
|
|
|
122
122
|
`);
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
+
async function waitForStdioInputClose(stdin = process.stdin) {
|
|
126
|
+
stdin.resume();
|
|
127
|
+
await new Promise((resolve) => {
|
|
128
|
+
const done = () => {
|
|
129
|
+
stdin.off("end", done);
|
|
130
|
+
stdin.off("close", done);
|
|
131
|
+
resolve();
|
|
132
|
+
};
|
|
133
|
+
stdin.once("end", done);
|
|
134
|
+
stdin.once("close", done);
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
var SHUTDOWN_TIMEOUT_MS = 5e3;
|
|
138
|
+
async function shutdownClientWithTimeout(c, timeoutMs = SHUTDOWN_TIMEOUT_MS) {
|
|
139
|
+
if (!c) return;
|
|
140
|
+
let timer;
|
|
141
|
+
const timeout = new Promise((resolve) => {
|
|
142
|
+
timer = setTimeout(() => {
|
|
143
|
+
console.error(`[perplexity-mcp] WARN shutdown timeout after ${timeoutMs}ms \u2014 exiting.`);
|
|
144
|
+
resolve();
|
|
145
|
+
}, timeoutMs);
|
|
146
|
+
timer.unref?.();
|
|
147
|
+
});
|
|
148
|
+
try {
|
|
149
|
+
await Promise.race([c.shutdown().catch(() => void 0), timeout]);
|
|
150
|
+
} finally {
|
|
151
|
+
if (timer) clearTimeout(timer);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
125
154
|
async function main() {
|
|
126
155
|
client = new PerplexityClient();
|
|
127
156
|
const server = new McpServer({
|
|
@@ -147,21 +176,27 @@ async function main() {
|
|
|
147
176
|
});
|
|
148
177
|
process.on("SIGINT", async () => {
|
|
149
178
|
watcher.dispose();
|
|
150
|
-
await client
|
|
179
|
+
await shutdownClientWithTimeout(client);
|
|
151
180
|
process.exit(0);
|
|
152
181
|
});
|
|
153
182
|
process.on("SIGTERM", async () => {
|
|
154
183
|
watcher.dispose();
|
|
155
|
-
await client
|
|
184
|
+
await shutdownClientWithTimeout(client);
|
|
156
185
|
process.exit(0);
|
|
157
186
|
});
|
|
158
187
|
const transport = new StdioServerTransport();
|
|
159
188
|
await server.connect(transport);
|
|
189
|
+
try {
|
|
190
|
+
await waitForStdioInputClose();
|
|
191
|
+
} finally {
|
|
192
|
+
watcher.dispose();
|
|
193
|
+
await shutdownClientWithTimeout(client);
|
|
194
|
+
}
|
|
160
195
|
}
|
|
161
196
|
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
162
197
|
runEntrypoint().catch(async (error) => {
|
|
163
198
|
console.error("[perplexity-mcp] Fatal error:", error);
|
|
164
|
-
await client
|
|
199
|
+
await shutdownClientWithTimeout(client);
|
|
165
200
|
process.exit(1);
|
|
166
201
|
});
|
|
167
202
|
}
|
|
@@ -227,10 +262,12 @@ export {
|
|
|
227
262
|
runAll as runDoctor,
|
|
228
263
|
runVaultPreflight,
|
|
229
264
|
saveToolConfig,
|
|
265
|
+
shutdownClientWithTimeout,
|
|
230
266
|
startDaemon,
|
|
231
267
|
syncCloudHistory,
|
|
232
268
|
tag,
|
|
233
269
|
update,
|
|
234
270
|
upsertFromCloud,
|
|
271
|
+
waitForStdioInputClose,
|
|
235
272
|
watchToolConfig
|
|
236
273
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "perplexity-user-mcp",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.38",
|
|
4
4
|
"mcpName": "io.github.Automations-Project/perplexity-user-mcp",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Perplexity AI MCP server — browser automation for search, reasoning, research, and compute. Not affiliated with Perplexity AI, Inc.",
|
|
File without changes
|