Perplexity Advanced MCP

by code-yeongyu
Verified

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Provides integration with GitHub for source code hosting and version control.

  • Provides a tool for asking internet search queries through Perplexity AI, supporting both simple and complex queries with file attachment capabilities. Optimized for different query types to balance cost and performance.

  • Enables distribution of the package through the Python Package Index, allowing users to install the MCP via pip or uvx.

困惑の高度なMCP

韓国語


概要

Perplexity Advanced MCPは、 OpenRouterおよびPerplexity APIを活用し、強化されたクエリ処理機能を提供する高度な統合パッケージです。直感的なコマンドラインインターフェースと堅牢なAPIクライアントを備えたこのパッケージは、単純なクエリから複雑なクエリまで、AIモデルとのシームレスな連携を実現します。

perplexity-mcpとの比較

perplexity-mcp はPerplexity AI の API を使用して基本的な Web 検索機能を提供しますが、Perplexity Advanced MCP はいくつかの追加機能を提供します。

  • マルチベンダーサポート: Perplexity APIとOpenRouter APIの両方をサポートし、プロバイダーを柔軟に選択できます。
  • **クエリタイプの最適化:**単純なクエリと複雑なクエリを区別し、コストとパフォーマンスを最適化します。
  • **ファイル添付のサポート:**クエリにファイルの内容をコンテキストとして含めることができるため、より正確でコンテキストに基づいた応答が可能になります。
  • **強化された再試行ロジック:**信頼性を向上させる堅牢な再試行メカニズムを実装します

全体として、これはClineCursorなどのエディターと統合されたときにコードベースを処理するのに最も適した MCP です。

特徴

  • **統合 API クライアント:**単純なクエリと複雑なクエリを処理するための構成可能なモデルを備えたOpenRouter API とPerplexity API の両方をサポートします。
  • コマンドライン インターフェイス (CLI): Typerを使用して API キー構成を管理し、MCP サーバーを実行します。
  • **高度なクエリ処理:**ファイル添付処理を組み込んでおり、クエリにコンテキスト データを含めることができます。
  • **堅牢な再試行メカニズム:**再試行ロジックに Tenacity を利用して、一貫性と信頼性の高い API 通信を確保します。
  • **カスタマイズ可能なログ記録:**詳細なデバッグと実行時監視のための柔軟なログ記録構成。

最適なAI構成

AI アシスタント (例: CursorClaude for Desktop ) を最大限に活用するには、プロジェクトの指示または AI ルールに次の構成を追加することをお勧めします。

<perplexity-advanced-mcp> <description> Perplexity is an LLM that can search the internet, gather information, and answer users' queries. For example, let's suppose we want to find out the latest version of Python. 1. You would search on Google. 2. Then read the top two or three results directly to verify. Perplexity does that work for you. To answer a user's query, Perplexity searches, opens the top search results, finds information on those websites, and then provides the answer. Perplexity can be used with two types of queries: simple and complex. Choosing the right query type to fulfill the user's request is most important. </description> <simple-query> <description> It's cheap and fast. However, it's not suitable for complex queries. On average, it's more than 10 times cheaper and 3 times faster than complex queries. Use it for simple questions such as "What is the latest version of Python?" </description> <pricing> $1/M input tokens $1/M output tokens </pricing> </simple-query> <complex-query> <description> It's slower and more expensive. Compared to simple queries, it's on average more than 10 times more expensive and 3 times slower. Use it for more complex requests like "Analyze the attached code to examine the current status of a specific library and create a migration plan." </description> <pricing> $1/M input tokens $5/M output tokens </pricing> </complex-query> <instruction> When reviewing the user's request, if you find anything unexpected, uncertain, or questionable, **and you think you can get answer from the internet**, do not hesitate to use the "ask_perplexity" tool to consult Perplexity. However, if the internet is not required to satisfy users' request, it's meaningless to ask to perplexity. Since Perplexity is also an LLM, prompt engineering techniques are paramount. Remember the basics of prompt engineering, such as providing clear instructions, sufficient context, and examples Include as much context and relevant files as possible to smoothly fulfill the user's request. When adding files as attachments, make sure they are absolute paths. </instruction> </perplexity-advanced-mcp>

この構成により、AI アシスタントは Perplexity 検索機能をいつどのように使用するかをより適切に理解できるようになり、コストとパフォーマンスの両方が最適化されます。

使用法

Smithery経由でインストール

Smithery経由で Claude Desktop 用の Perplexity Advanced MCP を自動的にインストールするには:

npx -y @smithery/cli install @code-yeongyu/perplexity-advanced-mcp --client claude

uvxのクイックスタート

MCP サーバーを実行する最も簡単な方法は、 uvxを使用することです。

uvx perplexity-advanced-mcp -o <openrouter_api_key> # or -p <perplexity_api_key>

環境変数を使用して API キーを構成することもできます。

export OPENROUTER_API_KEY="your_key_here" # or export PERPLEXITY_API_KEY="your_key_here" uvx perplexity-advanced-mcp

注記:

  • OpenRouterとPerplexity APIキーを同時に提供するとエラーが発生します。
  • CLI引数と環境変数の両方が指定されている場合は、CLI引数が優先されます。

CLI はTyperを使用して構築されており、ユーザーフレンドリーなコマンドラインエクスペリエンスを保証します。

MCP検索ツール

このパッケージには、 ask_perplexity関数を介して統合されたMCP検索ツールが含まれています。単純なクエリと複雑なクエリの両方をサポートし、添付ファイルを処理して追加のコンテキストを提供します。

  • **シンプルなクエリ:**高速で効率的な応答を提供します。
  • **複雑なクエリ:**詳細な推論を実行し、XML 形式のファイル添付をサポートします。

構成

  • **API キー:**コマンドライン オプションまたは環境変数を使用して、 OPENROUTER_API_KEYまたはPERPLEXITY_API_KEYいずれかを構成します。
  • **モデルの選択:**構成 ( src/perplexity_advanced_mcp/config.py内) は、クエリ タイプを特定のモデルにマッピングします。
    • オープンルーター:
      • シンプルなクエリ: perplexity/sonar
      • 複雑なクエリ: perplexity/sonar-reasoning
    • 困惑
      • シンプルなクエリ: sonar-pro
      • 複雑なクエリ: sonar-reasoning-pro

開発の背景と理念

このプロジェクトは、私の個人的な好奇心と実験から生まれました。最近の「バイブコーディング」のトレンドに倣い、コードの95%以上をCline + Cursor IDEで作成しました。「話すのは簡単、コードを見せて」と言われますが、 Wispr Flowの音声テキスト変換機能を使えば、文字通り話しかけるだけでコードが表示されました!開発の大部分は、「xyzのコードを書いて、ここのバグをxy zに修正して」などと指示してEnterキーを押すだけで完了しました。驚くべきことに、この完全に機能するプロジェクトの作成には数時間もかかりませんでした。

プロジェクトのスキャフォールディングからファイル構造まで、すべてLLMで作成・レビューされました。PyPI公開のためのGitHub Actionsワークフローやリリース承認プロセスもCursorで処理されました。人間の開発者としての私の役割は以下のとおりです。

  • AIが適切なテストを実施できるようにMCPサーバーの起動と停止を行う
  • 問題が発生した場合はエラーログをコピーして提供する
  • インターネットからPython MCP SDKのドキュメントとサンプルを見つけて提供する
  • 正しくないと思われるコードの変更を依頼する

多くのものが自動化され、代替される今日の世界において、このMCPが、コードを書く以上の価値を見出すために活用する皆さんのような開発者の助けとなることを願っています。このツールが、より高度な意思決定と検討ができる新時代の開発者へと成長するための一助となりますように。

発達

このパッケージに貢献または変更するには:

1.リポジトリのクローンを作成します。

gh repo clone code-yeongyu/perplexity-advanced-mcp

2.依存関係をインストールします。

uv sync

3.貢献する:

貢献を歓迎します!既存のコードスタイルとコミットガイドラインに従ってください。

ライセンス

このプロジェクトは MIT ライセンスに基づいてライセンスされています。

-
security - not tested
F
license - not found
-
quality - not tested

OpenRouter および Perplexity API を活用して強化された Web 検索機能を提供し、ファイル添付のサポートによる単純なクエリ処理と複雑なクエリ処理の両方を提供する高度な統合パッケージです。

  1. Overview
    1. Comparison with perplexity-mcp
      1. Features
        1. Optimal AI Configuration
          1. Usage
            1. Installing via Smithery
            2. Quick Start with uvx
            3. MCP Search Tool
          2. Configuration
            1. Development Background & Philosophy
              1. Development
                1. 1. Clone the Repository:
                2. 2. Install Dependencies:
                3. 3. Contribute:
              2. License
                ID: sok882f31z