WG

wimspaargaren/gql-gen-mcp

API development

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기

6 stars 4 forks 품질 45 트렌드 14MIT

The gql-gen-mcp tool has its name inspired by the awesome github.com/99designs/gqlgen generator. Instead of generating a GraphQL server, it generates Model Context Protocol (MCP) (stdio) servers...

개요

The gql-gen-mcp tool has its name inspired by the awesome github.com/99designs/gqlgen generator. Instead of generating a GraphQL server, it generates Model Context Protocol (MCP) (stdio) servers based on your GraphQL schema definitions. It's currently based on mark3labs/mcp-go as it's the most widely adopted MCP Go server (April 2025). Gotools just started an implementation see mcp go thread, so perhaps we eventually switch over or make it configurable which server to use as output. You can configure gql gen mcp using a yaml file called .gql-gen-mcp.yaml. Example: Run the gql-gen-mcp tool in the directory where you've defined your .gql-gen-mcp.yaml file. Note that the main.go of your server is only generated once, such that you can configure the server to your needs. The generated MCP server is a stdio server. Install it on your system with go install .. Check out the example directory for a full example with a dummy bookstore GraphQL API.

README

Overview

The gql-gen-mcp tool has its name inspired by the awesome github.com/99designs/gqlgen generator. Instead of generating a GraphQL server, it generates Model Context Protocol (MCP) (stdio) servers based on your GraphQL schema definitions. It’s currently based on mark3labs/mcp-go as it’s the most widely adopted MCP Go server (April 2025). Gotools just started an implementation see mcp go thread, so perhaps we eventually switch over or make it configurable which server to use as output.

Usage

Install gql-gen-mcp

go install github.com/wimspaargaren/gql-gen-mcp@latest

Configuration

You can configure gql gen mcp using a yaml file called .gql-gen-mcp.yaml. Example:

schemas:
  - name: bookstore
    dir: ./bookstore/graphql/definitions
    output: ./mcp/bookstore
Field Description Required Default
name A unique name for the configuration, used for identification. No ``
dir The directory containing the GraphQL schema definitions. No ./
output The output directory for the generated server and tools. No ./
package The package name for the generated server and tools. No main
onlyTools If true, generates only the tools and skips server generation. No false

Run

Run the gql-gen-mcp tool in the directory where you’ve defined your .gql-gen-mcp.yaml file. Note that the main.go of your server is only generated once, such that you can configure the server to your needs.

gql-gen-mcp

Use with your favourite LLM tooling

The generated MCP server is a stdio server. Install it on your system with go install ..

MCP server definition:

"bookstore-api": {
      "command": "bookstore",
      "args": []
  },

Example

Check out the example directory for a full example with a dummy bookstore GraphQL API.

Missing features

  • Configuration via flags
  • No support for introspection or type query
  • No support for federated GraphQL
  • Generate MCP tools based on introspection query
GitHub에서 전체 README 보기

설치

This server does not publish a one-line install command.

Open the repository installation guide MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →