mcp4gql - GraphQL MCP サーバー
このプロジェクトは、Model Context Protocol(MCP)を実装したNode.js/TypeScriptサーバーです。MCPクライアント(Cursorなど)が対象のGraphQL APIとやり取りできるようにするブリッジとして機能します。
特徴
- MCP サーバー:
@modelcontextprotocol/sdk
から MCPServer
クラスを実装します。 - **Stdio トランスポート:**標準入出力を介してクライアントと通信します。
- GraphQL クライアント:
axios
を使用して、構成された GraphQL エンドポイントにリクエストを送信します。 - **汎用 GraphQL ツール:**次のツールを MCP クライアントに公開します。
introspectGraphQLSchema
: イントロスペクションを使用してターゲットの GraphQL API スキーマを取得します。executeGraphQLOperation
:query
、オプションのvariables
、およびオプションのoperationName
を入力として、ターゲット API に対して任意の GraphQL クエリまたはミューテーションを実行します。
構成
サーバーには次の環境変数が必要です。
GRAPHQL_ENDPOINT
: ターゲット GraphQL API の URL。AUTH_TOKEN
: GraphQL API で認証するためのオプションのAuthorization: Bearer <token>
ヘッダーのベアラー トークン。
クライアント構成
Cursor や Claude Desktop などのクライアントがこのサーバーが提供するツールを使用できるようにするには、 npx
コマンドを実行するようにクライアントを構成する必要があります。
カーソル
- カーソルMCP設定に移動します(カーソル > 設定 > カーソル設定 > MCP)
- 新しいグローバルMCPサーバーを追加に移動します
- カーソル MCP 構成に以下を追加します。
クロードデスクトップ
- Claude デスクトップの設定を開きます (Claude > 設定)。
- 「開発者 > 構成の編集」に移動します。
- 設定に追加:
設定が完了すると、MCPクライアントは、このサーバーが提供するintrospectGraphQLSchema
およびexecuteGraphQLOperation
ツールを必要に応じて一覧表示し、呼び出すことができるようになります。サーバーがAPIに接続できるように、必要な環境変数( GRAPHQL_ENDPOINT
およびオプションでAUTH_TOKEN
)を設定してください。
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.
GraphQL MCP サーバーはブリッジとして機能し、MCP クライアント (Cursor や Claude Desktop など) がスキーマ イントロスペクションと操作実行のための標準ツールを通じてターゲット GraphQL API と対話できるようにします。
Related Resources
Related MCP Servers
- AsecurityAlicenseAqualityMCP for working with GraphQL servers.Last updated -2470242TypeScriptMIT License
- -securityAlicense-qualityA MCP server that exposes GraphQL schema information to LLMs like Claude. This server allows an LLM to explore and understand large GraphQL schemas through a set of specialized tools, without needing to load the whole schema into the contextLast updated -639JavaScriptMIT License
- -securityAlicense-qualityAn MCP server that connects any MCP client (like Claude or Cursor) with the browser using browser-use, allowing clients to utilize existing LLMs without requiring additional API keys.Last updated -74PythonApache 2.0
- -securityFlicense-qualityA server that allows you to explore the GitHub GraphQL schema and execute GraphQL queries through MCP client tools, enabling efficient data retrieval from GitHub with reduced token consumption.Last updated -4Python