Technical guide for using WunderGraph’s MCP Gateway to connect GraphQL APIs to AI models. Covers setup, configuration, and usage examples.
.graphql
files with operations tailored specifically for AI consumption. These function as persisted operations (trusted documents), giving you complete control over what queries AI models can execute.expose_schema
is enabled.enable_arbitrary_operations
is enabled, allowing AI models to craft and execute custom operations beyond predefined ones.execute_operation_<operation_name>
(e.g., execute_operation_get_users
).execute_operation_<operation_name>
(with operation names converted to snake_case)exclude_mutations: true
configuration option to prevent mutation operations from being exposed if you want to ensure AI models can only read data.
config.yaml
:
Option | Description | Default |
---|---|---|
enabled | Enable or disable the MCP server | false |
server.listen_addr | The address and port where the MCP server will listen for requests | localhost:5025 |
server.base_url | Custom URL to use for the router GraphQL endpoint in MCP. Use this when your router is behind a proxy. Purely metadata for AI model. | - |
router_url | Custom URL to use for the router GraphQL endpoint in MCP. Use this when your router is behind a proxy. | http://{listen_addr}{graphql_path} |
storage.provider_id | The ID of a storage provider to use for loading GraphQL operations. Only file_system providers are supported. | - |
graph_name | The name of the graph to be used by the MCP server | mygraph |
exclude_mutations | Whether to exclude mutation operations from being exposed | false |
enable_arbitrary_operations | Whether to allow arbitrary GraphQL operations to be executed. Security risk: Should only be enabled in secure, internal environments. | false |
expose_schema | Whether to expose the full GraphQL schema. Security risk: Should only be enabled in secure, internal environments. | false |
storage.provider_id
configuration..graphql
files containing named GraphQL operations.operations/getUsers.graphql
:
operations/createUser.graphql
:
storage_providers.file_system.path
should point to the operations directory.graphql
files in this directory (and subdirectories) will be loadedGetUsers
→ Tool name: execute_operation_get_users
CreateUser
→ Tool name: execute_operation_create_user
mcp-remote
command.
env
key.settings.json
: