Cosmo MCP Server - WunderGraph

Overview

The Cosmo MCP Server allows developers to integrate Cosmo into their modern LLM/AI supported IDEs. The implementation is running fully on the client side using STDIO. As such, the MCP Server requires no additional setup on your machine other than setting up the wgc CLI tool with an API key.

Installation

To install the MCP Server, you’ll need to create an API key and configure your IDE to use it.

1. Create a new API key

You can create an API key in Cosmo Studio.

2. Configure your IDE

Add the following configuration to your IDE’s settings. You’ll need to replace cosmo_<redacted> with your actual API key.

{
  "mcpServers": {
    "cosmo": {
      "command": "npx wgc",
      "args": ["mcp"],
      "env": {
        "COSMO_API_KEY": "cosmo_<redacted>"
      }
    }
  }
}

Useful Prompts

Here are some example prompts you can use to get started.

Setting the Context

For the whole conversation,
if not otherwise specified,
assume that we're always working in the context of the
Namespace "default"
and the Supergraph "mygraph".

Schema Exploration

Load the schema of the Supergraph and summarize the core features

Supergraph: mygraph
Namespace: default

Show me the core features of this Supergraph.

Find out which subgraphs are part of the Supergraph

Supergraph: mygraph
Namespace: default

Which subgraphs are part of this Supergraph?

Load the SDL of the Supergraph

Supergraph: mygraph
Namespace: default

Show me the schema for this Supergraph.

Explore sub-sections of the Supergraph schema

Supergraph: mygraph
Namespace: default

Show me the schema for the Employee type in this Supergraph.

Dream Query Workflow

Supergraph: mygraph
Namespace: default

Use the dream_query_workflow
to enable the following query
on this Supergraph:

query {
  employees {
    name
    department {
      name
    }
  }
}

The dream_query_workflow guides the AI model through the process of adding the necessary schema changes to your Subgraphs to enable a new use case in your Supergraph. It will find out which Subgraphs are best to modify, and it will verify that the changes are composable and backwards compatible.

Schema Change Proposal Workflow

Supergraph: mygraph
Namespace: default

Use the schema_change_proposal_workflow
to add the field "age: Int!"
to the "Employee" type
in this Supergraph.

This workflow is a sub-workflow of the dream_query_workflow. Instead of starting from a query, it starts with instructions on what specifically to change in the schema.

AI-assisted Router Configuration

Use the Router Config Reference to make changes to the Router config

Look into the cosmo_router_config_reference
and help me to configure a custom GraphQL endpoint
in my Router config: router.yaml

Use the Router Config Reference to enable WebSockets

Look into the cosmo_router_config_reference
and help me to enable WebSockets
in my Router config: router.yaml

Documentation Search

Use fulltext search on the documentation to enable specific features in the Router config

Look into the cosmo documentation
and help me to properly configure CORS
in my Router config: router.yaml

Use fulltext search on the documentation to understand the steps to publish a Subgraph

Look into the cosmo documentation
and explain to me the steps to publish a Subgraph.

All Available Tools (Reference)

The MCP server exposes several tools that an AI model can utilize:

Subgraph Management

Supergraph (Federated Graph) Management

Schema Evolution & Query Workflows

Supergraph Changelog

Router Configuration Verification

Documentation Search