graphql-mcp

vivekb91/graphql-mcp

3.2

If you are the rightful owner of graphql-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

A Model Context Protocol (MCP) server that provides GraphQL query capabilities with natural language support.

Tools
  1. graphql_query

    Execute GraphQL queries directly against your configured endpoint.

  2. natural_language_query

    Execute queries using natural language descriptions (requires AI model integration).

GraphQL MCP Server

A Model Context Protocol (MCP) server that provides GraphQL query capabilities with natural language support.

Features

  • Execute GraphQL queries against configured endpoints
  • Support for authentication headers and custom configuration
  • Natural language query interface (requires AI model integration)
  • Easy configuration through JSON file

Setup

  1. Install dependencies:
npm install
  1. Configure your GraphQL endpoint in config.json:
{
  "graphql": {
    "endpoint": "https://your-api.com/graphql",
    "headers": {
      "Authorization": "Bearer YOUR_API_KEY",
      "Content-Type": "application/json"
    }
  },
  "server": {
    "name": "GraphQL MCP Server",
    "version": "1.0.0"
  }
}

Running the Server

npm start

Available Tools

graphql_query

Execute GraphQL queries directly against your configured endpoint.

Parameters:

  • query (required): The GraphQL query string
  • variables (optional): Variables to pass to the query

natural_language_query

Execute queries using natural language descriptions (requires AI model integration).

Parameters:

  • description (required): Natural language description of data to fetch
  • schema_hint (optional): Hint about the GraphQL schema structure

Example Usage

Direct GraphQL Query

{
  "query": "query GetUsers { users { id name email } }"
}

Natural Language Query

{
  "description": "Get all users with their names and emails",
  "schema_hint": "Users are in the 'users' field"
}

Configuration

Edit config.json to customize:

  • GraphQL endpoint URL
  • Authentication headers
  • Server metadata

Security

  • Never commit your config.json with real API keys
  • Use environment variables for sensitive data in production
  • Ensure your GraphQL endpoint supports the queries you plan to make