Skip to main content
Glama
mkusaka

Perplexity AI MCP Server

by mkusaka
README.md
# Perplexity AI MCP Server

An MCP server implementation that integrates Perplexity AI's API, providing advanced search capabilities with multiple model options.

## Features

- Search using Perplexity AI's models
- Support for all official Sonar models
- Configurable result count
- Detailed error handling and logging
- MCP Inspector compatible

## Available Models

- sonar-reasoning-pro (127k context)
- sonar-reasoning (127k context)
- sonar-pro (200k context)
- sonar (127k context)

## Installation

```bash
pnpm install
pnpm build
```

## Configuration

### API Key
1. Sign up for a [Perplexity AI account](https://www.perplexity.ai)
2. Get your API key from the dashboard
3. Set the environment variable:
```bash
export PERPLEXITY_API_KEY=your_api_key_here
```

## Usage

### Direct Execution
```bash
node dist/index.js
# or if you made it executable
./dist/index.js
```

### Development
```bash
pnpm dev
```

### Testing with MCP Inspector
```bash
pnpm inspect
```

## Tool Reference

### perplexity_search

Performs a search using Perplexity AI's models.

Parameters:
- `query` (string, required): The search query
- `model` (string, optional): Model to use (default: "sonar")
  - Available options: sonar-reasoning-pro, sonar-reasoning, sonar-pro, sonar
- `count` (number, optional): Number of results (1-10, default: 5)

## Development

### Project Structure
```
src/perplexity/
├── index.ts        # Main server implementation
├── lib/
│   └── logger.ts   # Logging configuration
└── adr.md         # Architectural decisions
```

### Logging
Logs are written to `perplexity-mcp.log` in the project root directory.

## License

MIT

## Contributing

1. Fork the repository
2. Create your feature branch
3. Commit your changes
4. Push to the branch
5. Create a new Pull Request

TDQS

B3.1/5.0

Scored across 1 tool

Disambiguation5/5

With only one tool, there is no possibility of ambiguity or overlap between tools. The tool's purpose is clearly defined as searching using Perplexity AI's models, making it distinct by default.

Naming Consistency5/5

The single tool name 'perplexity_search' follows a clear and consistent verb_noun pattern (search as the verb, perplexity as a modifier). With only one tool, naming consistency is inherently perfect as there are no other tools to compare against.

Tool Count2/5

A single tool is generally too few for most server purposes, as it limits functionality and flexibility. For a search-focused server, additional tools like filtering, citation management, or model selection might be expected to provide a more complete experience.

Completeness2/5

The server's domain appears to be search using Perplexity AI, but with only one search tool, there are significant gaps. Missing operations could include advanced search parameters, result refinement, citation handling, or integration with other Perplexity features, making the surface incomplete for typical search workflows.

Maintenance

ActivityInactive
ResponsivenessNo issues