### Configure Perplexity MCP Server Source: https://context7.com/dainfernalcoder/perplexity-mcp/llms.txt Configure the Perplexity MCP server in your MCP client settings. This example shows basic setup with an environment variable for the API key. ```json { "mcpServers": { "perplexity": { "command": "npx", "args": ["-y", "perplexity-mcp"], "env": { "PERPLEXITY_API_KEY": "your_api_key" } } } } ``` -------------------------------- ### Use Perplexity Search Tool Source: https://context7.com/dainfernalcoder/perplexity-mcp/llms.txt Examples of using the 'search' tool with the Perplexity MCP server. Includes basic queries, recommended technical details, and forcing the search model. ```javascript // Basic search query const result = await use_mcp_tool({ server_name: "perplexity", tool_name: "search", arguments: { query: "What is the capital of France?" } }); ``` ```javascript // Search with specific technical details (recommended) const technicalResult = await use_mcp_tool({ server_name: "perplexity", tool_name: "search", arguments: { query: "What is the default port for PostgreSQL 15.4 on Ubuntu 22.04?" } }); ``` ```javascript // Force using search model even if query seems complex const forcedResult = await use_mcp_tool({ server_name: "perplexity", tool_name: "search", arguments: { query: "How does React's virtual DOM work?", force_model: true // Prevents automatic routing to reason tool } }); ``` ```javascript // Response includes content and sources // { // content: [{ // type: "text", // text: "The capital of France is Paris...\n\n## Sources\n1: https://..." // }] // } ``` -------------------------------- ### Configure Perplexity MCP Server (Node.js) Source: https://github.com/dainfernalcoder/perplexity-mcp/blob/main/README.md Configure the MCP server to use the Perplexity server by specifying the command, arguments, and environment variables, including the Perplexity API key. This example uses Node.js. ```json { "mcpServers": { "perplexity": { "command": "node", "args": ["/path/to/perplexity-server/build/index.js"], "env": { "PERPLEXITY_API_KEY": "YOUR_API_KEY_HERE" }, "disabled": false, "autoApprove": [] } } } ``` -------------------------------- ### Configure Perplexity MCP Server (NPX) Source: https://github.com/dainfernalcoder/perplexity-mcp/blob/main/README.md Configure the MCP server to use the Perplexity server via NPX, which avoids local installation. Specify the command, arguments, and environment variables, including the Perplexity API key. ```json { "mcpServers": { "perplexity": { "command": "npx", "args": [ "-y", "perplexity-mcp" ], "env": { "PERPLEXITY_API_KEY": "your_api_key" } } } } ``` -------------------------------- ### Conduct Deep Research with Focus Areas Source: https://context7.com/dainfernalcoder/perplexity-mcp/llms.txt Use the 'deep_research' tool for comprehensive research. Specify the main query and optional `focus_areas` to guide the research towards specific subtopics. ```javascript // Comprehensive research with focus areas const researchResult = await use_mcp_tool({ server_name: "perplexity", tool_name: "deep_research", arguments: { query: "The impact of quantum computing on cryptography", focus_areas: [ "Post-quantum cryptographic algorithms", "Timeline for quantum threats to current encryption", "Practical mitigation strategies for organizations" ] } }); ``` -------------------------------- ### Compare Technologies with Reason Tool Source: https://context7.com/dainfernalcoder/perplexity-mcp/llms.txt Use the 'reason' tool to compare and contrast technologies. Provide a detailed query outlining the comparison points and desired output format. ```javascript // Compare technologies with reasoning const comparisonResult = await use_mcp_tool({ server_name: "perplexity", tool_name: "reason", arguments: { query: "Compare and contrast REST and GraphQL APIs, explaining their pros and cons for a mobile application with limited bandwidth" } }); ``` -------------------------------- ### Configure Perplexity MCP Server (Command-Line API Key) Source: https://github.com/dainfernalcoder/perplexity-mcp/blob/main/README.md Configure the MCP server to use the Perplexity server, passing the API key directly as a command-line argument. This is a fallback if the API key cannot be read from the environment. ```json { "mcpServers": { "perplexity": { "command": "node", "args": [ "/path/to/perplexity-server/build/index.js", "--api-key", "your_api_key_here" ], "disabled": false, "autoApprove": [] } } } ``` -------------------------------- ### Use Perplexity Search Tool Source: https://github.com/dainfernalcoder/perplexity-mcp/blob/main/README.md Use this tool for quick searches and basic information lookup. It's best for straightforward questions requiring direct answers. The `force_model` option is optional. ```javascript const result = await use_mcp_tool({ server_name: "perplexity", tool_name: "search", arguments: { query: "What is the capital of France?", force_model: false // Optional: force using this model even if query seems complex } }); ``` -------------------------------- ### Perplexity API Key Configuration Options Source: https://context7.com/dainfernalcoder/perplexity-mcp/llms.txt Provides three methods for configuring the Perplexity API key: environment variable (preferred), command-line argument, or .env file with --cwd flag. Ensure the API key format is correct. ```json // Option 1: Environment variable (preferred) { "mcpServers": { "perplexity": { "command": "npx", "args": ["-y", "perplexity-mcp"], "env": { "PERPLEXITY_API_KEY": "pplx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" } } } } ``` ```json // Option 2: Command-line argument { "mcpServers": { "perplexity": { "command": "node", "args": [ "/path/to/perplexity-server/build/index.js", "--api-key", "pplx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ] } } } ``` ```json // Option 3: .env file with --cwd (reads PERPLEXITY_API_KEY from .env) { "mcpServers": { "perplexity": { "command": "node", "args": [ "/path/to/perplexity-server/build/index.js", "--cwd", "/path/to/your/project" ] } } } ``` -------------------------------- ### Configure Perplexity MCP Server (.env File) Source: https://github.com/dainfernalcoder/perplexity-mcp/blob/main/README.md Configure the MCP server to read API keys from an explicit .env file using the `--cwd` argument. This is a fallback method for providing environment variables. ```json { "mcpServers": { "perplexity": { "command": "node", "args": [ "/path/to/perplexity-server/build/index.js", "--cwd", "/path/to/your/project" ], "disabled": false, "autoApprove": [] } } } ``` -------------------------------- ### Use Perplexity Reason Tool Source: https://github.com/dainfernalcoder/perplexity-mcp/blob/main/README.md Handles complex, multi-step tasks requiring detailed analysis, such as explanations and comparisons. The `force_model` option is optional. ```javascript const result = await use_mcp_tool({ server_name: "perplexity", tool_name: "reason", arguments: { query: "Compare and contrast REST and GraphQL APIs, explaining their pros and cons", force_model: false // Optional: force using this model even if query seems simple } }); ``` -------------------------------- ### Analyze Architecture with Reason Tool Source: https://context7.com/dainfernalcoder/perplexity-mcp/llms.txt Employ the 'reason' tool for architectural decision analysis. Specify the architectures to compare and the context, such as team size and project type. The `force_model` argument can be set to `false` to allow the model to choose the best approach. ```javascript // Architectural decision analysis const architectureResult = await use_mcp_tool({ server_name: "perplexity", tool_name: "reason", arguments: { query: "What are the advantages and disadvantages of using microservices vs monolithic architecture for a startup with a team of 5 developers building an e-commerce platform?", force_model: false } }); ``` -------------------------------- ### Automatic Query Routing to Reason Model Source: https://context7.com/dainfernalcoder/perplexity-mcp/llms.txt Queries containing complexity indicators like 'how', 'explain', or 'difference' are automatically upgraded from 'search' to the 'reason' tool (Sonar Reasoning Pro). ```javascript // This query will be auto-routed to "reason" (Sonar Reasoning Pro) // because it contains complexity indicators: "how", "explain", "difference" await use_mcp_tool({ server_name: "perplexity", tool_name: "search", // Will be upgraded to "reason" automatically arguments: { query: "How does React's reconciliation algorithm work and what's the difference between React 17 and React 18?" } }); ``` -------------------------------- ### Perform Deep Research with deep_research Tool Source: https://github.com/dainfernalcoder/perplexity-mcp/blob/main/examples/deep-research.md Use this snippet to initiate a deep research query on a specific topic. Provide a detailed query and optional focus areas for a comprehensive analysis. ```javascript const result = await use_mcp_tool({ server_name: "perplexity-ask", tool_name: "deep_research", arguments: { query: "The impact of quantum computing on cryptography", focus_areas: [ "Post-quantum cryptographic algorithms", "Timeline for quantum threats to current encryption", "Practical mitigation strategies for organizations" ] } }); console.log(result); ``` -------------------------------- ### Use Perplexity Deep Research Tool Source: https://github.com/dainfernalcoder/perplexity-mcp/blob/main/README.md Conducts comprehensive research and generates detailed reports for in-depth analysis. The `force_model` option is optional. You can specify `focus_areas` for more targeted research. ```javascript const result = await use_mcp_tool({ server_name: "perplexity", tool_name: "deep_research", arguments: { query: "The impact of quantum computing on cryptography", focus_areas: [ "Post-quantum cryptographic algorithms", "Timeline for quantum threats", "Practical mitigation strategies" ], force_model: false // Optional: force using this model even if query seems simple } }); ``` -------------------------------- ### Query with Specific Details Source: https://context7.com/dainfernalcoder/perplexity-mcp/llms.txt Providing specific details such as error messages, code snippets, versions, and environment information in the query leads to more precise and actionable responses, avoiding the 'missing details' note. ```javascript // Better query with specific details - no missing details note const specificResult = await use_mcp_tool({ server_name: "perplexity", tool_name: "reason", arguments: { query: `TypeError: Cannot read property 'map' of undefined at UserList (UserList.tsx:15:23) Code: \`\`\`typescript // UserList.tsx const UserList = ({ users }) => { return users.map(user =>
{user.name}
); }; \`\`\` React 18.2.0, TypeScript 5.3.3, Next.js 14.1.0 on macOS` } }); ``` -------------------------------- ### Debug Errors with Reason Tool Source: https://context7.com/dainfernalcoder/perplexity-mcp/llms.txt Utilize the 'reason' tool to debug specific errors by providing the error message, relevant code context, library versions, and operating system details. ```javascript // Debug a specific error with context const debugResult = await use_mcp_tool({ server_name: "perplexity", tool_name: "reason", arguments: { query: "I'm getting this error in my Node.js 20.11 application:\n\nError: ECONNREFUSED 127.0.0.1:5432\n at TCPConnectWrap.afterConnect [as oncomplete] \n\nI'm using pg library version 8.11.3 on macOS Sonoma.\nThe PostgreSQL server is running (checked with 'brew services list').\nMy connection config:\n{\n host: 'localhost',\n port: 5432,\n database: 'myapp_dev'\n}\n\nWhat could be causing this connection failure?" } }); ``` -------------------------------- ### Contextual Research with Focus Areas and Model Control Source: https://context7.com/dainfernalcoder/perplexity-mcp/llms.txt Perform research with specific technical context using the 'deep_research' tool. You can define `focus_areas` and control model behavior with `force_model` set to `false`. ```javascript // Research with specific technical context const contextualResearch = await use_mcp_tool({ server_name: "perplexity", tool_name: "deep_research", arguments: { query: "Best practices for implementing authentication in Next.js 14 App Router applications", focus_areas: [ "NextAuth.js v5 vs Clerk vs Auth0 comparison", "Server Components authentication patterns", "Middleware-based route protection", "Session management strategies" ], force_model: false } }); ``` -------------------------------- ### Query Lacking Specific Details Source: https://context7.com/dainfernalcoder/perplexity-mcp/llms.txt When a query lacks specific details, the server will note this in the response, prompting the user to provide more context for a better answer. This is useful for debugging vague issues. ```javascript // Query lacking specifics - server will note missing details in response const vagueResult = await use_mcp_tool({ server_name: "perplexity", tool_name: "reason", arguments: { query: "Why is my code not working?" } }); ``` -------------------------------- ### Automatic Query Routing to Search Model Source: https://context7.com/dainfernalcoder/perplexity-mcp/llms.txt This query is automatically routed to the 'search' tool (Sonar Pro) due to its simple factual nature. Ensure the 'server_name' and 'tool_name' are correctly configured. ```javascript await use_mcp_tool({ server_name: "perplexity", tool_name: "search", arguments: { query: "What is TypeScript?" } }); ``` -------------------------------- ### Automatic Query Routing to Deep Research Model Source: https://context7.com/dainfernalcoder/perplexity-mcp/llms.txt Queries with research indicators such as 'analyze', 'comprehensive', or 'explore' are automatically routed to the 'deep_research' tool (Sonar Deep Research). ```javascript // This query will be auto-routed to "deep_research" (Sonar Deep Research) // because it contains research indicators: "analyze", "comprehensive", "explore" await use_mcp_tool({ server_name: "perplexity", tool_name: "search", // Will be upgraded to "deep_research" automatically arguments: { query: "Analyze the comprehensive impact of AI on software development and explore different perspectives" } }); ``` -------------------------------- ### Perform Technical Deep Dive Research Source: https://context7.com/dainfernalcoder/perplexity-mcp/llms.txt Execute a technical deep dive using the 'deep_research' tool without specifying `focus_areas`. This is suitable for broad queries requiring extensive technical information. ```javascript // Technical deep dive without focus areas const techResearch = await use_mcp_tool({ server_name: "perplexity", tool_name: "deep_research", arguments: { query: "Current state of WebAssembly adoption in production environments, performance benchmarks compared to JavaScript, and real-world use cases in 2024" } }); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.