mcpField
M
mcp4gql - GraphQL MCP Server

mcp4gql - GraphQL MCP Server

Local
github.com/jorgeraadDeveloper Tools3Updated 79w ago

About mcp4gql - GraphQL MCP Server

mcp4gql is a Node.js and TypeScript MCP server that lets clients inspect and operate on a target GraphQL API. It provides schema introspection alongside query and mutation execution.

Key features

  1. 01Fetch a GraphQL schema
  2. 02Run GraphQL queries and mutations
  3. 03Accept variables and operation names
  4. 04Communicate with clients over stdio
  5. 05Configure an optional bearer token

Use cases

  1. 01Inspect a target GraphQL API schema
  2. 02Run GraphQL queries from an MCP client
  3. 03Perform API operations with GraphQL mutations

MCP support

The MCP server exposes tools for schema introspection and GraphQL operation execution over stdio. The endpoint and optional bearer token are configured through environment variables.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"mcp4gql": {
"command": "npx",
"args": [
"-y",
"mcp4gql"
],
"env": {
"GRAPHQL_ENDPOINT": "<GRAPHQL_ENDPOINT>",
"AUTH_TOKEN": "<AUTH_TOKEN>"
}
}
}
}
Run commandnpx -y mcp4gql
Environment variables to set
GRAPHQL_ENDPOINT
AUTH_TOKENSecret

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npmmcp4gql

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

mcp4gql - GraphQL MCP Server

smithery badge

mcp4gql

This project is a Node.js/TypeScript server that implements the Model Context Protocol (MCP). It acts as a bridge, allowing MCP clients (like Cursor) to interact with a target GraphQL API.

Features

  • MCP Server: Implements the MCP Server class from @modelcontextprotocol/sdk.
  • Stdio Transport: Communicates with clients via standard input/output.
  • GraphQL Client: Uses axios to send requests to the configured GraphQL endpoint.
  • Generic GraphQL Tools: Exposes the following tools to MCP clients:
    • introspectGraphQLSchema: Fetches the target GraphQL API schema using introspection.
    • executeGraphQLOperation: Executes arbitrary GraphQL queries or mutations against the target API, taking query, optional variables, and optional operationName as input.

Configuration

The server requires the following environment variables:

  • GRAPHQL_ENDPOINT: The URL of the target GraphQL API.
  • AUTH_TOKEN: A bearer token for an optional Authorization: Bearer <token> header for authenticating with the GraphQL API.

Client Configuration

To allow clients like Cursor or Claude Desktop to use the tools provided by this server, you need to configure them to run the npx command.

Cursor
  1. Go to Cursor MCP Settings (Cursor > Settings > Cursor Settings > MCP)

  2. Go to + Add new global MCP server

  3. Add the following to your Cursor MCP configuration:

    {
      "mcpServers": {
        "mcp4gql": {
          "command": "npx",
          "type": "stdio",
          "args": ["-y", "mcp4gql"],
          "env": {
            "GRAPHQL_ENDPOINT": "YOUR_GRAPHQL_ENDPOINT_URL",
            "AUTH_TOKEN": "YOUR_OPTIONAL_AUTH_TOKEN"
          }
        }
      }
    }
    
Claude Desktop
  1. Open Claude Desktop settings (Claude > Settings).

  2. Go to Developer > Edit Config.

  3. Add to the config:

    {
      "mcpServers": {
        "mcp4gql": {
          "command": "npx",
          "args": ["-y", "mcp4gql"],
          "env": {
            "GRAPHQL_ENDPOINT": "YOUR_GRAPHQL_ENDPOINT_URL",
            "AUTH_TOKEN": "YOUR_OPTIONAL_AUTH_TOKEN"
          }
        }
      }
    }
    

Once configured, the MCP client should be able to list and call the introspectGraphQLSchema and executeGraphQLOperation tools provided by this server when relevant. Remember to set the required environment variables (GRAPHQL_ENDPOINT and optionally AUTH_TOKEN) in the configuration so the server can connect to your API.

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.