BM

blurrah/mcp-graphql

Developer tools

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

407 stars 62 forks 품질 68 트렌드 19MIT

GraphQL용 모델 컨텍스트 프로토콜 서버

개요

LLM이 GraphQL API와 상호작용할 수 있도록 하는 모델 컨텍스트 프로토콜 서버입니다. 이 구현은 스키마 내면 및 쿼리 실행 기능을 제공하여 모델이 GraphQL API를 동적으로 발견하고 사용할 수 있도록 합니다. mcp-graphql을 올바른 엔드포인트로 실행하면 자동으로 쿼리를 인트로스펙팅하려고 합니다. 버전 1.0.0부터는 명령줄 인자가 환경 변수로 대체되었습니다. - : 서버는 클라이언트가 접근할 수 있는 리소스로 GraphQL 스키마를 노출합니다. 이는 로컬 스키마 파일, URL에 호스팅된 스키마 파일, 또는 내면 쿼리를 기반으로 할 수 있습니다. 1. : 이 도구는 GraphQL 스키마를 가져옵니다. 스키마에 리소스로 접근할 수 없다면 먼저 이 도구를 사용하세요. 이 도구는 로컬 스키마 파일, URL에 호스팅된 스키마 파일, 또는 인트로스펙션 쿼리를 사용합니다. 2. : 엔드포인트에 대해 GraphQL 쿼리를 실행합니다. 기본적으로 돌연변이는 ALLOW_MUTATIONS true로 설정되지 않으면 비활성화됩니다.

개요(AI 번역)

LLM이 GraphQL API와 상호작용할 수 있도록 하는 모델 컨텍스트 프로토콜 서버입니다. 이 구현은 스키마 내면 및 쿼리 실행 기능을 제공하여 모델이 GraphQL API를 동적으로 발견하고 사용할 수 있도록 합니다.

사용

올바른 엔드포인트로 mcp-graphql를 실행하면 자동으로 쿼리를 인트로스펙팅하려고 합니다.

환경 변수 (1.0.0에서 변경 중단)

참고: 버전 1.0.0부터는 명령어 인자가 환경 변수로 대체되었습니다.

환경 변수 설명 기본
ENDPOINT GraphQL 엔드포인트 URL http://localhost:4000/graphql
HEADERS 요청 헤더를 포함하는 JSON 문자열 {}
ALLOW_MUTATIONS 돌연변이 연산 활성화 (기본적으로 비활성화됨) false
NAME MCP 서버 이름 mcp-graphql
SCHEMA 로컬 GraphQL 스키마 파일 또는 URL 경로 (선택 사항) -

예시

자료

  • graphql-schema: 서버는 클라이언트가 접근할 수 있는 리소스로 GraphQL 스키마를 노출합니다. 이는 로컬 스키마 파일, URL에 호스팅된 스키마 파일, 또는 인트로스펙션 쿼리를 기반으로 합니다.

사용 가능한 도구

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

README

원문 README의 일부입니다. 원문 보기.

mcp-graphql

A Model Context Protocol server that enables LLMs to interact with GraphQL APIs. This implementation provides schema introspection and query execution capabilities, allowing models to discover and use GraphQL APIs dynamically.

Usage

Run mcp-graphql with the correct endpoint, it will automatically try to introspect your queries.

Environment Variables (Breaking change in 1.0.0)

Note: As of version 1.0.0, command line arguments have been replaced with environment variables.

Environment Variable Description Default
ENDPOINT GraphQL endpoint URL http://localhost:4000/graphql
HEADERS JSON string containing headers for requests {}
ALLOW_MUTATIONS Enable mutation operations (disabled by default) false
NAME Name of the MCP server mcp-graphql
SCHEMA Path to a local GraphQL schema file or URL (optional) -

Examples

# Basic usage with a local GraphQL server
ENDPOINT=http://localhost:3000/graphql npx mcp-graphql

# Using with custom headers
ENDPOINT=https://api.example.com/graphql HEADERS='{"Authorization":"Bearer token123"}' npx mcp-graphql

# Enable mutation operations
ENDPOINT=http://localhost:3000/graphql ALLOW_MUTATIONS=true npx mcp-graphql

# Using a local schema file instead of introspection
ENDPOINT=http://localhost:3000/graphql SCHEMA=./schema.graphql npx mcp-graphql

# Using a schema file hosted at a URL
ENDPOINT=http://localhost:3000/graphql SCHEMA=https://example.com/schema.graphql npx mcp-graphql

Resources

  • graphql-schema: The server exposes the GraphQL schema as a resource that clients can access. This is either the local schema file, a schema file hosted at a URL, or based on an introspection query.

Available Tools

The server provides two main tools:

  1. introspect-schema: This tool retrieves the GraphQL schema. Use this first if you don’t have access to the schema as a resource. This uses either the local schema file, a schema file hosted at a URL, or an introspection query.

  2. query-graphql: Execute GraphQL queries against the endpoint. By default, mutations are disabled unless ALLOW_MUTATIONS is set to true.

Installation

Installing via Smithery

To install GraphQL MCP Server for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install mcp-graphql --client claude

Installing Manually

It can be manually installed to Claude:

{
    "mcpServers": {
        "mcp-graphql": {
            "command": "npx",
            "args": ["mcp-graphql"],
            "env": {
GitHub에서 전체 README 보기

설치

npx mcp-graphql
MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →

설정

{ "mcpServers": { "mcp-graphql": { "command": "npx", "args": ["mcp-graphql"], "env": { "ENDPOINT": "http://localhost:3000/graphql" } } } }