SP SpecPulse AI v6.0
SpecPulse AI / AI Search, /llms.txt & MCP Guides

Apollo GraphQL Federation v2 to MCP Server & llms.txt Compiler (2026 Guide)

Apollo GraphQL Federation v2 to MCP Server & llms.txt Compiler (2026 Guide)

● Live Inline 5-Axis Diagnostic + Instant 1-Click $9 / $19 / $29 / $99 Unlock Zero Redirect Bounce • Apple Pay / Google Pay / Link • No Subscription Required

Scan Your Website AI-Readiness Inline (0–100)

Enter your domain to inspect live /llms.txt, ACP/UCP & MCP 2026-07-28 blockers right here on this page—and unlock your compiled 7-file bundle + git apply .patch in 1 click.

âś“ Zero dev tickets (60s 1-line embed.js) âś“ Zero CWV / SEO speed impact âś“ Works on Shopify, WordPress, Webflow & Next.js

title: "Apollo GraphQL Federation v2 to MCP Server & llms.txt Compiler (2026 Guide)"

slug: "/guides/apollo-graphql-federation-v2-subgraph-to-mcp-server-llms-txt"

lp_id: "LP29"

sprint: "Sprint #9 (v3.5)"

published_at: "2026-11-19"

target_keyword: "Apollo GraphQL Federation v2 to MCP Server & llms.txt Compiler (2026 Guide)"

secondary_keywords:

  • "Apollo Federation v2 MCP server"
  • "compile _entities @key subgraph to stateless MCP 2026-07-28"
  • "GraphQL supergraph SEP-2127 server card"
  • "Apollo subgraph llms.txt v2 compiler"
  • "Chrome Lighthouse ard.json GraphQL API"

Apollo GraphQL Federation v2 to MCP Server & llms.txt Compiler (2026 Guide)

Exposing an enterprise GraphQL supergraph to AI agents in late 2026 presents an architectural trap: raw subgraph schemas contain internal router mechanics that should never reach an LLM tool-calling context, while running stateful sidecar bridges per subgraph multiplies infrastructure and token overhead. Platform teams running Apollo Federation 2 need a deterministic build step that strips internal entity plumbing and emits standards-compliant agent discovery manifests in seconds.

SpecPulse AI (curl -fsSL https://specpulse.dev/cli.mjs -o specpulse.mjs && node specpulse.mjs ./openapi.json) compiles federated GraphQL SDL—across standalone .graphql subgraph files, supergraph compositions, OpenAPI 3.0–3.2 specs, and Markdown docs—into 5 production-ready AI agent artifacts in under 5 seconds:

# Try Free Instantly (up to 3 federated operations, zero signup required)
curl -fsSL https://specpulse.dev/api/v1/scan?url=https://yourdomain.com
curl -fsSL https://specpulse.dev/cli.mjs -o specpulse.mjs && node specpulse.mjs ./openapi.json
  --subgraph ./subgraphs/orders/schema.graphql \
  --subgraph ./subgraphs/inventory/schema.graphql \
  --router-url https://graph.example.com/graphql \
  --out ./public

Why Raw Federation v2 Subgraphs Break LLM Tool Calling & Leak Internal Topology

Under the Apollo Federation Subgraph Specification, every Federation 2 subgraph automatically injects synthetic root fields, unions, scalars, and composition directives so the router can plan distributed execution:

  • Hidden Enhanced Introspection Survives introspection: false: Even when a team disables standard GraphQL __schema introspection in production, Federation subgraphs still expose Query._service { sdl: String! } so routers can retrieve raw SDL—including internal directives—unless explicitly stripped or firewalled at the gateway, as documented in the Apollo Subgraph Enhanced Introspection Reference.
  • Query._entities(representations: [_Any!]!): [_Entity]! Hallucination Loops: When naive schema-to-MCP converters ingest raw subgraph files, they expose _entities and the unvalidated _Any JSON scalar as callable LLM tools. Coding agents repeatedly hallucinate malformed {"__typename": "...", ...} representations or attempt to call non-resolvable entity stubs (@key(fields: "id", resolvable: false)), triggering downstream __resolveReference N+1 storms.
  • Directive Leakage (@inaccessible, @external, @requires, @override): Fields marked @inaccessible in Apollo Federation Directives are intentionally hidden from the public supergraph contract during staged migrations or internal microservice joins. Feeding raw subgraph SDL directly to an agent leaks internal field names, deprecated microservice boundaries (@override(from: "legacy-billing")), and authorization scopes (@requiresScopes, @policy).

SpecPulse v3.5 solves this at build time with a deterministic Federation v2 AST Pruner & Entity Join Resolver before a single token reaches the compiler.

Architecture Comparison: SpecPulse v3.5 vs. Runtime MCP Bridges & DIY Scripts

CapabilitySpecPulse AI v3.5 (curl -fsSL https://specpulse.dev/cli.mjs -o specpulse.mjs && node specpulse.mjs ./openapi.json)Apollo MCP Server v2Naive GraphQL Introspection-to-MCP Scripts
Primary Execution ModelDeterministic 5-second build-time compiler emitting static + stateless edge artifacts (MCP 2026-07-28)Runtime GraphQL-to-MCP server process deployed via Rover CLI or cloud containers (Apollo MCP Server Docs)Ad-hoc runtime __schema introspection wrapper over stateful SSE/stdio
Federation v2 @key / _entities HandlingResolves @key entity joins across subgraphs into unified supergraph tools; strips _entities, _service, _Any, and resolvable: false stubs (Subgraph Spec)Operates against composed GraphOS persisted queries, operation .graphql files, or router introspection (Apollo MCP Server Docs)Leaks raw Query._entities and Query._service { sdl } directly into LLM tool schemas
@inaccessible & @requiresScopes EnforcementPrunes @inaccessible AST nodes pre-LLM and maps @authenticated / @requiresScopes to RFC 8707 & RFC 9728 OAuth metadataRelies on GraphOS Operation Collections and downstream router policy enforcement (Apollo Directives)Zero directive awareness; exposes internal fields to unprivileged agents
Mutation Write-Replay ProtectionAuto-injects RFC 8941 Structured Field Idempotency-Key header requirements on every GraphQL Mutation toolManual header forwarding via YAML config or Rhai lifecycle scripts (Apollo MCP Server Docs)None—agent retries duplicate orders, refunds, or mutations
Domain Discovery Suite (SEP-2127 + ard.json + llms.txt + SKILL.md)Generates all 5 artifacts simultaneously (mcp-server.json, SEP-2127, Lighthouse ard.json v0.91, Lighthouse llms.txt, AAIF SKILL.md)MCP transport & MCP Apps focus; does not emit Lighthouse ard.json v0.91, /llms.txt v2, or AAIF SKILL.mdSingle non-standard tools.json dump
50-Operation Compilation Cost$0.144/run ($0.148 2-pool lock) cold / $0.0034/run ($0.0043 90/10 lock) PR diff via RFC 8785 JCS prefix + asymmetric batchingContainer compute + GraphOS plan + live LLM introspection tokens per session$1.25–$3.39/run unbatched frontier LLM calls

> Architectural Synergy: Teams already running Apollo MCP Server v2 in production use SpecPulse v3.5 in CI/CD to auto-compile their curated .graphql operation collections and subgraph schemas into /.well-known/ard.json (v0.91), /.well-known/mcp-server.json (SEP-2127), /llms.txt v2 (<= 50KB), and AAIF SKILL.md playbooks so external registries and Chrome Lighthouse 13.5+ discover their Apollo endpoint with a 1.00 Pass score.

Step-by-Step Tutorial: Compiling Two Federated Subgraphs Without Exposing Internal Resolvers

Suppose your commerce platform splits Order and Product across two Apollo Server @apollo/subgraph microservices using Federation v2.3 directives.

Step 1: Inspect Your Raw Federation v2 Subgraph Schemas

Notice how subgraphs/orders/schema.graphql uses @key, @requiresScopes, @inaccessible, and an unresolvable User entity stub (resolvable: false), while subgraphs/inventory/schema.graphql extends Product with @external and @requires:

# subgraphs/orders/schema.graphql
extend schema
  @link(
    url: "https://specs.apollo.dev/federation/v2.3"
    import: ["@key", "@inaccessible", "@authenticated", "@requiresScopes"]
  )

type Query {
  "Fetch a customer order with line items and fulfillment status."
  orderById(id: ID!): Order @authenticated
}

type Mutation {
  "Create a confirmed checkout order and capture payment authorization."
  createOrder(input: CreateOrderInput!): OrderPayload!
    @authenticated
    @requiresScopes(scopes: [["orders:write"]])
}

type Order @key(fields: "id") {
  id: ID!
  status: OrderStatus!
  totalCents: Int!
  items: [Product!]!
  internalFraudScore: Float! @inaccessible
  buyer: User!
}

type Product @key(fields: "upc") {
  upc: String!
  quantity: Int!
}

# Reference stub resolved exclusively by the Accounts subgraph
type User @key(fields: "id", resolvable: false) {
  id: ID!
}

input CreateOrderInput {
  cartId: ID!
  currency: String! = "USD"
  shippingPostalCode: String!
}

enum OrderStatus {
  PENDING
  CONFIRMED
  SHIPPED
}

type OrderPayload {
  order: Order
  userErrors: [String!]!
}
# subgraphs/inventory/schema.graphql
extend schema
  @link(
    url: "https://specs.apollo.dev/federation/v2.3"
    import: ["@key", "@external", "@requires", "@shareable", "@inaccessible"]
  )

type Product @key(fields: "upc") {
  upc: String!
  name: String! @shareable
  weightGrams: Int! @external
  inStock: Boolean!
  "Calculated shipping estimate using external weightGrams from Catalog subgraph."
  estimatedShippingCents: Int! @requires(fields: "weightGrams")
  warehouseBinCode: String @inaccessible
}

If an engineering script dumps these subgraphs straight into an MCP tool generator, internalFraudScore, warehouseBinCode, weightGrams @external, Query._entities, and Query._service all leak into the prompt or generated schema.

Step 2: Run the SpecPulse v3.5 Federation Compiler

Execute curl -fsSL https://specpulse.dev/cli.mjs -o specpulse.mjs && node specpulse.mjs ./openapi.json in local or CI mode. SpecPulse merges @key(fields: "upc") entity extensions across subgraphs, strips @inaccessible and @external-only fields, discards Query._service / Query._entities / resolvable: false stubs, canonicalizes the composed AST with RFC 8785 JSON Canonicalization Scheme (JCS), and emits all 5 artifacts:

curl -fsSL https://specpulse.dev/api/v1/scan?url=https://yourdomain.com
curl -fsSL https://specpulse.dev/cli.mjs -o specpulse.mjs && node specpulse.mjs ./openapi.json
  --subgraph ./subgraphs/orders/schema.graphql \
  --subgraph ./subgraphs/inventory/schema.graphql \
  --router-url https://api.acmecommerce.example/graphql \
  --oauth-resource https://api.acmecommerce.example/graphql \
  --publisher acmecommerce \
  --namespace commerce-graph \
  --out ./dist/agent-artifacts

Step 3: Inspect the Generated Stateless MCP 2026-07-28 Schema (mcp-server.json)

Following the MCP 2026-07-28 Tools Specification and SEP-2575 Stateless MCP, every HTTP POST carries MCP-Protocol-Version: 2026-07-28 with zero server-side Mcp-Session-Id state. Notice three critical safety guarantees in the compiled create_order mutation tool below:

  • internalFraudScore and warehouseBinCode (@inaccessible) are completely absent from the selection set and outputSchema.
  • @requiresScopes(scopes: [["orders:write"]]) compiles directly into an RFC 8707 OAuth 2.0 resource binding paired with RFC 9728 Protected Resource Metadata so tokens minted for another service are rejected.
  • Because createOrder is a GraphQL Mutation, SpecPulse injects a mandatory RFC 8941 Structured Field Idempotency-Key Byte Sequence / String header guard to prevent duplicate payment captures on agent retries:

Step 4: Inspect the SEP-2127 Server Card & Chrome Lighthouse ard.json (v0.91)

Per SEP-2127: MCP Server Cards, public discovery cards must exclude primitive definitions (tools, resources, prompts) so clients never rely on static public JSON for access-control decisions and instead validate tools/list at runtime with the authenticated user's token. SpecPulse writes a strict SEP-2127 card at /.well-known/mcp-server.json (and /mcp/server-card) alongside a 1.00-scoring Chrome Lighthouse ard.json (v0.91) manifest:

// /.well-known/mcp-server.json (SEP-2127 Final Extensions Track Compliant)
{
  "name": "io.acmecommerce/commerce-supergraph",
  "title": "Acme Commerce Federated Supergraph MCP",
  "version": "3.5.0",
  "description": "Stateless MCP 2026-07-28 gateway for federated Order and Inventory GraphQL operations with RFC 8707 OAuth resource binding.",
  "websiteUrl": "https://api.acmecommerce.example/docs",
  "transports": [
    {
      "type": "streamable-http",
      "url": "https://api.acmecommerce.example/mcp",
      "supportedProtocolVersions": ["2026-07-28"],
      "headers": {
        "MCP-Protocol-Version": "2026-07-28",
        "Authorization": "Bearer ${OAUTH_ACCESS_TOKEN}"
      }
    }
  ]
}
// /.well-known/ard.json (Passes Chrome Lighthouse 13.5+ ARD v0.91 Suite with Score = 1.00)
{
  "entries": [
    {
      "identifier": "urn:air:acmecommerce:commerce-graph:mcp-gateway",
      "displayName": "Acme Commerce Federated Supergraph MCP Server",
      "type": "application/mcp-server-card+json",
      "url": "https://api.acmecommerce.example/.well-known/mcp-server.json",
      "capabilities": ["order_by_id", "create_order"],
      "representativeQueries": [
        "Look up order fulfillment status and live item stock by order ID",
        "Submit a confirmed checkout cart with idempotent payment authorization",
        "Calculate federated product shipping estimates across inventory warehouses"
      ],
      "trustManifest": {
        "identity": "did:web:api.acmecommerce.example"
      }
    },
    {
      "identifier": "urn:air:acmecommerce:commerce-graph:checkout-skill",
      "displayName": "Acme Federated Checkout & Order Triage Skill",
      "type": "application/agent-skill+markdown",
      "url": "https://api.acmecommerce.example/.well-known/skills/commerce-checkout/SKILL.md",
      "representativeQueries": [
        "Verify cart inventory stock before executing an idempotent order mutation",
        "Triage userErrors returned from federated GraphQL checkout mutations"
      ]
    }
  ]
}

Notice how /.well-known/ard.json avoids every Chrome Lighthouse ard.json best-practice warning that drops scores from 1.00 to 0.90 or 0.00: it uses application/mcp-server-card+json (not the deprecated application/mcp-server+json), omits the deprecated top-level collections array, defines urn:air:<publisher>:<namespace>:<name> identifiers, sets url without conflicting inline data, and populates 2–5 representativeQueries strings per entry.

Step 5: Token-Budgeted /llms.txt v2 (<= 50KB) & AAIF SKILL.md

Enterprise supergraphs routinely exceed 1.5 MB of raw SDL—far too large for rapid domain indexing. SpecPulse's topological ranker compresses your supergraph contract into a deterministic <= 50KB /llms.txt v2 index (satisfying the Chrome Lighthouse llms.txt check) while emitting modular < 500-line workflow guides in /.well-known/skills/<slug>/SKILL.md per the AAIF Agent Skills Specification:

# Acme Commerce Supergraph API (/llms.txt v2 — 11.4 KB / 50.0 KB Budget)

> Stateless MCP 2026-07-28 & Federated GraphQL Supergraph for Order Lookup, Live Inventory Availability, and Idempotent Checkout Execution.

## Discovery & Agent Manifests
- [ARD v0.91 Resource Catalog](https://api.acmecommerce.example/.well-known/ard.json): Domain-anchored URN index for MCP servers and AAIF skills.
- [SEP-2127 MCP Server Card](https://api.acmecommerce.example/.well-known/mcp-server.json): Streamable HTTP connection metadata (`MCP-Protocol-Version: 2026-07-28`).
- [Stateless MCP Tool Schemas](https://api.acmecommerce.example/mcp-server.json): JSON Schema 2020-12 contracts with RFC 8707 OAuth resource indicators.
- [AAIF Agent Skills Index](https://api.acmecommerce.example/.well-known/skills/index.json): Portable multi-step GraphQL execution playbooks.

## Public Supergraph Operations (Internal @inaccessible & _entities Stripped)
- `query orderById(id: ID!): Order` — Requires `Bearer` token (`@authenticated`). Joins `Order` with live `Product.inStock` and `Product.estimatedShippingCents`.
- `mutation createOrder(input: CreateOrderInput!): OrderPayload!` — Requires OAuth scope `orders:write` (`resource=https://api.acmecommerce.example/graphql`) + RFC 8941 `Idempotency-Key` header.

Security Checklist for Federated GraphQL Agent Gateways

Before shipping any GraphQL-backed MCP endpoint to external coding agents or internal enterprise copilots, enforce these five controls (automated out of the box by curl -fsSL https://specpulse.dev/cli.mjs -o specpulse.mjs && node specpulse.mjs ./openapi.json):

  • Block Query._service & Query._entities at the Public Edge: Ensure public routers reject external _service { sdl } queries even when standard GraphQL introspection is turned off, matching the security guidance in the Apollo Federation Subgraph Specification.
  • Prune @inaccessible, @external, and resolvable: false Types Pre-Compilation: Validate your subgraph directives against Apollo Federation Directives so staged migration fields never enter /llms.txt or inputSchema descriptions.
  • Bind Every OAuth Token with RFC 8707 Resource Indicators: Require resource=<canonical-graphql-uri> during token exchange per RFC 8707 and publish RFC 9728 Protected Resource Metadata so bearer tokens stolen from adjacent tools cannot execute supergraph mutations.
  • Enforce RFC 8941 Idempotency-Key Headers on All Mutations: Autonomous agents retry tool calls on network timeouts; typing Idempotency-Key as an RFC 8941 Structured String eliminates duplicate mutations at the edge in < 5ms.
  • Keep Primitive Schemas Out of SEP-2127 Discovery Cards: Serve public connection metadata at /.well-known/mcp-server.json per SEP-2127 and gate tools/list behind authenticated stateless 2026-07-28 POST requests.

Pricing & Instant CLI Quickstart (v3.5)

Compile your first federated subgraph locally in 5 seconds—no credit card or cloud login required on the Free Tier—and scale seamlessly from single-repo GraphQL APIs to multi-team enterprise supergraphs.

PlanPriceIncluded Capacity & Federation v3.5 CapabilitiesBest ForInstant CLI Activation
Free Tier$0Up to 3 endpoints / GraphQL operations, all 5 artifacts (/llms.txt v2, ard.json v0.91, Stateless MCP 2026-07-28, SEP-2127, AAIF SKILL.md), local @inaccessible & _entities leak auditIndividual developers testing Federation v2 -> MCP compilationcurl -fsSL https://specpulse.dev/cli.mjs -o specpulse.mjs && node specpulse.mjs ./openapi.json
Single-Run Credit Pack$10 one-time (never expires)Powers 72 full 50-operation cold rebuilds ($0.144/run ($0.148 2-pool lock)) or 2,600+ incremental PR diffs ($0.0034/run ($0.0043 90/10 lock)); zero recurring subscriptionQuarterly API launches, agency handoffs, or one-off supergraph migrationscurl -fsSL https://specpulse.dev/cli.mjs -o specpulse.mjs && node specpulse.mjs ./openapi.json
Pro Monthly$29/moUp to 250 operations/endpoints, automated GitHub Actions PR diff bot + specpulse-badge.svg, asymmetric 8-EP/5-EP Gemini cost guardProduction SaaS & GraphQL API teams shipping weekly schema updatescurl -fsSL https://specpulse.dev/cli.mjs -o specpulse.mjs && node specpulse.mjs ./openapi.json
Pro Annual$290/yr (2 months free — save $58/yr)Everything in Pro Monthly + priority 5-min warm KV cohort routing and annual invoice lockHigh-velocity startups standardizing on MCP 2026-07-28 & Lighthouse 13.5+curl -fsSL https://specpulse.dev/cli.mjs -o specpulse.mjs && node specpulse.mjs ./openapi.json
Team Monthly$99/moUnlimited multi-subgraph supergraphs & OpenAPI 3.0–3.2 repos, @requiresScopes / RFC 8707 policy gates, sp_t_<56_hex> tenant isolation, Slack/Linear breaking-diff alertsMulti-squad GraphQL platform engineering & API governance teamscurl -fsSL https://specpulse.dev/cli.mjs -o specpulse.mjs && node specpulse.mjs ./openapi.json
Team Annual$990/yr (2 months free — save $198/yr)Everything in Team Monthly + org-wide GitHub required status check templates & dedicated schema migration audit logsEnterprise platform orgs governing 10+ federated subgraphscurl -fsSL https://specpulse.dev/cli.mjs -o specpulse.mjs && node specpulse.mjs ./openapi.json
# 1. Audit your Apollo Federation v2 subgraphs for _entities / @inaccessible leaks in 5 seconds (Free)
curl -fsSL https://specpulse.dev/api/v1/scan?url=https://yourdomain.com
curl -fsSL https://specpulse.dev/cli.mjs -o specpulse.mjs && node specpulse.mjs ./openapi.json

# 2. Compile all 5 AI-agent artifacts and verify Chrome Lighthouse ARD v0.91 = 1.00 Pass
curl -fsSL https://specpulse.dev/api/v1/scan?url=https://yourdomain.com
curl -fsSL https://specpulse.dev/cli.mjs -o specpulse.mjs && node specpulse.mjs ./openapi.json

# 3. Activate Pro Annual ($290/yr — 2 months free) or a $10 Single-Run Credit Pack straight from terminal
curl -fsSL https://specpulse.dev/api/v1/scan?url=https://yourdomain.com
curl -fsSL https://specpulse.dev/cli.mjs -o specpulse.mjs && node specpulse.mjs ./openapi.json

Stop Losing AI Search Buyers to Competitors — Go Live in 60 Seconds

No sales demos, zero lock-in, instant 1-click cancellation • Save 2 months on Annual plans (Pro $290/yr · Agency $2,990/yr)

1-Line Universal Install (Shopify, WordPress, Webflow, Framer & Next.js — <2.5KB):
<script src="https://specpulse.dev/embed.js" data-site="your-domain-com" defer></script>

Related GEO, /llms.txt & Hosted MCP Playbooks

Sovereign 5-Pillar AI Trust Center (/trust) & Agent-to-Wallet Apple Pay Bridge (/pay) | SpecPulse v9.6
Pair Claude Code, Cursor & ChatGPT MCP agents with 3-second iPhone Apple Pay / Google Pay QR checkout (/pay/<claimId>) and certify all 5 Sovereign AI Trust Pillars at /trust/<slug>.
Stop Paying 20% OTA Commissions on Guests Asking ChatGPT for Your Hotel | SpecPulse Hospitality Shield
Booking.com & Expedia capture 54%+ of AI hotel citations with a 21.8% cancellation rate (vs 10.6% direct). Deploy rate-parity-safe Direct-Booking Perks Schema & Live Hotel MCP in 60s for $69.
llms.txt Slopsquatting Scanner & RFC 8785 JWS Signed agent-card.json Generator | SpecPulse AI
Audit /llms.txt for unregistered npm/PyPI Slopsquatting supply-chain hijacks, sign /.well-known/agent-card.json with RFC 8785 JCS/JWS, and enable HTTP 402 scraper tolls in 60s.
Why ChatGPT Shopping & Stripe ACP (spt_1) Reject Shopify Products — 8-Axis Validator & Fix
Catch OAI-SearchBot robots.txt blocks, seo.hidden flags, string-typed enable_checkout bugs, and OpenAI ACP line_items + Stripe Shared Payment Token (spt_1) schema rejections in 5 seconds.
Cloud, LLM Token & Cloudflare/Vercel Bill-Shock FinOps Circuit-Breaker ($29 Kit) | SpecPulse Labs
Stop Cloudflare Workers Observability trace overages, Vercel Fluid Compute bot surges, and OpenAI/Anthropic MCP retry-loop token burn in 60s. Instant $29 wrangler.toml + Edge Circuit-Breaker pack.
Automated B2B AI DPA, Zero-Data-Retention (ZDR) & Subprocessor Redline Generator | SpecPulse Labs
Close year-end enterprise B2B SaaS contracts in 60 seconds without $3,000+ legal delays: generate a 12-clause AI DPA Addendum (Zero-Data-Retention, EU AI Act Art.25/28, GDPR 2021 SCCs & subprocessors.json) for $59 one-time.