home / mcp / graphql schema mcp server

GraphQL Schema MCP Server

GraphQL Schema Model Context Protocol Server

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "hannesj-mcp-graphql-schema": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-graphql-schema",
        "/ABSOLUTE/PATH/TO/schema.graphqls"
      ]
    }
  }
}

You can run a Model Context Protocol (MCP) server that exposes a GraphQL schema to large language models. It lets you explore root fields, types, and definitions, making it easier for LLMs to understand and reason about your GraphQL API.

How to use

Use an MCP client to connect to the GraphQL Schema MCP server. You can run the server locally with a standard schema file, or point it to a specific schema file to tailor the exposed surface. The server provides a set of tools to query fields, types, and definitions, and to search the schema by name or pattern.

How to install

Prerequisites: you need Node.js and npm (or a compatible runtime) installed on your machine.

Install and run the MCP server with the default schema in your current directory or point to a specific schema file.

# Prerequisites
node -v
npm -v

# Run with the default schema.graphqls in the current directory
npx -y mcp-graphql-schema

# Run with a specific schema file (relative path)
npx -y mcp-graphql-schema ../schema.shopify.2025-01.graphqls

# Run with a specific schema file (absolute path)
npx -y mcp-graphql-schema /absolute/path/to/schema.graphqls

# Show help
npx -y mcp-graphql-schema --help

Claude Desktop and Claude Code integration

To integrate with Claude Desktop, configure the MCP server in the client configuration so Claude can start and talk to the server.

Example Claude Desktop configuration using an absolute path to a schema file.

{
  "mcpServers": {
    "GraphQL Schema": {
      "command": "npx",
      "args": ["-y", "mcp-graphql-schema", "/ABSOLUTE/PATH/TO/schema.graphqls"]
    }
  }
}
```

Location of the configuration file:
- macOS/Linux: ~/Library/Application Support/Claude/claude_desktop_config.json
- Windows: $env:AppData\Claude\claude_desktop_config.json

Claude Code CLI usage

You can register the GraphQL Schema MCP server in Claude Code and then query the schema through the tool.

Basic commands to register and manage the MCP server.

# Basic syntax to add the server
claude mcp add graphql-schema npx -y mcp-graphql-schema

# Example with a specific schema
claude mcp add shopify-graphql-schema npx -y mcp-graphql-schema  ~/Projects/work/schema.shopify.2025-01.graphqls

# Verify registration
claude mcp list
claude mcp get graphql-schema

# Remove if needed
claude mcp remove graphql-schema

MCP Tools

The server offers a set of tools to inspect the GraphQL schema and retrieve detailed information for LLM consumption.

- list-query-fields: Lists all available root-level GraphQL query fields - get-query-field: Gets the detailed SDL for a specific query field - list-mutation-fields: Lists all available root-level GraphQL mutation fields - get-mutation-field: Gets the detailed SDL for a specific mutation field - list-subscription-fields: Lists all available root-level subscription fields (if present) - get-subscription-field: Gets the detailed SDL for a specific subscription field - list-types: Lists all types defined in the schema (excluding internal types) - get-type: Gets the detailed SDL for a specific type - get-type-fields: Gets a simplified list of fields with their types for a type - search-schema: Searches for types or fields by name pattern (case-insensitive)"

Examples

Ask questions about the schema to understand its structure and capabilities.

Example queries you can try in your MCP client include:

What query fields are available in this GraphQL schema?
Show me the details of the "user" query field.
What mutation operations can I perform in this schema?
List all types defined in this schema.
Show me the definition of the "Product" type.
List all fields of the "Order" type.
Search for types and fields related to "customer".

Available tools

list-query-fields

Lists all available root-level GraphQL query fields.

get-query-field

Gets detailed definition for a specific query field in SDL format.

list-mutation-fields

Lists all available root-level fields for GraphQL mutations.

get-mutation-field

Gets detailed definition for a specific mutation field in SDL format.

list-subscription-fields

Lists all available root-level fields for GraphQL subscriptions (if present in schema).

get-subscription-field

Gets detailed definition for a specific subscription field.

list-types

Lists all types defined in the GraphQL schema (excluding internal types).

get-type

Gets detailed definition for a specific GraphQL type in SDL format.

get-type-fields

Gets a simplified list of fields with their types for a specific GraphQL object type.

search-schema

Searches for types or fields in the schema by name pattern (case-insensitive regex).