ussi69-dotcom/server-perplexity-ask-wsl2
If you are the rightful owner of server-perplexity-ask-wsl2 and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
MCP server for Perplexity AI API with WSL2 IPv4 compatibility fix.
server-perplexity-ask-wsl2
MCP (Model Context Protocol) server for Perplexity AI API with WSL2 IPv4 compatibility fix.
Why this fork?
The original server-perplexity-ask package uses Node.js native fetch() which has issues with IPv6 on WSL2 (Windows Subsystem for Linux 2). This causes ETIMEDOUT errors even when curl works fine.
This fork fixes the issue by using the https module with family: 4 to force IPv4 connections.
Installation
For Claude Code (MCP)
Add to your ~/.claude.json:
{
"mcpServers": {
"perplexity-ask": {
"type": "stdio",
"command": "npx",
"args": ["-y", "server-perplexity-ask-wsl2"],
"env": {
"PERPLEXITY_API_KEY": "your-api-key-here"
}
}
}
}
Manual installation
npm install -g server-perplexity-ask-wsl2
Configuration
Set your Perplexity API key as an environment variable:
export PERPLEXITY_API_KEY="pplx-your-api-key"
Get your API key from: https://www.perplexity.ai/settings/api
Usage
The server provides a single tool perplexity_ask that accepts an array of messages:
{
"messages": [
{"role": "user", "content": "What are the latest AI news?"}
]
}
The WSL2 Fix
The key change is in how we make HTTP requests:
// Before (broken on WSL2):
fetch(url, options)
// After (works on WSL2):
const https = require('https');
https.request({
...options,
family: 4 // Force IPv4
})
Why does this happen?
- WSL2 has inconsistent IPv6 connectivity
- Node.js
fetch()tries IPv6 first, waits for timeout, then fails curlworks because it tries IPv4/IPv6 in parallel- Using
family: 4forces IPv4-only connections
Model
This server uses sonar-pro model by default. See Perplexity API docs for available models.
License
MIT
Credits
- Original package: server-perplexity-ask
- WSL2 fix by: @ussi69-dotcom