MCP Server GraphQL Endpoints
- Applies to
- Gatewayruntime for API, AI, and MCP gateways
- Hosting
- Managed EdgeManaged DedicatedSelf-Hosted
The MCP Server Handler supports GraphQL endpoints through the x-zuplo-route
OpenAPI extension. A GraphQL route becomes a set of MCP tools that let AI
systems read your schema and run operations, without a tool definition for each
query.
Your project's compatibility date picks the tools a GraphQL route registers:
| Compatibility date | Tools |
|---|---|
2026-11-06 and later | Schema tool (SDL), query tool (queries only), mutation tool (mutations only) |
Before 2026-11-06 | Introspection tool, execute tool (any operation) |
The schema, query, and mutation tools keep reads and writes in separate tools,
so MCP clients and MCP directories can tell them apart, and you can turn writes
off. To use them, set "compatibilityDate": "2026-11-06" or later in
zuplo.jsonc.
Quick Start
1. Configure a GraphQL Endpoint
Add a route that forwards to your GraphQL endpoint and include the
x-zuplo-route.mcp configuration:
Code
2. Add to Your MCP Server
Include the GraphQL route in your MCP Server configuration using the
operations array:
Code
On compatibility date 2026-11-06 or later, this configuration creates:
graphql_schema- Returns types of the GraphQL schema as SDLgraphql_query- Runs GraphQL queriesgraphql_mutation- Runs GraphQL mutations
On an earlier date, it creates:
graphql_introspect- Fetches the GraphQL schemagraphql_execute_query- Runs any GraphQL operation
Configuration Options
These options apply on every compatibility date:
type: Must be set to"graphql".enabled: Set tofalseto register no tools for the route (default:true). Before compatibility date2026-11-06, the route ignoresenabled: false.
Each set of tools has its own options, described below. A route that sets an
option of the other set fails the build: for example, executeTool on
compatibility date 2026-11-06 or later, or queryTool on an earlier date. An
introspectionTool or executeTool with only empty values doesn't count.
Schema, Query, and Mutation Tools
From compatibility date 2026-11-06, a GraphQL route registers these tools, in
this order:
| Tool | What it does | Annotations |
|---|---|---|
{operationId}_schema | Returns types of the schema as SDL | Read-only, idempotent |
{operationId}_query | Runs query operations only | Read-only, idempotent |
{operationId}_mutation | Runs mutation operations only | Destructive, not idempotent |
Every tool sends a title and openWorldHint: false. The default titles are
{summary} schema, {summary} query, and {summary} mutation, where
{summary} is the operation's summary, or its operationId when it has none.
Schema, Query, and Mutation Tool Options
documentationUrl: A link to your GraphQL API reference. The default query and mutation descriptions end with it.schemaTool,queryTool,mutationTool: Configuration for each tool.enabled: Set tofalseto leave the tool out.name: Custom name for the tool.title: Custom title for the tool.description: Custom description, used as written.annotations: MCP tool annotations, merged over the defaults in the table above.
schemaTool.defaultTypeNames: The types the schema tool returns when a call doesn't passtypeNames, for example["Query"]. See Schema tool.schemaTool.defaultDepth: Thedepthused when a call doesn't passdepth:0,1, or2(default:0).
For example, a read-only server with custom tool names:
Code
If your mutations only ever add data, mark them as not destructive:
Code
Schema Tool
The schema tool returns types of the schema as SDL text, so an agent reads only the part of a large schema it needs. Called without arguments, it returns the root query type, the root mutation type, and a last line that names every other type:
Code
The agent then asks for the types it needs by name. The tool takes two optional arguments:
typeNames: The types to return, for example["Order"].depth: How many levels of referenced types to include, from0to2. Referenced types are the types of fields, arguments, input fields, interfaces, and union members.
The schema tool never returns or names the root subscription type, because no tool runs subscriptions. When you turn the mutation tool off, it leaves out the root mutation type too.
To return other types from a call without typeNames, set
schemaTool.defaultTypeNames. For example, to return only the root query
fields:
Code
An unknown type name returns a tool error that suggests close names:
Code
The schema tool sends a standard introspection query to the route, so the route must allow GraphQL introspection.
Query and Mutation Tools
Both tools take query (required), variables, and operationName, and send
them to the route as a JSON body. The route's policies run as usual. A call with
any other argument is rejected.
Each tool parses the document before it sends anything to the route, and rejects the call when:
- the operation is the other tool's type, for example a mutation sent to the query tool;
- the operation is a subscription;
- the document has a syntax error or no operation;
- the document has several operations and
operationNamedoesn't pick one; - several operations share the name in
operationName.
The error tells the agent what to change:
Code
A result is a tool error (isError: true) when the route answers with a status
outside 200-299, or when the response has a non-empty errors array, even
with partial data.
Introspection and Execute Tools
Before compatibility date 2026-11-06, a GraphQL route registers an
introspection tool, {operationId}_introspect, and an execute tool,
{operationId}_execute_query, which runs any operation the route accepts.
Introspection and Execute Tool Options
introspectionTool: Configuration for the introspection tool.name: Custom name for the introspection tool.description: Custom description for the introspection tool.annotations: MCP tool annotations, sent as configured.
executeTool: Configuration for the execute tool.name: Custom name for the execute tool.description: Custom description for the execute tool.annotations: MCP tool annotations, sent as configured.
For example:
Code
Custom GraphQL Tools
For more complex scenarios like bounded mutations or queries with complex logic,
you can create custom GraphQL tools as endpoints using the Zuplo
custom MCP tool patterns and the graphql library.
Here's a simple example of a custom bounded GraphQL query that expects an id
input from the MCP client:
Code
In your handler (modules/get-ship.ts):
Code
For more complex custom tools with validation, error handling, and multi-step workflows, see the Custom Tools documentation.
See Also
- MCP Server overview - Main MCP Server documentation
- Custom Tools - Build custom MCP tools with complex logic
- GraphQL Best Practices - GraphQL.org recommendations