GraphQL Schema MCP server

Enables AI models to explore and understand GraphQL schemas through specialized tools for querying operations, looking up type definitions, pattern matching, and retrieving simplified field information.
Back to servers
Setup instructions
Provider
Hannes Junnila
Release date
Mar 13, 2025
Language
TypeScript
Package
Stats
465 downloads
39 stars

This MCP server enables large language models like Claude to explore and understand GraphQL schemas through specialized tools. It loads schema files and provides interactive access to queries, mutations, subscriptions, and type definitions, making it easier to work with GraphQL APIs.

Installation

You can run the MCP-GraphQL-Schema server directly using npx without installation:

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

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

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

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

Integration with Claude

Claude Desktop Setup

To integrate with Claude Desktop, edit your configuration file:

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

The configuration file is located at:

  • macOS/Linux: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: $env:AppData\Claude\claude_desktop_config.json

Claude Code CLI Setup

To use with Claude Code CLI:

  1. Register the MCP server:

    # Basic syntax
    claude mcp add graphql-schema npx -y mcp-graphql-schema
    
    # Example with specific schema
    claude mcp add shopify-graphql-schema npx -y mcp-graphql-schema ~/Projects/work/schema.shopify.2025-01.graphqls
    
  2. Verify registration:

    # List all configured servers
    claude mcp list
    
    # Get details for your GraphQL schema server
    claude mcp get graphql-schema
    
  3. Remove if needed:

    claude mcp remove graphql-schema
    

Tips:

  • Use the -s or --scope flag with project (default) or global to specify where the configuration is stored
  • Add multiple MCP servers for different schemas with different names (e.g., main API schema, Shopify schema)

Available Tools

The MCP server provides these tools for exploring GraphQL schemas:

  • list-query-fields: Lists all available root-level fields for GraphQL queries
  • 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
  • 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)

Example Queries

You can ask Claude questions like:

  • 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"

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "GraphQL-Schema" '{"command":"npx","args":["-y","mcp-graphql-schema"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "GraphQL Schema": {
            "command": "npx",
            "args": [
                "-y",
                "mcp-graphql-schema"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "GraphQL Schema": {
            "command": "npx",
            "args": [
                "-y",
                "mcp-graphql-schema"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later