MCP ExplorerExplorer

Graphql Mcp

@wricardoon a year ago
1 MIT
FreeCommunity
AI Systems
Graphql Model Context Protocol server

Overview

What is Graphql Mcp

graphql-mcp is a Model Context Protocol (MCP) server that facilitates interaction with GraphQL APIs using official GraphQL client libraries. It enables users to list available queries and mutations, describe schema entities, and invoke GraphQL operations.

Use cases

Use cases for graphql-mcp include executing complex queries and mutations in applications, retrieving schema information for documentation purposes, and managing API authentication through custom headers.

How to use

To use graphql-mcp, install the package using ‘go install github.com/wricardo/mcp-graphql@latest’. Configure environment variables to connect to your GraphQL API, and set MCP client settings in your configuration file. Finally, run the MCP server using ‘mcp-graphql’.

Key features

Key features of graphql-mcp include the ability to dynamically invoke GraphQL operations, list all available queries and mutations, describe schema entities, and set custom headers for API calls.

Where to use

graphql-mcp can be used in various fields where GraphQL APIs are implemented, such as web development, mobile applications, and backend services that require efficient data fetching and manipulation.

Content

MCP GraphQL

This project is a Model Context Protocol (MCP) server designed to interact with GraphQL APIs using the official GraphQL client libraries. It allows users to list available queries and mutations, describe schema entities, and invoke GraphQL operations.


🚀 Features

Invoke GraphQL Operations: Execute queries and mutations dynamically.
List Queries & Mutations: Retrieve all available queries and mutations in the GraphQL schema.
Describe Schema Entities: Obtain detailed information about GraphQL operations and types.
Set Custom Headers: Configure and manage authentication or request headers for API calls.


📋 Requirements

  • Go 1.23.0 or later
  • A running GraphQL API

⚙️ Setup

1️⃣ Install the Package

go install github.com/wricardo/mcp-graphql@latest

2️⃣ Configure Environment Variables

Set the following environment variables to connect to your GraphQL API:

export ADDRESS="https://your-graphql-endpoint.com"

3️⃣ Configure MCP Client Settings

Add the following configuration to your MCP settings:


▶️ Usage

Run the MCP server:

mcp-graphql

🛠️ Tools

🔹 invoke_graphql

Execute a GraphQL operation (query or mutation).

📌 Parameters:

  • operation (required): The GraphQL query or mutation string.
  • variables (optional): A JSON-encoded string representing query variables.

📌 Example:

{
  "operation": "query { jobs { id name } }"
}

🔹 list_queries

Retrieve all available queries in the GraphQL schema.

📌 Parameters:

  • None

📌 Example Response:

{
  "queries": [
    "healthcheck(input: String!): String!",
    "candidate(id: String!): Candidate"
  ]
}

🔹 list_mutations

Retrieve all available mutations in the GraphQL schema.

📌 Parameters:

  • None

📌 Example Response:

{
  "mutations": [
    "createCandidate(input: CandidateInput!): Candidate!",
    "updateInterviewScorecard(id: String!, input: ScorecardInput!): InterviewScorecard!"
  ]
}

🔹 describe

Retrieve detailed information about specified GraphQL operations or types.

📌 Parameters:

  • entities (required): A comma-separated list of GraphQL types or operations.

📌 Example:

{
  "entities": "query.jobs,type.JobQueryParams,JobsPage,job"
}

🔹 set_headers

Set or overwrite HTTP headers for GraphQL requests.

📌 Parameters:

  • headers (required): JSON-encoded headers.

📌 Example:

{
  "headers": "{\"Authorization\": \"Bearer token123\", \"X-API-Key\": \"abc123\"}"
}

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers