PerplexitySearchBridge
A utility for integrating advanced, citation-backed web intelligence retrieval via the Perplexity AI service interface, substantially improving factual grounding in informational tasks.
Author

letsbuildagent
Quick Info
Actions
Tags
Perplexity Retrieval Agent for Claude Desktop
This custom Machine Configuration Package (MCP) module establishes a direct link between Claude Desktop and the Perplexity AI Application Programming Interface (API), enabling the model to conduct verifiable, web-sourced investigations and furnish responses annotated with source references.
Setup Prerequisites
Dependency Installation
1. Git Management System: - macOS Users: Utilize Homebrew for installation. - First, establish Homebrew via the Terminal: bash /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Then, secure Git:
bash
brew install git
- Windows Users: Obtain the installer package from git-scm.com and execute the setup wizard.
2. Node.js Runtime Environment: - macOS Users: Employ Homebrew: bash brew install node
- Windows Users: Download the appropriate installer from nodejs.org and complete the installation process.
3. Validation Checks: Confirm successful installation by invoking: bash git --version node --version
Module Deployment
1. Repository Acquisition: bash git clone https://github.com/letsbuildagent/perplexity-tool cd perplexity-tool
2. Dependency Loading: bash npm install
3. API Credential Configuration:
Choose one of the following two methods to secure your access token:
-
Method A (Rapid Initialization):
- Edit the
server.jsfile. -
Locate and substitute the placeholder: javascript const PERPLEXITY_API_KEY = "YOUR-API-KEY-HERE";
-
Insert your actual Perplexity credential.
- Edit the
-
Method B (Secure Environment Variables - Recommended):
- Generate a configuration file named
.env: bash # Unix-like systems: touch .env open .env
# Windows (using command prompt): notepad .env
(Alternatively, create the file manually in your preferred text editor.) - Populate the
.envfile with your key:PERPLEXITY_API_KEY=your-api-key-here
-
Ensure the
dotenvpackage is installed: bash npm install dotenv -
Update
server.jsto load the variable: javascript import 'dotenv/config' const PERPLEXITY_API_KEY = process.env.PERPLEXITY_API_KEY;
- Generate a configuration file named
4. Claude Desktop Integration:
- Navigate to the configuration file, typically located at
~/Library/Application Support/Claude/claude_desktop_config.json. - Augment the file content by incorporating this structure within the main configuration object:
{ "mcpServers": { "perplexity-tool": { "command": "node", "args": [ "/absolute/path/to/perplexity-tool/server.js" ] } } }
Crucially, substitute /absolute/path/to with the full, resolved directory where you cloned the repository.
5. System Restart: Relaunch the Claude Desktop application to enable the new tool.
Operational Guidelines
Once successfully deployed, direct Claude to utilize the tool via prompts such as:
- "Consult Perplexity regarding recent advancements in large language models."
- "Leverage Perplexity for a historical overview of solid-state physics concepts."
- "Query Perplexity on global renewable energy trends, restricted to the past six months' data."
Fine-Tuning Parameters
Advanced utilization permits the specification of runtime directives:
- temperature: Affects result novelty/creativity (range: 0.0 to 2.0).
- max_tokens: Establishes an upper bound on the generated response length.
- search_domain_filter: Limits the search scope to predefined web zones.
- search_recency_filter: Constrains results based on publication timestamp (e.g., day, week, month, year).
Troubleshooting Guide
1. 'Git Command Not Recognized': - Verify a correct Git installation. - Restart your shell environment. - On macOS, confirm Homebrew's directories are correctly registered in the system PATH.
2. Node.js Execution Failures:
- Reconfirm Node.js functionality using node --version.
- Consider a clean reinstallation of Node.js.
3. API Credential Malfunctions:
- Double-check that the key string was copied without extraneous whitespace.
- If using Method B, validate that the dotenv dependency package is present.
4. Tool Invisibility in Claude Interface:
- Scrutinize the file path specified in claude_desktop_config.json.
- Ensure the path explicitly targets the server.js executable.
- Perform a full restart of Claude Desktop.
- Examine the developer console output for runtime exceptions.
Licensing
This project is distributed under the MIT License.
Security Advisory
If this implementation is intended for public deployment or source sharing:
- Never commit sensitive API keys directly into version control systems (like Git).
- Always favor the environment variable configuration (Method B).
- Ensure the .env file is explicitly listed in your .gitignore file.
