---
title: "Tutorial: turn a public GraphQL API into an AI tool | FluxOS MCP Blog"
description: "Point FluxOS MCP at a public GraphQL endpoint and watch each query in the schema become a tool your AI assistant uses, without writing a single query."
url: "https://www.fluxosmcp.com/en/blog/tutorial-turn-a-public-graphql-api-into-an-ai-tool"
lang: "en-US"
---

[Blog](https://www.fluxosmcp.com/en/blog) · Nov 25, 2026 · FluxOS MCP Team

# Tutorial: turn a public GraphQL API into an AI tool

[Leia este artigo em português](https://www.fluxosmcp.com/blog/tutorial-uma-api-graphql-publica-como-ferramenta-de-ia)

GraphQL APIs have a rare quality: they **describe themselves**. You ask the server which queries it offers and it answers. This is called introspection, and it is what lets you create MCP tools without writing a single query.

In this tutorial we use the [Countries API](https://countries.trevorblades.com/), a public GraphQL endpoint with no authentication and data about countries, languages and continents. The data is simple on purpose: what matters is the path, which is the same for your company’s GraphQL API.

## Step 1: create the system

In **Sistemas → Novo sistema** (Systems → New system):

- **Nome** (Name): Countries (GraphQL)
- **Tipo de origem** (Source type): GraphQL
- **URL base** (Base URL): `https://countries.trevorblades.com/`
- **Credencial da empresa** (Company credential): Nenhuma (None)

Click **Criar e importar** (Create and import).

## Step 2: let the server read the schema

In the **Endpoint GraphQL** (GraphQL endpoint) field, enter the same URL and click **Ler origem** (Read source). FluxOS MCP runs the introspection query and lists what it found.

For this API, that is six queries: `continent`, `continents`, `countries`, `country`, `language` and `languages`.

## Step 3: choose two, not six

The temptation is to check everything. Resist it. For a first test, two are enough:

- **`country`**: takes a country’s code (`code`) and returns its data.
- **`countries`**: lists countries, with an optional filter by code, continent or currency.

Uncheck the other four. Every extra tool is one more option for the assistant to get wrong.

Now the adjustments:

**Descriptions.** This API’s schema has no explanatory text, so the tools arrive with “Query GraphQL country.” Rewrite them:

- `country`: “Returns the capital, currency, languages, continent and calling code of a country. Provide the two-letter code in `code`, for example BR, PT or JP.”
- `countries`: “Lists countries. Use the filter to narrow by continent or currency.”

**Global.** The screen will offer `code` as the client filter. It isn’t one: mark both as **Global**.

Create the “Geography” server, with the address `geografia`.

## What happened behind the scenes

You didn’t write any query, but one exists. For the `country` tool, FluxOS MCP built something like this:

```graphql
query country($code: ID!) {
  country(code: $code) {
    name
    capital
    currency
    phone
    continent { code name }
    languages { code name native }
  }
}

```

Two details that hold for any GraphQL API:

- **Arguments go in as variables**, never pasted into the query text. The assistant has no way to inject a piece of a query.
- **Field selection is automatic**: simple fields and nested objects up to two levels deep. If you need something deeper, or fewer fields, you adjust the workflow on the canvas.

## Publish and hand over a key

From here on, the path is the same as for any server:

1. In **Servidores MCP** (MCP servers), open the server and click **Publicar** (Publish).
2. In **Clientes → Novo cliente** (Clients → New client), create a test client (it can be “Internal test”).
3. On the client’s **Acesso e portal** (Access and portal) tab, use **Liberar servidor** (Grant server access) and set a low cap, for example 10 calls per minute.
4. On the **Chaves** (Keys) tab, create a **Nova chave** (New key). It is shown only once: copy it right away.

The server’s **Conexão** (Connection) tab shows the MCP address and a sample configuration. The key goes in the `Authorization: Bearer` header. Make sure your assistant lets you set that header: FluxOS MCP authenticates by key and does not use OAuth.

## Test

- “What are the capital and currency of Japan?”
- “Which South American countries don’t have Spanish as a language?”
- “List the countries that use the euro.”

The second question forces the assistant to list the continent’s countries and look at the languages of each one. It’s worth opening the execution in **Execuções** (Executions) to see which calls it made.

## On your company’s API

The script changes in three places:

- **Credential.** The real endpoint probably requires a token. It goes in the system’s credential, not in the tool.
- **Client filter.** If the queries have an argument such as `customerId`, that is what you choose as the filter, instead of marking the tool Global. The argument disappears from what the AI sees and is filled in from the access key.
- **Mutations.** Operations that change data arrive unchecked and flagged as destructive. Leave them that way until you are sure.

If the server refuses introspection, which is common in production, you can paste the introspection result instead of entering the URL.

## Next tutorial

From the most modern to the oldest: [how to connect a Banco Central SOAP service to your assistant](https://www.fluxosmcp.com/en/blog/tutorial-soap-isnt-dead-connect-brazils-central-bank-to-your-ai-assistant), without touching the service.
