Hive Gateway MCP ServerBeta
Turn your GraphQL API into an MCP server
Hive Gateway exposes the GraphQL operations you choose to AI agents as typed MCP tools and resources. You pick the operations, and the gateway derives their input and output schemas from your supergraph.
- You choose the operations
- Typed input and output schemas
- MIT licensed
How it works
- 1
You pick the operations
A tool is one GraphQL operation, exposed to agents under a name of your choice. Write it inline in the gateway config, keep it in a .graphql file, or mark it with the @mcpTool directive.
- 2
The gateway derives the schemas
The tool's input schema comes from the operation's variables and its output schema from the selection set, so agents know what to send and what to expect.
- 3
Agents list and call the tools
The gateway loads the schema, validates the arguments, runs the operation against your subgraphs and formats the response. You only define which operations become tools.
The MCP plugin is in beta. Its configuration and behavior may change between releases as the protocol and the plugin evolve. The docs are updated alongside it.
A GraphQL MCP server you control
Decide which operations agents can call, what each tool looks like to them and where its description comes from.
Three ways to define a tool
Inline queries in the configuration, named operations from .graphql files, or the @mcpTool directive on the operation itself. The configuration is plain data, so it can also live in a YAML or JSON file.
Learn moreShape what agents see
Rename a variable with an alias, give it a description, examples and a default, and narrow the response to a nested value with output.path. The advertised output schema is narrowed to match.
Learn moreValues agents never set
A tenant or user id belongs to your authentication layer, not to the agent. @mcpHeader hides the variable from the input schema and fills it from a request header on every call.
Learn moreHooks around every call
preprocess runs before the GraphQL execution and can short-circuit with its own result. postprocess receives the GraphQL result and returns what the agent gets.
Learn moreResources next to your tools
Serve documents agents read for context, such as an API guide or a schema, as static resources or as resource templates with a URI pattern and a handler.
Learn moreDescriptions you can iterate on
An agent reads the description of a tool to decide when to call it. Description providers resolve descriptions at runtime from Langfuse or your own service, so you refine them without changing the gateway configuration.
Learn more
From a GraphQL operation to an MCP tool in three steps
Add the plugin to the gateway you already run. Then point any MCP client, such as an IDE assistant, an agent framework or the MCP Inspector, at http://localhost:4000/mcp.
Full MCP guide- 1
Install the plugin
It runs on the JavaScript distributions of Hive Gateway: the hive-gateway CLI with a gateway.config.ts, or the gateway runtime package.
npm i @graphql-hive/plugin-mcp - 2
Choose the operations to expose
In gateway.config.ts. The simplest tool is an inline query. Then start the gateway as usual, for example with hive-gateway supergraph.
import { defineConfig } from '@graphql-hive/gateway' import { useMCP, type MCPConfig } from '@graphql-hive/plugin-mcp' const mcp: MCPConfig = { name: 'my-api', tools: [ { name: 'get_users', source: { type: 'inline', query: `query ($limit: Int) { users(limit: $limit) { id name } }` } } ] } export const gatewayConfig = defineConfig({ plugins: ctx => [useMCP(ctx, mcp)] }) - 3
List the tools
MCP speaks JSON-RPC over HTTP, so curl is enough to check the server.
curl http://localhost:4000/mcp \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
Beyond the first tool
Load operations at runtime, describe how each tool behaves and manage descriptions per environment.
Every MCP feature, by name
Everything the MCP plugin documents today, linked to the page that explains it.
Getting started
Defining tools
Input
Output
Resources and operations
Description providers
Explore Hive 360° GraphQL Ecosystem to reach full potential
Learn moreFrequently Asked Questions
What is a GraphQL MCP server?
The Model Context Protocol (MCP) is the standard AI agents use to discover and call external tools. A GraphQL MCP server offers GraphQL operations as those tools. With the @graphql-hive/plugin-mcp plugin, Hive Gateway becomes an MCP server: you pick the GraphQL operations you want to expose, and each one becomes a tool that agents can list and execute, with typed input and output schemas derived from your supergraph. Read more.
Is the Hive Gateway MCP server stable?
It is in beta. The configuration and behavior of the MCP plugin may change between releases as the protocol and the plugin evolve, and the docs are updated alongside it. Read the docs.
Which GraphQL operations do agents get?
The ones you define as tools. A tool is one GraphQL operation exposed under a name of your choice: an inline query in the configuration, a named operation from a .graphql file, or an operation carrying the @mcpTool directive. Operations in .graphql files must be named; anonymous operations are not supported there. Read more.
Which MCP clients can connect?
Point any MCP client, such as an IDE assistant, an agent framework or the MCP Inspector, at the MCP endpoint. It is served at /mcp next to your GraphQL endpoint, and the path option changes it. MCP speaks JSON-RPC over HTTP, so curl is enough to check the server. Read more.
Which parts of the Model Context Protocol does it implement?
The plugin implements the initialize, tools/list, tools/call, resources/list, resources/read and resources/templates/list methods. It advertises MCP protocol version 2025-11-25 by default, which the protocolVersion option overrides. See the configuration reference.
Which Hive Gateway distributions does the plugin run on?
The JavaScript distributions: the hive-gateway CLI with a gateway.config.ts, or the @graphql-hive/gateway-runtime package. See the quick start for both.
How do I pass a tenant or user id without letting the agent set it?
Use the @mcpHeader directive on the variable. It hides the variable from the input schema and fills it from the named request header on every call. If the header is missing, the tool call returns an error. To transform the value or fall back to a default, hide the variable and set it in a preprocess hook. Read more.
Can I change a tool description without redeploying the gateway?
Yes. Description providers resolve tool and field descriptions at runtime from Langfuse or a custom provider. Descriptions are resolved when tools are listed, so an edited Langfuse prompt takes effect on the next tools/list. If Langfuse is unreachable, tools keep their fallback descriptions. Read more.
Can tools come from persisted documents in Hive?
Yes. createHiveLoader resolves an app deployment manifest from the Hive CDN, fetches every persisted GraphQL document in it and returns them as one operations source. Operations carrying @mcpTool are registered as tools, and the others are available to tools declared in the configuration. Read more.
Is the MCP plugin open source?
Yes. The plugin is part of the Hive Gateway repository and is MIT licensed, like Hive Gateway itself. It is published on npm as @graphql-hive/plugin-mcp.
Get your
API game right.
- Built by engineers to improve developer experience
- Driven by customers
- No vendor lock-in