apollo-mcp-server

작성자: apollographql

AI 에이전트를 GraphQL API에 연결하여 Model Context Protocol을 통해 내장된 인트로스펙션 및 작업 도구를 제공합니다. GraphQL 작업을 MCP 도구로 노출하며, 로컬 파일, GraphOS Studio 컬렉션, 지속적 쿼리 매니페스트의 세 가지 작업 소스를 지원합니다. 스키마 탐색 및 임시 쿼리 테스트를 위한 네 가지 인트로스펙션 도구(introspect, search, validate, execute)를 제공하며, 축약 표기법을 사용한 미니피케이션 모드로 토큰 사용량을 줄입니다. 정적 헤더를 통한 구성 가능한 인증,...

npx skills add https://github.com/apollographql/skills --skill apollo-mcp-server

Apollo MCP Server Guide

Apollo MCP Server exposes GraphQL operations as MCP tools, enabling AI agents to interact with GraphQL APIs through the Model Context Protocol.

Quick Start

Step 1: Install

# Linux / MacOS
curl -sSL https://mcp.apollo.dev/download/nix/latest | sh

# Windows
iwr 'https://mcp.apollo.dev/download/win/latest' | iex

Step 2: Configure

Create config.yaml in your project root:

# config.yaml
transport:
  type: streamable_http
schema:
  source: local
  path: ./schema.graphql
operations:
  source: local
  paths:
    - ./operations/
introspection:
  introspect:
    enabled: true
  search:
    enabled: true
  validate:
    enabled: true
  execute:
    enabled: true

Start the server:

apollo-mcp-server ./config.yaml

The MCP endpoint is available at http://127.0.0.1:8000/mcp (streamable_http defaults: address 127.0.0.1, port 8000). The GraphQL endpoint defaults to http://localhost:4000/ — override with the endpoint key if your API runs elsewhere.

Step 3: Connect

Add to your MCP client configuration:

Streamable HTTP (recommended):

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "graphql-api": {
      "command": "npx",
      "args": ["mcp-remote", "http://127.0.0.1:8000/mcp"]
    }
  }
}

Claude Code:

claude mcp add graphql-api -- npx mcp-remote http://127.0.0.1:8000/mcp

Stdio (client launches the server directly):

Claude Desktop (claude_desktop_config.json) or Claude Code (.mcp.json):

{
  "mcpServers": {
    "graphql-api": {
      "command": "./apollo-mcp-server",
      "args": ["./config.yaml"]
    }
  }
}

Built-in Tools

Apollo MCP Server provides four introspection tools:

ToolPurposeWhen to Use
introspectExplore schema types in detailNeed type definitions, fields, relationships
searchFind types in schemaLooking for specific types or fields
validateCheck operation validityBefore executing operations
executeRun ad-hoc GraphQL operationsTesting or one-off queries

Defining Custom Tools

MCP tools are created from GraphQL operations. Three methods:

1. Operation Files (Recommended)

operations:
  source: local
  paths:
    - ./operations/

Each file must contain exactly one operation. Each named operation becomes an MCP tool.

# operations/GetUser.graphql
query GetUser($id: ID!) {
  user(id: $id) {
    id
    name
    email
  }
}
# operations/CreateUser.graphql
mutation CreateUser($input: CreateUserInput!) {
  createUser(input: $input) {
    id
    name
  }
}

2. Operation Collections

operations:
  source: collection
  id: your-collection-id

Use GraphOS Studio to manage operations collaboratively.

3. Persisted Queries

operations:
  source: manifest
  path: ./persisted-query-manifest.json

For production environments with pre-approved operations.

Reference Files

Detailed documentation for specific topics:

Key Rules

Security

  • Never expose sensitive operations without authentication
  • Use headers configuration for API keys and tokens
  • Disable introspection tools in production (they are disabled by default)
  • Set overrides.mutation_mode: explicit to require confirmation for mutations

Authentication

# Static header
headers:
  Authorization: "Bearer ${env.API_TOKEN}"

# Dynamic header forwarding
forward_headers:
  - x-forwarded-token

# OAuth (streamable_http transport)
transport:
  type: streamable_http
  auth:
    servers:
      - https://auth.example.com/.well-known/openid-configuration
    audiences:
      - https://api.example.com

Token Optimization

Enable minification to reduce token usage:

introspection:
  introspect:
    minify: true
  search:
    minify: true

Minified output uses compact notation:

  • T = type, I = input, E = enum
  • s = String, i = Int, b = Boolean, f = Float, d = ID
  • ! = required, [] = list

Mutations

Control mutation behavior via the overrides section:

overrides:
  mutation_mode: all       # Execute mutations directly
  # mutation_mode: explicit  # Require explicit confirmation
  # mutation_mode: none      # Block all mutations (default)

Common Patterns

GraphOS Cloud Schema

# schema.source defaults to uplink — can be omitted when graphos is configured
graphos:
  apollo_key: ${env.APOLLO_KEY}
  apollo_graph_ref: my-graph@production

Local Development

transport:
  type: streamable_http
schema:
  source: local
  path: ./schema.graphql
introspection:
  introspect:
    enabled: true
  search:
    enabled: true
  validate:
    enabled: true
  execute:
    enabled: true
overrides:
  mutation_mode: all

Production Setup

transport:
  type: streamable_http
endpoint: https://api.production.com/graphql
operations:
  source: manifest
  path: ./persisted-query-manifest.json
graphos:
  apollo_key: ${env.APOLLO_KEY}
  apollo_graph_ref: ${env.APOLLO_GRAPH_REF}
headers:
  Authorization: "Bearer ${env.API_TOKEN}"
health_check:
  enabled: true

Docker

transport:
  type: streamable_http
  address: 0.0.0.0
  port: 8000
endpoint: ${env.GRAPHQL_ENDPOINT}
graphos:
  apollo_key: ${env.APOLLO_KEY}
  apollo_graph_ref: ${env.APOLLO_GRAPH_REF}
health_check:
  enabled: true

Ground Rules

  • ALWAYS configure authentication before exposing to AI agents
  • ALWAYS use mutation_mode: explicit or mutation_mode: none in shared environments
  • NEVER expose introspection tools with write access to production data
  • PREFER operation files over ad-hoc execute for predictable behavior
  • PREFER streamable_http transport for remote and multi-client deployments
  • USE stdio only when the MCP client launches the server process directly
  • USE GraphOS Studio collections for team collaboration

apollographql의 다른 스킬

apollo-client
apollographql
Apollo Client는 로컬 및 원격 데이터를 GraphQL로 관리할 수 있게 해주는 JavaScript용 종합 상태 관리 라이브러리입니다. 버전 4.x는 개선된 캐싱, 더 나은 TypeScript 지원, React 19 호환성을 제공합니다.
official
apollo-client
apollographql
Apollo Client 4.x를 사용하여 React 애플리케이션을 구축하기 위한 종합 가이드로, 쿼리, 뮤테이션, 캐싱 및 상태 관리를 다룹니다. 여러 React 프레임워크 및 설정을 지원합니다: 클라이언트 측 앱(Vite, CRA), React Server Components를 사용하는 Next.js App Router, 스트리밍 SSR을 지원하는 React Router 7, TanStack Start. 쿼리(useQuery, useLazyQuery), 뮤테이션(useMutation)을 위한 훅과 최신 React 18+ 및 19를 위한 Suspense 기반 패턴(useSuspenseQuery, useBackgroundQuery)을 포함합니다.
official
apollo-connectors
apollographql
REST API를 @source 및 @connect 지시문을 사용하여 GraphQL 슈퍼그래프에 통합합니다. 구조화된 5단계 프로세스를 제공합니다: API 구조 조사, 지시문으로 스키마 구현, rover supergraph compose를 통한 검증, 커넥터 실행, 테스트 커버리지. 헤더, 본문 페이로드, N+1 패턴을 위한 배칭, $env를 통한 환경 변수 주입을 포함한 요청 구성을 지원합니다. 필드 선택, 별칭, 중첩 데이터를 위한 하위 선택, 엔티티...를 포함한 응답 매핑을 처리합니다.
official
apollo-federation
apollographql
Apollo Federation은 여러 GraphQL API(서브그래프)를 하나의 통합된 슈퍼그래프로 구성할 수 있게 해줍니다.
official
apollo-ios
apollographql
Apollo iOS는 Apple 플랫폼을 위한 강력한 타입의 GraphQL 클라이언트입니다. GraphQL 작업과 스키마에서 Swift 타입을 생성하며, async/await 클라이언트, 정규화된 캐시(인메모리 또는 SQLite 기반), 쿼리, 뮤테이션 및 멀티파트 구독을 처리하는 플러그형 인터셉터 기반 HTTP 전송, 그리고 모든 작업 유형을 전달할 수 있는 선택적 WebSocket 전송(graphql-transport-ws)을 제공합니다.
official
apollo-kotlin
apollographql
Apollo Kotlin은 GraphQL 연산과 스키마에서 Kotlin 모델을 생성하는 강력한 타입의 GraphQL 클라이언트로, Android, JVM 및 Kotlin Multiplatform 프로젝트에서 사용할 수 있습니다.
official
apollo-router
apollographql
Apollo Router는 Apollo Federation 2 슈퍼그래프를 실행하기 위해 Rust로 작성된 고성능 그래프 라우터입니다. 서브그래프 앞에 위치하여 쿼리 계획, 실행 및 응답 구성을 처리합니다.
official
apollo-router-plugin-creator
apollographql
Apollo Router용 네이티브 Rust 플러그인을 생성합니다.
official