Grafbase MCP server

Command-line tool for managing GraphQL APIs with features for local development, federation, and deployment across various connectors including GraphQL, OpenAPI, and MongoDB.
Back to servers
Setup instructions
Provider
Grafbase
Release date
May 20, 2025
Language
TypeScript
Stats
1.2K stars

Grafbase is a self-hosted, Rust-powered GraphQL Federation Gateway designed for high-performance, mission-critical applications. It helps unify microservices, legacy systems, and third-party APIs with superior speed and built-in Model Context Protocol (MCP) server support to turn your GraphQL API into a full-fledged MCP server.

Installation

Basic Installation

To install the Grafbase Gateway, run the following command:

curl -fsSL https://grafbase.com/downloads/gateway | bash

Docker Installation

You can also deploy Grafbase using Docker:

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

Configuration and Usage

Deployment Modes

Grafbase Gateway can be deployed in two primary modes:

Hybrid Mode

Connect to Grafbase Cloud with a graph reference and organization access token:

GRAFBASE_ACCESS_TOKEN=token ./grafbase-gateway \
  --config grafbase.toml \
  --graph-ref graph@branch

Air-gapped Mode

Run completely self-contained with a local schema file:

./grafbase-gateway \
  --config /path/to/grafbase.toml \
  --schema /path/to/federated-schema.graphql \
  --listen-address 127.0.0.1:4000

Key Features

Federation Support

Grafbase provides native support for Apollo Federation v2 specification with 40% faster performance thanks to its Rust-powered engine.

Universal Data Integration

Connect to various data sources through GraphQL Federation:

  • GraphQL subgraphs
  • REST APIs
  • gRPC services
  • Databases (Postgres, Snowflake)
  • Message queues (Kafka, NATS)

Extending with WebAssembly

Customize functionality with WebAssembly extensions:

# Create a custom authentication extension
grafbase extension init --type authentication auth-guard
cd auth-guard

# Build and install
grafbase extension build
grafbase extension install

Extension use cases include:

  • Custom authentication (JWT validation, API key management)
  • Custom authorization
  • Arbitrary resolvers for non-GraphQL APIs
  • Observability hooks
  • Rate limiting

Advanced Security Features

  • JWT authentication and federated authorization
  • Rate limiting, operation limits, and trusted documents
  • Fine-grained authorization in the Gateway

Observability

  • OpenTelemetry integration for logs, traces, and metrics
  • Health check endpoints

Getting Started Guide

For a complete introduction to Grafbase and GraphQL Federation, refer to the getting started guide at grafbase.com/guides/introduction-to-graphql-federation.

Additional Resources

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "grafbase" '{"command":"npx","args":["-y","grafbase"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "grafbase": {
            "command": "npx",
            "args": [
                "-y",
                "grafbase"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "grafbase": {
            "command": "npx",
            "args": [
                "-y",
                "grafbase"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later