---
title: "How to connect Claude Code to your MCP server | FluxOS MCP Blog"
description: "One terminal command connects Claude Code to an MCP server published on FluxOS MCP. Learn how to add it, verify it, share it with your team, and fix errors."
url: "https://www.fluxosmcp.com/en/blog/how-to-connect-claude-code-to-your-mcp-server"
lang: "en-US"
---

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

# How to connect Claude Code to your MCP server

[Leia este artigo em português](https://www.fluxosmcp.com/blog/como-ligar-o-claude-code-ao-seu-servidor-mcp)

Claude Code is the shortest path between an MCP server and an assistant that actually uses it: one command in the terminal, and the tools you published are available in every conversation.

It is also the assistant where connecting with a key is best documented. If you want to see your server working today, start here.

## Before you start: address and key

You need two things, and both are in FluxOS MCP:

- **The server address.** On the **Conexão** (Connection) tab of the published server (or, for the client, on the **Ferramentas e conexão** (Tools and connection) page of the portal). It looks like `https://SEU-DOMINIO/mcp/dados-publicos`, where `SEU-DOMINIO` is your domain.
- **An access key.** Created on the client’s **Chaves** (Keys) tab. It starts with `amk_` and is shown only once.

In the examples, the server is `dados-publicos` from the [OpenAPI tutorial](https://www.fluxosmcp.com/en/blog/tutorial-postal-codes-holidays-and-rates-in-your-ai-assistant-with-openapi), with tools for CEP (Brazilian postal code) lookups, holidays, and rates. Swap in your own.

FluxOS MCP speaks **Streamable HTTP** and authenticates **by key only**, sent in the `Authorization: Bearer` header. There is no OAuth. That determines which assistants can connect, as you will see.

## Step 1: add the server

In the terminal:

```bash
claude mcp add --transport http dados-publicos https://SEU-DOMINIO/mcp/dados-publicos \
  --header "Authorization: Bearer amk_SUA_CHAVE"

```

Three details:

- `--transport http` is Streamable HTTP, the transport FluxOS MCP uses.
- Options come **before** the name and the address.
- The command **does not test the key**. A wrong key only shows up as an error in the next step.

## Step 2: verify

```bash
claude mcp list

```

The server should show up as connected. If it shows a failure, `claude mcp get dados-publicos` tells you why.

Inside a Claude Code session, the `/mcp` command lists the servers and how many tools each one brought. For `dados-publicos`, you should see the three from the tutorial plus two that every FluxOS MCP server includes: `consultar_uso` and `consultar_execucao`.

## Step 3: use it

Just ask:

- “What’s the address for CEP 01001-000?”
- “What’s the Selic rate right now?” (Selic is Brazil’s benchmark interest rate.)
- “How much of my call limit have I used today?”

The last one uses `consultar_uso`: the assistant itself can see the key’s usage.

The first time a tool is used, Claude Code asks for your permission.

## Where the configuration lives: three scopes

By default the server applies only to you, in the current project. The `--scope` parameter changes that:

- `local` (default): only you, in this project.
- `user`: you, in every project.
- `project`: the whole team, through a `.mcp.json` file at the root of the repository.

## For the team: `.mcp.json` without the key in it

The `project` scope writes a file that goes into Git. **The key must not go with it.** Use an environment variable:

```json
{
  "mcpServers": {
    "dados-publicos": {
      "type": "http",
      "url": "https://SEU-DOMINIO/mcp/dados-publicos",
      "headers": {
        "Authorization": "Bearer ${FLUXOS_MCP_KEY}"
      }
    }
  }
}

```

Each person sets `FLUXOS_MCP_KEY` on their own machine, with their own key. That way each person’s usage shows up separately in FluxOS MCP, and revoking one person’s access does not affect the others.

Two things to watch with the variable:

- **If it is not set, the file loads anyway** and the text `${FLUXOS_MCP_KEY}` is sent as if it were the key. The server responds with 401.
- **Give the variable a name of your own.** Names of well-known credentials, such as `ANTHROPIC_API_KEY`, are deliberately blanked out in headers sent to remote servers.

## When it won’t connect

The server responds with a code that tells you why:

- **401:** the key is missing, wrong, revoked, or expired. Check that you copied the whole key.
- **402:** the client’s subscription is awaiting payment.
- **403:** the client’s subscription is suspended or canceled.
- **429:** the key went over its per-minute or per-day limit. The message says how many seconds to wait before trying again.

If a tool does not show up, check that the server is **published** and that the tool is among those allowed for that key.

Claude Code has one more case: the server shows up in `claude mcp list` with an **authentication required** warning. FluxOS MCP does not use OAuth, so this means the `Authorization` header was not sent or was rejected. Remove the server (`claude mcp remove dados-publicos`) and add it again with `--header`.

## Best practices

- **One key per person and per use.** The key in your terminal should not be the same one a production system uses.
- **Start with a low limit.** You can raise it later without changing the key.
- **Rotation with a grace period.** In the portal, the manager rotates the key and the old one keeps working for a set period, which gives you time to update the environment variable.

## Next steps

The same server also works [in the Claude app and the API](https://www.fluxosmcp.com/en/blog/how-to-use-your-mcp-server-with-claude-app-and-api), [in Grok](https://www.fluxosmcp.com/en/blog/how-to-connect-grok-to-your-mcp-server), and [in Codex and the OpenAI API](https://www.fluxosmcp.com/en/blog/how-to-connect-chatgpt-and-codex-to-your-mcp-server).
