Skip to main content
This tutorial takes about 10 minutes. At the end you have a GraphQL operation that you wrote as a sentence, and the data it returns from your own graph.

Prerequisites

  • A running Cosmo Router with a composed schema. See Router Introduction.
  • The base URL of a schema discovery service.
  • A bearer token for that service, if it needs one.
  • An MCP client, such as Claude Code, Claude Desktop, or Cursor.

Step 1 - Turn on schema discovery

Add this block to your router config file.
router.config.yaml
Leave token empty if your service runs with authentication off.
The router does not start when schema_discovery.enabled is true and url is empty. This is deliberate. It stops a server whose tools always fail.

Step 2 - Start the router

Read the log. You must see two lines.
Then, within about a minute:
The index now serves requests. A schema of 16,000 lines takes about 24 seconds. The router does not wait for the index. It serves GraphQL from the first moment.
The index_id is the SHA-256 hash of your schema. Compute it yourself at any time:

Step 3 - Connect an MCP client

Point your client at the MCP endpoint.
List the tools. You must see three new names:
  • search_schema
  • get_symbols
  • generate_query

Step 4 - Find out what the API does

Ask the client to search your schema. Use your own words, not field names.
You get ranked coordinates and their records.
Keep limit low. The records are large.

Step 5 - Generate an operation

Now ask for the data that you want. Do not write GraphQL.
This call takes 10 to 30 seconds. Wait for it.
The document is valid against your schema. The service checked it before it answered.

Step 6 - Run the operation

Send the document to your router.
You now have data.
The tutorial is complete.

Step 7 - Ask for something that does not exist

Send a prompt that your schema cannot answer.
You get no queries and one reason.
This result is correct. It is not an error. It tells you that the capability does not exist, so you build it instead of searching for it.

Next steps

Guides

Find duplicate work, or turn an operation into a tool.

Tools

Every input and every response field.