All skills
apollographql avatar

/apollo-mcp-server

@f67ffa1 official
by Apollo GraphQLapollographql/skills115 stars
13

Guide for using Apollo MCP Server to connect AI agents with GraphQL APIs. Use this skill when: (1) setting up or configuring Apollo MCP Server, (2) defining MCP tools from GraphQL operations, (3) using introspection tools (introspect, search, validate, execute), (4) troubleshooting MCP server connectivity or tool execution issues.

Use this Skill: https://skilld.dev/gh/apollographql/skills/apollo-mcp-server

This session only. Nothing lands on disk.

referencestools.md

≈1.5k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Apollo MCP Server Tools Reference

Table of Contents


Introspection Tools

Apollo MCP Server provides four built-in tools for schema exploration and operation execution. All tools are disabled by default and must be enabled in configuration.

Each introspection tool supports an optional hint config option for providing custom instructions to the AI agent about when and how to use the tool.

introspect

Explore schema types in detail with configurable depth.

Parameters:

Parameter Type Default Description
type String required Type name to introspect
depth Int 1 Recursion depth for related types
minify Boolean false Use compact notation

Examples:

# Basic type introspection
introspect(type: "User")

# Deep introspection with related types
introspect(type: "User", depth: 3)

# Minified output for token efficiency
introspect(type: "User", minify: true)

Output (normal):

type User {
  id: ID!
  name: String!
  email: String
  posts: [Post!]!
  createdAt: DateTime!
}

Output (minified):

T User { id:d! name:s! email:s posts:[Post!]! createdAt:DateTime! }

Depth Behavior:

  • depth: 1 - Only the requested type
  • depth: 2 - Requested type + directly referenced types
  • depth: 3 - Two levels of related types
  • Maximum recommended: 5

search

Find types in the schema matching a query.

Parameters:

Parameter Type Default Description
query String required Search term
leafDepth Int 1 Depth for leaf type expansion
minify Boolean false Use compact notation

Config Options:

Option Default Description
index_memory_bytes 50000000 Memory budget for the search index
leaf_depth 1 Default leaf type expansion depth

Behavior:

  • Returns maximum 5 matching results
  • Searches type names, field names, and descriptions
  • Case-insensitive matching

Examples:

# Find user-related types
search(query: "user")

# Search with expanded leaf types
search(query: "product", leafDepth: 2)

Output:

Found 3 types matching "user":
- User (type)
- UserInput (input)
- UserConnection (type)

validate

Check if a GraphQL operation is valid against the schema.

Parameters:

Parameter Type Default Description
operation String required GraphQL operation to validate

Validates:

  • Syntax correctness
  • Schema compliance (fields exist, types match)
  • Variable definitions
  • Fragment validity

Examples:

validate(operation: """
  query GetUser($id: ID!) {
    user(id: $id) {
      id
      name
      nonExistentField
    }
  }
""")

Output (error):

Validation failed:
- Field "nonExistentField" not found on type "User"

Output (success):

Operation is valid.
Variables required: { id: ID! }

execute

Run ad-hoc GraphQL operations against the endpoint.

Parameters:

Parameter Type Default Description
operation String required GraphQL operation
variables Object {} Operation variables

Mutation Mode:

Behavior depends on overrides.mutation_mode configuration:

Mode Query Mutation
all Execute Execute
explicit Execute Require confirmation
none Execute Block

Examples:

# Query execution
execute(
  operation: "query { users { id name } }"
)

# With variables
execute(
  operation: """
    query GetUser($id: ID!) {
      user(id: $id) { id name }
    }
  """,
  variables: { id: "123" }
)

# Mutation (requires appropriate mutation_mode)
execute(
  operation: """
    mutation CreateUser($input: CreateUserInput!) {
      createUser(input: $input) { id }
    }
  """,
  variables: { input: { name: "Alice", email: "alice@example.com" } }
)

Minify Notation

Compact notation reduces token usage by 40-60%. Enable globally or per-request.

Type Abbreviations

Symbol Meaning
T type
I input
E enum
U union
F interface

Scalar Abbreviations

Symbol Meaning
s String
i Int
f Float
b Boolean
d ID

Modifiers

Symbol Meaning
! Non-null (required)
[] List
[!] List of non-null
[]! Non-null list
[!]! Non-null list of non-null
@D Deprecated
<> Implements

Examples

Normal:

type Product {
  id: ID!
  name: String!
  price: Float!
  description: String
  tags: [String!]!
  variants: [ProductVariant!]
}

Minified:

T Product { id:d! name:s! price:f! description:s tags:[s!]! variants:[ProductVariant!] }

Custom Tools

Each GraphQL operation becomes an MCP tool with:

  • Tool name: Operation name (e.g., GetUser, CreateProduct)
  • Parameters: Operation variables become tool parameters
  • Description: Generated from operation or custom via directive

Tool Naming

# Tool name: GetUserById
query GetUserById($id: ID!) {
  user(id: $id) { id name }
}

# Tool name: CreateProduct
mutation CreateProduct($input: ProductInput!) {
  createProduct(input: $input) { id }
}

Adding Descriptions

Use comments for tool descriptions:

# Fetches a user by their unique identifier.
# Returns user profile including name and email.
query GetUser($id: ID!) {
  user(id: $id) {
    id
    name
    email
  }
}

The comment becomes the MCP tool description, helping AI agents understand when to use each tool.

Source: SKILL.md on GitHub

1 warning16d5 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    The skill provides a guide and configuration for the Apollo MCP Server, provided by Apollo GraphQL. It includes official installation commands (curl/sh) from the vendor's domain. No malicious behaviors were detected.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer6mo

    2/4 files flagged

  • ZeroLeaks5mo

    1 finding · Score: 82/100

Signed by skilld at f67ffa1. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 7 months ago
What it can do
Runs commands
compatibility
Works with Claude Code, Claude Desktop, Cursor.
metadata
{
  "author": "apollographql",
  "version": "1.1.1"
}
All 1 allowed tools
Bash(rover:*) Bash(npx:*) Read Write Edit Glob Grep
  • MCP
  • API
  • graphql
  • apollo
  • introspection
  • schema
  • claude
  • cursor
  • authentication

README badge

README badge for apollographql/skills/apollo-mcp-server

Exposes GraphQL operations as MCP tools, allowing AI agents to query and mutate GraphQL APIs through the Model Context Protocol. Includes introspection tools (search, validate, execute) and supports operation files, GraphOS collections, and persisted queries with configurable authentication and mutation controls.

Generated from the current SKILL.md.

What transport types does Apollo MCP Server support?
Apollo MCP Server supports streamable_http (recommended for remote and multi-client deployments) and stdio (for clients that launch the server directly). Streamable_http defaults to address 127.0.0.1 and port 8000.
Can I use this with Claude Desktop and Claude Code?
Yes. Apollo MCP Server is compatible with Claude Desktop, Claude Code, and Cursor. Configuration differs slightly: Claude Desktop uses claude_desktop_config.json, while Claude Code uses .mcp.json or the claude mcp add command.
How do I define custom tools from GraphQL operations?
Create GraphQL operation files in a directory (one operation per file) and configure the operations source as local with the directory path. Each named operation automatically becomes an MCP tool. You can also use GraphOS Studio collections or persisted query manifests.
What security settings should I enable for production?
Set mutation_mode to explicit or none (default), use headers configuration for API keys, enable health checks, disable introspection tools, and authenticate requests with Bearer tokens or OAuth. Use persisted queries instead of ad-hoc operations.
What are the four built-in introspection tools?
introspect (explore schema types), search (find types in schema), validate (check operation validity), and execute (run ad-hoc GraphQL operations). All four are disabled by default and must be explicitly enabled in config.yaml.

Generated from the current SKILL.md. These answers refresh after source changes.