Perplexity MCP Server
About
Perform real-time internet research with source citations using the Perplexity API.
Details
- Author
- gomcpgo
- Categories
- Search, Other, AI
Jump to
Setup
Install Perplexity MCP Server in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/gomcpgo/perplexity-mcp-server
Follow the installation instructions in the repository README, then restart your MCP client.
Perform real-time internet research with source citations using the Perplexity API.
An MCP (Model Context Protocol) server that provides access to Perplexity AI's powerful search capabilities, including web search, academic research, financial data, and advanced filtering options.
The Perplexity MCP server offerssix functionsfor comprehensive search and result management:
Each optimized for different use cases.All functions automatically return source URLsand save results locally if caching is enabled.
-
perplexity_search: General web search with real-time information. Best for current events, general knowledge, and quick facts.
perplexity_academic_search: Automatically filters to academic sources (arxiv.org, pubmed, journals). Best for research papers, scientific studies, and scholarly content.
perplexity_financial_search: Optimized for financial domains and recent data. Best for stock analysis, earnings reports, SEC filings, and market trends.
perplexity_filtered_search: Advanced search with multiple filtering options. Best when you need specific domain filtering, content types, or location-based results.
Manage previously saved search results for easy reference and reuse.
-
list_previous: List all previous search queries with unique IDs, sorted by recency. Returns JSON array with query details.
get_previous_result: Retrieve a previously cached search result by its unique 10-character ID.
- Ensure you have Go 1.23 or later installed
- Clone this repository
- Build the server:
./run.sh build
The server requires a Perplexity API key and supports various configuration options through environment variables:
- PERPLEXITY_API_KEY: Your Perplexity AI API key
- PERPLEXITY_DEFAULT_MODEL: Default model to use (default: "sonar")
- sonar: Fast, cost-effective search for quick facts
- sonar-pro: Comprehensive search with better depth and coverage
export PERPLEXITY_API_KEY="your-api-key" ./run.sh run # or directly: ./perplexity
Test individual functions directly from the command line:
export PERPLEXITY_API_KEY="your-api-key" # Test different search types ./run.sh search "latest AI news" sonar-pro ./run.sh academic "quantum computing" sonar-pro ./run.sh financial "AAPL earnings" sonar-pro ./run.sh filtered "renewable energy" sonar-pro # Cache management ./run.sh list # List previous queries ./run.sh get ABC123XYZ0 # Get cached result by ID
Run integration tests against the real Perplexity API:
export PERPLEXITY_API_KEY="your-api-key" ./run.sh integration-test
To use this server with an MCP client, add it to your client configuration:
{ "servers": { "perplexity": { "command": "path/to/perplexity", "env": { "PERPLEXITY_API_KEY": "your-api-key" } } } }
The server automatically caches search results whenPERPLEXITY_RESULTS_ROOT_FOLDERis configured:
- Storage: Each result is saved in/unique_id/result.mdwith metadata in/unique_id/metadata.yaml
- Unique IDs: 10-character alphanumeric identifiers (e.g.,A1B2C3D4E5)
- Result ID: When caching is enabled, search responses includeResult ID: ABC123XYZ0
- No Reuse: Each search creates a new cached entry, even for identical queries
- LLM Integration: Perfect for LLMs to reference previous searches in conversations
# List previous searches echo '{"method": "tools/call", "params": {"name": "list_previous", "arguments": {}}}' | ./perplexity # Get specific result echo '{"method": "tools/call", "params": {"name": "get_previous_result", "arguments": {"unique_id": "A1B2C3D4E5"}}}' | ./perplexity
- query(required): The search query
- model: Choose 'sonar' for quick searches or 'sonar-pro' for comprehensive results (default: sonar)
- search_domain_filter: Array of domains to include
- search_exclude_domains: Array of domains to exclude
- search_recency_filter: Time filter (hour, day, week, month, year)
- return_images: Include images
- return_related_questions: Include related questions
- max_tokens: Maximum response tokens
- temperature: Response randomness (0-2)
- date_range_start: Start date (YYYY-MM-DD)
- date_range_end: End date (YYYY-MM-DD)
- location: Geo-specific search location
{ "query": "latest AI developments", "model": "sonar-pro", "search_recency_filter": "week", "return_citations": true }
Search academic papers and scholarly content.
- query(required): The academic search query
- subject_area: Academic subject (e.g., "Physics", "Computer Science")
- model: Defaults to 'sonar-pro' for comprehensive academic results
- search_domain_filter: Array of academic domains
- search_recency_filter: Time filter
- max_tokens: Maximum response tokens
- temperature: Response randomness
{ "query": "quantum computing applications", "subject_area": "Physics", "search_recency_filter": "year" }
- query(required): The financial search query
- ticker: Stock ticker symbol (e.g., "AAPL")
- company_name: Company name
- report_type: Financial report type (e.g., "10-K", "10-Q", "8-K")
- model: Defaults to 'sonar-pro' for comprehensive financial data
- search_recency_filter: Time filter
- date_range_start: Report start date
- date_range_end: Report end date
- max_tokens: Maximum response tokens
{ "query": "quarterly earnings", "ticker": "MSFT", "report_type": "10-Q", "search_recency_filter": "month" }
Advanced search with comprehensive filtering.
- query(required): The search query
- model: Choose based on needs (defaults to sonar-pro)
- search_domain_filter: Array of domains to include
- search_exclude_domains: Array of domains to exclude
- search_recency_filter: Time filter
- content_type: Type of content (news, academic, blog, etc.)
- file_type: File type filter (pdf, doc, html, etc.)
- language: Language filter
- country: Country for geo-specific search
- date_range_start: Start date
- date_range_end: End date
- return_citations: Include citations
- return_images: Include images
- return_related_questions: Include related questions
- max_tokens: Maximum response tokens
- temperature: Response randomness
- custom_filters: Object with additional key-value filters
{ "query": "renewable energy innovations", "content_type": "news", "language": "English", "country": "Germany", "search_recency_filter": "month", "custom_filters": { "industry": "energy", "technology": "solar" } }
List all previous search queries with metadata.
Response:JSON array with query history, sorted by recency (most recent first).
[ { "query": "latest AI developments", "unique_id": "A1B2C3D4E5", "datetime": "2025-01-15T10:30:45Z", "search_type": "general" }, { "query": "quantum computing research", "unique_id": "X9Y8Z7W6V5", "datetime": "2025-01-15T09:15:30Z", "search_type": "academic" } ]
Retrieve a cached search result by unique ID.
- unique_id(required): The 10-character alphanumeric ID of the cached result
Returns:The complete markdown result from the cached search.
{ "unique_id": "A1B2C3D4E5" }
All search functions return responses in the following format:
- Main Content: The search results and answer
- Source URLs: A list of source URLs that the LLM can fetch for more details
- Detailed Sources(if available): Title, URL, and snippet for each source
- Related Questions(if requested): Suggested follow-up questions
- Result ID(if caching enabled): Unique 10-character ID for retrieving this result later
[Main search results content...] ## Source URLs 1. https://example.com/article1 2. https://example.com/article2 3. https://example.com/article3 ## Detailed Sources 1. Article Title URL: https://example.com/article1 Snippet: Brief excerpt from the article... ## Related Questions - What are the latest developments? - How does this compare to...? Result ID: A1B2C3D4E5
The server follows clean architecture principles with separation of concerns:
perplexity/ ├── cmd/ │ └── main.go # Thin entry point with terminal mode (~200 lines) ├── pkg/ │ ├── handler/ # MCP protocol layer │ │ ├── handler.go # Main MCP handler │ │ ├── tools.go # Tool definitions │ │ └── search_handlers.go # Parameter extraction │ ├── search/ # Core business logic │ │ ├── types.go # Local search types │ │ ├── search.go # Strongly-typed search functions │ │ └── client.go # Perplexity API client │ ├── cache/ # Result caching system │ ├── config/ # Configuration management │ └── types/ # Perplexity API types ├── test/ │ └── test.go # Integration tests └── README.md
- Thin main.go: Reduced from 360 to 197 lines (45% reduction)
- Terminal mode: Direct CLI testing without MCP protocol overhead
- Separation of concerns: MCP protocol handling separate from business logic
- Strongly-typed: Core functions use proper Go structs instead ofmap[string]interface{}
- Local types: Each package owns its types, preventing circular dependencies
- Easy testing: Business logic can be tested independently
The server handles various error conditions:
- Invalid or missing API key (401)
- Rate limiting (429)
- Invalid parameters (400)
- Server errors (500)
Errors are returned with descriptive messages to help diagnose issues.
MIT License - see LICENSE file for details.
Search global news using natural language. Webz.io News Search API returns the most relevant articles and content, with filters for source, country, language, date, sentiment, and category.
A connector for the Perplexity API to enable web search within the MCP ecosystem.
Structural AI Search Readiness MCP. Audit, dry-run fixes, rescore, doctor. No LLM rankings.
Perform web searches with the Brave Search API and analyze research papers using Google's Gemini model.
Provides AI-powered web search and summarization using the Gemini API's grounding feature.
Integrate search grounded Gemini output into your workflow.
Generates responses using the Gemini API and Google Search for up-to-date information.
Performs web searches using the Gemini Web Search Tool via the local gemini-cli.
A server providing Google AI-powered search and documentation tools for developers.
Comprehensive web, news, and social media search and analysis using xAI's Grok API.
Enhances LLM responses with factual, real-time web content using Jina AI's grounding capabilities.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.




