feat: add Tavily as alternative search provider alongside Perplexity#16
Open
tavily-integrations wants to merge 2 commits into
Open
Conversation
added 2 commits
May 21, 2026 14:05
…le search provider in perplexity-mcp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Tavily as a configurable search backend alongside the existing Perplexity AI provider. The search provider is selected via the
SEARCH_PROVIDERenvironment variable (perplexityby default, ortavily).What changed
src/perplexity_mcp/server.py: Addedcall_tavily()function using thetavily-pythonSDK (TavilyClient.search()withsearch_depth="advanced"andtime_rangemapped from the existing recency parameter). Updatedcall_tooldispatcher to branch onSEARCH_PROVIDERenv var. Updatedmain()andmain_async()startup validation to requireTAVILY_API_KEYwhenSEARCH_PROVIDER=tavily, and log which provider is active.pyproject.toml: Addedtavily-python>=0.5to project dependencies.README.md: DocumentedSEARCH_PROVIDERandTAVILY_API_KEYenvironment variables and updated config example.Dependency changes
tavily-python>=0.5topyproject.tomldependenciesEnvironment variable changes
SEARCH_PROVIDER(optional, default:perplexity, values:perplexity|tavily)TAVILY_API_KEY(required whenSEARCH_PROVIDER=tavily)Notes for reviewers
time_rangeparameter accepts the same values (day,week,month,year) as the existingrecencyparameter, so no mapping conversion is needed.Automated Review
SEARCH_PROVIDERenv var.AsyncTavilyClientis used and properly awaited, therecency→time_rangemapping is 1:1 with Tavily's accepted enum values (day/week/month/year), error handling is present,pyproject.tomlgains thetavily-python>=0.5dependency, and README documents the new env vars. Existing Perplexity behavior is fully preserved as the default path. No critical or major issues found.