apollo-mcp-server

tarafından apollographql

AI ajanlarını, Model Context Protokolü aracılığıyla yerleşik içgözlem ve işlem araçlarıyla GraphQL API'lerine bağlayın. GraphQL işlemlerini MCP araçları olarak sunar; üç işlem kaynağını destekler: yerel dosyalar, GraphOS Studio koleksiyonları ve kalıcı sorgu bildirimleri. Şema keşfi ve geçici sorgu testi için dört içgözlem aracı (introspect, search, validate, execute) sağlar; küçültme modu, kompakt notasyonla token kullanımını azaltır. Statik başlıklar aracılığıyla yapılandırılabilir kimlik doğrulama,...

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:

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.

The server watches the config file for changes and automatically restarts with updated configuration.

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):

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

Built-in 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
explorerOpen operation in Apollo ExplorerGenerate Explorer URLs (requires GraphOS graph ref)

Defining Custom Tools

MCP tools are created from GraphQL operations:

1. Operation Files (Recommended)

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

2. Operation Collections

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

3. Persisted Queries

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

4. Schema Introspection

operations:
  source: introspect

5. GraphOS Uplink

operations:
  source: uplink

Reference Files

  • Tools - Introspection tools, explorer, minify notation, tool annotations
  • Configuration - All configuration options including tasks and caching
  • Authentication - OAuth 2.1, scopes, token validation, rate limiting, per-operation scopes
  • Rhai Scripting - Lifecycle hooks and built-in functions
  • MCP Prompts - Reusable prompt templates
  • MCP Apps - Interactive mini-applications for MCP-compatible hosts
  • Deployment - Docker, Kubernetes, Apollo Runtime Container, scaling
  • Error Handling - Protocol errors, tool errors, GraphQL error mapping
  • Best Practices - Security guidance, mutation gating, tool poisoning, token passthrough
  • Telemetry - OpenTelemetry metrics, traces, and dashboards
  • Troubleshooting - Common issues and solutions

Key Rules

Security

Security: Sensitive operations. Configure authentication before exposing to AI agents. Use headers for API keys, OAuth for user-scoped access.

  • Disable introspection tools in production (they are disabled by default)
  • Use overrides.mutation_mode to control mutation exposure

Authentication

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

# Dynamic header forwarding
forward_headers:
  - x-tenant-id

# OAuth (streamable_http transport)
transport:
  type: streamable_http
  auth:
    servers:
      - https://auth.example.com
    audiences:
      - https://api.example.com
    scopes:
      - read
    scope_mode: require_all

Schema Sources

# Local file
schema:
  source: local
  path: ./schema.graphql

# Federated graphs (uplink)
schema:
  source: uplink

# Non-federated graphs (graphos)
schema:
  source: graphos

Mutations

Control mutation behavior via overrides.mutation_mode:

ModePredefined mutationsAd hoc mutations (execute)
noneSkippedRejected
explicitExposedRejected
allExposedAllowed

MCP Apps

Build interactive UI experiences inside MCP Apps-compatible hosts (e.g., ChatGPT). Define tools with @tool and @prefetch directives on GraphQL operations. Configure the apps directory:

apps:
  path: ./apps

MCP Tasks

Return async task handles for slow GraphQL calls. Clients poll tasks/get for results:

tasks:
  enabled: true
  detach_after_ms: 1000

Token Optimization

Enable minification to reduce token usage:

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

Common Patterns

GraphOS Cloud Schema

graphos:
  apollo_key: ${env.APOLLO_KEY}
  apollo_graph_ref: my-graph@production
schema:
  source: uplink # federated graphs; use graphos for non-federated graphs

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
  auth:
    servers:
      - https://auth.example.com
    audiences:
      - https://api.example.com
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}
schema:
  source: uplink # federated graphs; use graphos for non-federated graphs
health_check:
  enabled: true
telemetry:
  exporters:
    metrics:
      otlp:
        endpoint: https://your-metrics-endpoint
        protocol: http/protobuf
    tracing:
      otlp:
        endpoint: https://your-traces-endpoint
        protocol: http/protobuf

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}
schema:
  source: uplink # federated graphs; use graphos for non-federated graphs
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
  • ALWAYS review overrides.required_scopes keys after tool changes
  • NEVER expose introspection tools with write access to production data
  • NEVER place auth at the top level — it must be nested under transport
  • NEVER assume mutation_mode provides per-invocation approval (it is a configuration gate)
  • PREFER operation files over ad-hoc execute for predictable behavior
  • PREFER streamable_http transport for remote and multi-client deployments
  • PREFER contract variants when using persisted queries or introspection with GraphOS
  • USE schema.source: graphos for non-federated graphs (uplink only serves federated graphs)
  • USE stdio only when the MCP client launches the server process directly
  • USE GraphOS Studio collections for team collaboration
  • USE disable_auth_token_passthrough: true when your API does not need the caller's token

apollographql tarafından daha fazla skill

apollo-federation
apollographql
Apollo Federation, birden fazla GraphQL API'sini (alt grafikler) birleşik bir süper grafik halinde oluşturmayı sağlar.
apollo-ios
apollographql
We need to translate the given English text into Turkish, preserving the name "apollo-ios" and technical terms like GraphQL, Swift, async/await, SQLite, HTTP, WebSocket, graphql-transport-ws. The instruction says to translate only the text inside <text>, and not include the name unless it appears in the source text. The name "apollo-ios" does not appear in the source text; the source says "Apollo iOS" (with a space). The instruction says "Name to preserve: apollo-ios" but the source has "Apollo iOS". We should preserve the exact name as given? The instruction says "preserve product names" and the name to preserve is "apollo-ios". However, the source text uses "Apollo iOS". I think we should keep "Apollo iOS" as is because that's the product name in the source. But the instruction says "Name to preserve: apollo-ios" - that might be a key. To be safe, I'll keep "Apollo iOS
apollo-router
apollographql
Apollo Router, Apollo Federation 2 süper grafiklerini çalıştırmak için Rust dilinde yazılmış yüksek performanslı bir grafik yönlendiricisidir. Alt grafiklerinizin önünde yer alır ve sorgu planlaması, yürütme ve yanıt birleştirme işlemlerini yönetir.
apollo-router-plugin-creator
apollographql
Apollo Router için yerel Rust eklentileri oluşturun.
apollo-server
apollographql
Apollo Server 5.x ile çeşitli framework'lerde GraphQL sunucuları oluşturmak için kapsamlı rehber. Şema tanımı, çözücüler, bağlam kurulumu ve TypeScript desteğiyle hata yönetimini kapsar. Prototipleme için bağımsız modu ve Express, Fastify, Koa ile sunucusuz ortamlar için entegrasyonları destekler. Çözücü desenleri, kimlik doğrulama/yetkilendirme, eklentiler, N+1 önleme için DataLoader ve performans optimizasyon tekniklerini içerir. Veri kaynakları, hata... için referans dokümantasyon sağlar.
graphql-operations
apollographql
Verimli, tür güvenli GraphQL işlemleri yazmak ve bunları fragmentlerle organize etmek için en iyi uygulamalar kılavuzu. Sorgular, mutasyonlar, abonelikler ve fragmentleri; adlandırma kuralları, değişken sözdizimi ve yönerge kullanımıyla kapsar. Temel ilkeleri vurgular: yalnızca gerekli alanları isteyin, tüm işlemleri adlandırın, sabit kodlanmış değerler yerine değişkenler kullanın ve önbelleğe alınabilirlik için id alanlarını ekleyin. Fragmentlerin bileşenlerle birlikte konumlandırılmasını ve koşullu alanlar için @include / @skip yönergelerinin kullanılmasını önerir...
graphql-schema
apollographql
Endüstriyel en iyi uygulamalar rehberi; sezgisel, yüksek performanslı ve sürdürülebilir GraphQL şemaları tasarlamak için. İstemci odaklı tip organizasyonu, açık nullability desenleri ve geriye dönük uyumlu evrim stratejileri dahil olmak üzere temel tasarım ilkelerini kapsar. Tipler, adlandırma kuralları, imleç tabanlı sayfalama, hata modelleme ve güvenlik hususları hakkında referans dokümantasyonu sağlar. Kod örnekleriyle arayüzler, birleşimler, girdi tipleri, mutasyonlar ve ID stratejileri için pratik desenler içerir...
rover
apollographql
Apollo Rover CLI, GraphQL şemalarını, federasyonu ve yerel süpergraf geliştirmeyi yönetmek içindir. Alt grafik şemalarını yayımlayın, alın ve doğrulayın; federasyonlu süper grafikleri yerel olarak veya GraphOS aracılığıyla oluşturun. Çalışan sunuculardan şema denetimi (dağıtım öncesi doğrulama), linting ve içe bakış içerir. rover dev komutu, geliştirme iş akışları için otomatik şema oluşturma ile yerel bir Yönlendirici başlatır. Yayımlamadan önce doğrulama ve komut dosyası oluşturma için JSON çıktısı ile CI/CD desenlerini destekler. Gerektirir...