MCP Gateway | Secure AI Access to GraphQL | WunderGraph Cosmo - WunderGraph

Give AI models secure, controlled access to your GraphQL API

The Cosmo Router exposes predefined GraphQL operations as MCP tools. AI models discover, read descriptions, and execute through the standardized protocol.

Works with Claude, Cursor, Windsurf, VS Code Copilot, and any MCP-compatible platform.

The problem

AI access to APIs needs guardrails

Exposing your GraphQL schema directly to AI gives them the keys to everything. Building custom integrations per platform multiplies maintenance work.

AI models can execute arbitrary queries against your schema

Without a control layer, AI systems can access any data your schema exposes, including sensitive fields your integration was not designed to reach.

Each AI platform needs its own integration code

Custom REST APIs, platform-specific adapters, and separate documentation for each AI tool create compounding maintenance overhead as more platforms emerge.

Compliance teams cannot audit AI data access

Without operation-level control, there is no definitive list of what data AI systems can request. Compliance sign-off requires that list.

Our solution

Predefined operations as MCP tools

The Cosmo Router implements an MCP server. It loads GraphQL operation files from a directory, validates them against your schema, and exposes them as tools AI models can discover and execute.

How MCP Gateway works

  1. Write GraphQL operation files. Add docstring descriptions using the September 2025 GraphQL spec. The description becomes the tool description AI models see.
  2. Enable MCP in the Router config. Point to the operations directory. Optionally exclude mutations for read-only access.
  3. AI tools connect to the MCP endpoint. They discover available operations as tools with their descriptions and JSON schema inputs.
  4. AI models call operations with appropriate parameters. The Router validates, executes against your schema, and returns structured data.
  5. Most client headers forward to the GraphQL execution layer. Use standard header authentication or the built-in OAuth 2.1 support.

Before & After

Before Cosmo With Cosmo
Custom integration code for each AI platform Single MCP endpoint works with all MCP-compatible AI tools
Risk of AI executing arbitrary, harmful queries Only predefined, validated operations are exposed by default
External documentation required for AI to understand APIs Self-documenting operations with embedded descriptions
Separate AI-safe APIs built alongside real APIs Same GraphQL API with controlled operation exposure

Built-in tools

Capabilities

What MCP Gateway provides

FAQ

MCP Gateway questions

  1. Which AI tools work with MCP Gateway?
  2. Can AI models execute arbitrary GraphQL queries?
  3. How do I make operations understandable to AI models?
  4. Can I prevent AI from running mutations?
  5. What MCP specification does Cosmo support?
  6. How do I handle authentication?

Deep dive in the MCP Gateway documentation.