Skip to content

Undocumented Environment Variable for Model Selection in Perplexity MCP Server #27

@aollivierre

Description

@aollivierre

Issue Summary

The Perplexity MCP Server appears to support model configuration through the PERPLEXITY_MODEL environment variable, but this capability is completely undocumented in the README and not obvious from the source code examined.

Description

When setting up the Perplexity MCP Server according to documentation, there is no mention of the ability to configure which Perplexity model is used (sonar-pro, sonar-reasoning-pro, sonar-deep-research). Looking at the source code, the models appear to be hardcoded for each tool:

  • perplexity_ask uses "sonar-pro"
  • perplexity_research uses "sonar-deep-research"
  • perplexity_reason uses "sonar-reasoning-pro"

However, through experimentation, I discovered that the PERPLEXITY_MODEL environment variable is actually respected by the server when set, allowing users to customize which model is used without modifying code. This is an important feature that should be documented.

Steps to Reproduce

  1. Clone the repository
  2. Set up the MCP server according to documentation
  3. Add a PERPLEXITY_MODEL environment variable to the MCP configuration
{
  "mcpServers": {
    "perplexity-ask": {
      "command": "npx",
      "args": ["-y", "server-perplexity-ask"],
      "env": {
        "PERPLEXITY_API_KEY": "YOUR_API_KEY_HERE",
        "PERPLEXITY_MODEL": "sonar-reasoning-pro"
      }
    }
  }
}
  1. Observe that the server uses the specified model rather than defaulting to "sonar-pro"

Expected Behavior

Documentation should clearly indicate:

  1. Available environment variables for configuration
  2. Supported models (sonar-pro, sonar-reasoning-pro, sonar-deep-research)
  3. Default values for each parameter
  4. How to specify these values in MCP configurations

Actual Behavior

The feature exists but is completely undocumented, leading users to believe they must modify source code to change models. Only through trial and error did I discover this functionality.

Suggested Documentation Updates

  1. Add a "Configuration" section to the README listing all supported environment variables
  2. Include a table showing available models and their use cases
  3. Provide example configurations for different models
  4. Update the code comments to highlight this configuration option

Environment Details

  • Windows 10
  • Node.js v18+
  • MCP server version: 0.1.0
  • Integration with Cursor IDE

Additional Context

The ability to select models is particularly important for users who need reasoning capabilities (sonar-reasoning-pro) versus general knowledge (sonar-pro), as the reasoning model provides significantly different responses to philosophical or analytical questions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions