@supabase/mcp-server-postgrest
これはPostgREST用のMCPサーバーです。LLMがREST API経由でアプリのCRUD操作を実行できるようになります。
このサーバーは、Supabase プロジェクト (PostgREST を実行) および任意のスタンドアロン PostgREST サーバーで動作します。
ツール
利用可能なツールは次のとおりです。
postgrestRequest
設定されたPostgRESTサーバーへのHTTPリクエストを実行します。以下の引数を受け入れます。
method
: 使用するHTTPメソッド(例:GET
、POST
、PATCH
、DELETE
)path
: クエリするパス (例:/todos?id=eq.1
)body
: リクエスト本体(POST
およびPATCH
リクエストの場合)
GET
リクエストの選択された行と、 POST
およびPATCH
リクエストの更新された行を含む、PostgREST サーバーからの JSON 応答を返します。
sqlToRest
SQLクエリを、メソッドとパスとして同等のPostgREST構文に変換します。LLMでは有効なPostgREST構文への変換が困難な複雑なクエリに役立ちます。
PostgRESTはSQLのサブセットのみをサポートしているため、すべてのクエリが変換されるわけではないことに注意してください。詳細についてはsql-to-rest
をご覧ください。
次の引数を受け入れます:
sql
: 変換する SQL クエリ。
リクエストのmethod
とpath
プロパティを含むオブジェクトを返します。LLMはpostgrestRequest
ツールを使用してリクエストを実行できます。
使用法
クロード・デスクトップ
Claude Desktopは、モデルコンテキストプロトコルをサポートする人気のLLMクライアントです。PostgRESTサーバーをClaude Desktopに接続することで、自然言語コマンドを使ってデータベースにクエリを実行できます。
次の設定ファイルを使用して、Claude Desktop に MCP サーバーを追加できます。
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:
%APPDATA%\Claude\claude_desktop_config.json
Supabase プロジェクト*(または任意の PostgREST サーバー)*を Claude Desktop に追加するには、構成ファイルのmcpServers
オブジェクトに次の構成を追加します。
構成
apiUrl
: PostgRESTエンドポイントのベースURLapiKey
: 認証用のAPIキー*(オプション)*schema
: APIを提供するPostgresスキーマ(例:public
)。public以外のスキーマは、PostgRESTから手動で公開する必要があることに注意してください。
プログラムで(カスタム MCP クライアント)
独自のMCPクライアントを構築する場合は、お好みのトランスポートを使用してプログラム的にPostgRESTサーバーに接続できます。MCP SDKには、組み込みのstdioおよびSSEトランスポートが用意されています。また、メモリ内でMCPサーバーに直接接続したり、独自のストリームベースのトランスポートを介して接続したりしたい場合は、 StreamTransport
もご利用いただけます。
インストール
例
次の例では、 StreamTransport
を使用して MCP クライアントとサーバー間を直接接続します。
This server cannot be installed
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.
これはPostgREST用のMCPサーバーです。LLMがPostgRESTを介してPostgresデータベースへのデータベースクエリと操作を実行できるようにします。このサーバーは、PostgRESTを使用するSupabaseプロジェクトとスタンドアロンのPostgRESTサーバーの両方で動作します。
Related Resources
Related MCP Servers
- AsecurityAlicenseAqualityThis server enables interaction with Supabase PostgreSQL databases through the MCP protocol, allowing seamless integration with Cursor and Windsurf IDEs for secure and validated database management.Last updated -11699PythonApache 2.0
- -securityAlicense-qualityAn MCP server that connects to Supabase PostgreSQL databases, exposing table schemas as resources and providing tools for data analysis through SQL queries.Last updated -JavaScriptMIT License
- -securityAlicense-qualityAn MCP server that enables natural language querying of Supabase PostgreSQL databases using Claude 3.7, allowing users to inspect schemas, execute SQL, manage migrations, and convert natural language to SQL queries.Last updated -PythonMIT License
- -securityFlicense-qualityPG-MCP is an HTTP server implementation that enables AI systems to interact with PostgreSQL databases via MCP, providing tools for querying, connecting to multiple databases, and exploring schema resources. The system enriches context by extracting table/column description from database catalogs.Last updated -8