BM

blurrah/mcp-graphql

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

407 stars 62 forks 品質 68 トレンド 19MIT

GraphQL用のモデルコンテキストプロトコルサーバー

概要

LLMがGraphQL APIと相互作用できるようにするモデルコンテキストプロトコルサーバーです。この実装はスキーマの内省およびクエリ実行機能を提供し、モデルがGraphQL APIを動的に発見・利用できるようにします。 mcp-graphqlを正しいエンドポイントで実行すると、自動的にクエリの内省を試みます。 バージョン1.0.0以降、コマンドラインの引数は環境変数に置き換えられています。 - :サーバーはクライアントがアクセスできるリソースとしてGraphQLスキーマを公開します。これはローカルスキーマファイル、URLでホストされたスキーマファイル、または内省クエリに基づくものです。 1. : このツールはGraphQLスキーマを取得します。スキーマをリソースとして利用できない場合は、まずこれを使いましょう。これはローカルスキーマファイル、URLでホストされたスキーマファイル、または内省クエリのいずれかを使用します。 2. : エンドポイントに対してGraphQLクエリを実行します。デフォルトでは、ALLOW_MUTATIONSがtrueに設定されていない限り、ミューテーションは無効化されます。

概要(AI 翻訳)

LLMがGraphQL APIと相互作用できるようにするモデルコンテキストプロトコルサーバーです。この実装はスキーマの内省およびクエリ実行機能を提供し、モデルがGraphQL APIを動的に発見・利用できるようにします。

使用法

正しいエンドポイントでmcp-graphqlを実行すると、自動的にクエリを内省しようとします。

環境変数(1.0.0での変更変更)

注: バージョン1.0.0以降、コマンドラインの引数は環境変数に置き換えられました。

環境変数 説明 デフォルト
ENDPOINT GraphQLエンドポイントURL http://localhost:4000/graphql
HEADERS リクエスト用のヘッダーを含むJSON文字列 {}
ALLOW_MUTATIONS 突然変異操作を有効にする(デフォルトで無効) false
NAME MCPサーバーの名前 mcp-graphql
SCHEMA ローカルのGraphQLスキーマファイルまたはURL(任意)へのパス -

例

リソース

  • graphql-schema:サーバーはクライアントがアクセスできるリソースとしてGraphQLスキーマを公開します。これはローカルスキーマファイル、URLでホストされたスキーマファイル、または内省クエリに基づくものです。

利用可能なツール

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。

README

以下は原文 README の抜粋です。原文を見る。

mcp-graphql

A Model Context Protocol server that enables LLMs to interact with GraphQL APIs. This implementation provides schema introspection and query execution capabilities, allowing models to discover and use GraphQL APIs dynamically.

Usage

Run mcp-graphql with the correct endpoint, it will automatically try to introspect your queries.

Environment Variables (Breaking change in 1.0.0)

Note: As of version 1.0.0, command line arguments have been replaced with environment variables.

Environment Variable Description Default
ENDPOINT GraphQL endpoint URL http://localhost:4000/graphql
HEADERS JSON string containing headers for requests {}
ALLOW_MUTATIONS Enable mutation operations (disabled by default) false
NAME Name of the MCP server mcp-graphql
SCHEMA Path to a local GraphQL schema file or URL (optional) -

Examples

# Basic usage with a local GraphQL server
ENDPOINT=http://localhost:3000/graphql npx mcp-graphql

# Using with custom headers
ENDPOINT=https://api.example.com/graphql HEADERS='{"Authorization":"Bearer token123"}' npx mcp-graphql

# Enable mutation operations
ENDPOINT=http://localhost:3000/graphql ALLOW_MUTATIONS=true npx mcp-graphql

# Using a local schema file instead of introspection
ENDPOINT=http://localhost:3000/graphql SCHEMA=./schema.graphql npx mcp-graphql

# Using a schema file hosted at a URL
ENDPOINT=http://localhost:3000/graphql SCHEMA=https://example.com/schema.graphql npx mcp-graphql

Resources

  • graphql-schema: The server exposes the GraphQL schema as a resource that clients can access. This is either the local schema file, a schema file hosted at a URL, or based on an introspection query.

Available Tools

The server provides two main tools:

  1. introspect-schema: This tool retrieves the GraphQL schema. Use this first if you don’t have access to the schema as a resource. This uses either the local schema file, a schema file hosted at a URL, or an introspection query.

  2. query-graphql: Execute GraphQL queries against the endpoint. By default, mutations are disabled unless ALLOW_MUTATIONS is set to true.

Installation

Installing via Smithery

To install GraphQL MCP Server for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install mcp-graphql --client claude

Installing Manually

It can be manually installed to Claude:

{
    "mcpServers": {
        "mcp-graphql": {
            "command": "npx",
            "args": ["mcp-graphql"],
            "env": {
GitHub で README 全文を見る

インストール

npx mcp-graphql
MCP 初心者?mcpskill.org のガイドから始めましょう →

設定

{ "mcpServers": { "mcp-graphql": { "command": "npx", "args": ["mcp-graphql"], "env": { "ENDPOINT": "http://localhost:3000/graphql" } } } }