Get the FREE Ultimate OpenClaw Setup Guide →

grafbase

The Grafbase GraphQL Federation Gateway

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio grafbase-grafbase ./grafbase-gateway --config grafbase.toml --schema /path/to/federated-schema.graphql \
  --env GRAFBASE_ACCESS_TOKEN="token (for hybrid mode with Grafbase Cloud) or leave unset for fully self-hosted mode"

How to use

Grafbase provides a self-hosted, high-performance GraphQL Federation gateway with built-in MCP server support. It unifies multiple subgraphs, REST/grpc sources, and databases under a single federated schema, and exposes an MCP endpoint to efficiently manage model context for your GraphQL API. Use the grafbase-gateway binary to run the gateway locally or in your infrastructure, configuring it with a federation config file and a federated schema. The MCP capability lets you expose your GraphQL API as an MCP server with minimal setup, enabling clients to discover and interact with the API's Model Context Protocol endpoints as part of the gateway lifecycle. The gateway supports features like JWT authentication, authorization, request lifecycle hooks, and observability, making it suitable for mission-critical environments. To use, place your GraphQL federated schema and a grafbase.toml configuration, then start the gateway with the appropriate flags. The gateway will host your federated graph, apply your extensions, and expose MCP endpoints for consuming clients.

How to install

Prerequisites:

  • A machine with Linux/macOS or Windows compatible with Docker or native binaries.
  • Network access to pull binaries or run containers.

Installation steps (native binary):

  1. Download the Grafbase gateway binary (grafbase-gateway) from the official source or use the provided installer script: curl -fsSL https://grafbase.com/downloads/gateway | bash
  2. Verify the binary is executable: chmod +x grafbase-gateway
  3. Prepare your configuration files:
    • grafbase.toml (gateway configuration)
    • federated-schema.graphql (your federated GraphQL schema)
  4. Run the gateway with your config: ./grafbase-gateway --config grafbase.toml --schema /path/to/federated-schema.graphql

Installation steps (Docker):

  1. Pull the Grafbase gateway image: docker pull ghcr.io/grafbase/gateway:latest
  2. Run the container with your config and schema mounted: docker run -p 4000:4000
    -v $(pwd)/grafbase.toml:/etc/grafbase.toml
    -v $(pwd)/schema.graphql:/etc/schema.graphql
    ghcr.io/grafbase/gateway:latest
    --config /etc/grafbase.toml
    --schema /etc/schema.graphql

Notes:

  • Replace /path/to/federated-schema.graphql and grafbase.toml with your actual file paths.
  • If you intend to use hybrid mode with Grafbase Cloud, set GRAFBASE_ACCESS_TOKEN accordingly.

Additional notes

Tips and common issues:

  • Ensure your federated schema is valid Apollo Federation v2 compatible for best results.
  • If using MCP, define the server name in the mcp_config clearly and keep the port accessible to MCP clients.
  • When running in hybrid mode, securely manage the Grafbase access token; rotate tokens as needed.
  • Check gateway logs for startup errors related to config parsing or schema compatibility.
  • For production, consider deploying behind a reverse proxy and enabling OpenTelemetry-based observability for traces and metrics.

Related MCP Servers

Sponsor this space

Reach thousands of developers