---
title: "How to connect Cursor and VS Code to your MCP server | FluxOS MCP Blog"
description: "One JSON file connects Cursor and VS Code (GitHub Copilot) to a FluxOS MCP server. See the format for each editor, where to keep the key, and how to verify it."
url: "https://www.fluxosmcp.com/en/blog/how-to-connect-cursor-and-vs-code-to-your-mcp-server"
lang: "en-US"
---

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

# How to connect Cursor and VS Code to your MCP server

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

If your team codes in Cursor or VS Code, the assistant is already open all day, right next to the code. Connecting an MCP server to it takes one JSON file and one environment variable.

The two editors are similar, but not identical: the file name changes, and so does the way you write the variable. This article covers each one separately.

## Before you start: address and key

You need two things, and both are in FluxOS MCP. The dashboard is still in Portuguese, so on-screen labels appear here as they are, with the meaning in parentheses.

- **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 client portal). It looks like `https://SEU-DOMINIO/mcp/dados-publicos`, where `SEU-DOMINIO` stands for 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). Swap in your own.

FluxOS MCP speaks **Streamable HTTP** and authenticates **by key only**, sent in the `Authorization: Bearer` header. There is no OAuth. In both editors that means the same thing: you configure the header by hand.

## First: the key in an environment variable

In both cases the key stays out of the file. Set a variable on your system:

```bash
export FLUXOS_MCP_KEY="amk_SUA_CHAVE"

```

Put that line in your shell startup file (`~/.zshrc`, `~/.bashrc`) or in the system environment variables on Windows. Then **close and reopen the editor**: it only sees the variable if it already exists when the editor starts.

On Linux and macOS, an editor launched from its icon may not read your shell file. If the connection fails with a 401 even though the variable is set, launch the editor from the terminal (`cursor .` or `code .`) to test.

## Cursor

### Where the file lives

- `.cursor/mcp.json` in the project root: applies to that project.
- `~/.cursor/mcp.json` in your home folder: applies to every project, in the editor and on the command line.

### The contents

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

```

Notice the `${env:NOME}` form: that is how Cursor reads an environment variable. It resolves variables in the `command`, `args`, `env`, `url` and `headers` fields.

### Verify and use

Open **Customize** in the sidebar. The server appears in the list, with a toggle to turn it on and off. In chat, the tools are listed under `Available Tools`, and Cursor uses them when they make sense for the question.

By default, **Cursor asks for approval before using an MCP tool**. Click the arrow next to the tool name to see the arguments it is about to send.

If something fails, open the **Output** panel and choose **MCP Logs**: connection and authentication errors show up there.

### On the command line

The Cursor CLI uses the same configuration as the editor:

```bash
agent mcp list
agent mcp list-tools dados-publicos

```

The first shows the servers and the status of each one. The second shows the tools with their arguments.

## VS Code (GitHub Copilot)

There is a recent change here that is worth knowing about. VS Code currently has **two ways** to configure MCP servers, and the better-known one is on its way out.

### The current way: `mcp-config.json`

For new setups, the VS Code documentation recommends the `~/.copilot/mcp-config.json` file, in your home folder. It is shared with the Copilot CLI.

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

```

Three details:

- `"type": "http"` is Streamable HTTP.
- The variable is written `${NOME}`, **without** Cursor’s `env:`. A `$NOME` with no braces is sent as literal text.
- `"tools": ["*"]` enables every tool on the server. You can also list just a few by name.

Through the UI, the path is the **Chat: Open Customizations** command, then **MCP Servers** and **Add Server**.

### The old way: `.vscode/mcp.json`

If you already use MCP in VS Code, you probably have a `.vscode/mcp.json` file with a `servers` key. It still works, but the documentation marks it as deprecated, with removal planned for February 2027.

This format had one advantage: the `inputs` field, which made VS Code prompt for the key the first time and store it securely, with no environment variable.

```json
{
  "inputs": [
    {
      "type": "promptString",
      "id": "fluxos-key",
      "description": "FluxOS MCP key",
      "password": true
    }
  ],
  "servers": {
    "dados-publicos": {
      "type": "http",
      "url": "https://SEU-DOMINIO/mcp/dados-publicos",
      "headers": {
        "Authorization": "Bearer ${input:fluxos-key}"
      }
    }
  }
}

```

The current way **does not support** `inputs`. For an access key, the recommended path is the environment variable. If you are starting now, use the current way.

### Verify and use

The **MCP: List Servers** command shows the servers and the status of each one. In chat, in agent mode, ask something that depends on the tool and **open the call** that appears in the conversation: a convincing answer with no tool call does not prove the connection worked.

VS Code also asks for your approval before running a tool.

### If MCP is turned off

On company accounts, the administrator can disable MCP servers or allow only a specific list (the setting is `chat.mcp.access`). If the option to add a server does not appear, talk to whoever administers Copilot in your organization.

## For the team: what goes into Git

Cursor’s project file (`.cursor/mcp.json`) can go into the repository, **as long as the key is not in it**. With the environment variable, the file carries only the address, and each person sets `FLUXOS_MCP_KEY` with their own key.

That has two good effects: each person’s usage shows up separately in FluxOS MCP, and revoking one person’s access does not affect anyone else.

## When it does not connect

The server responds with a code that tells you why:

- **401:** the key is missing, wrong, revoked or expired. The most common case in these editors is that the variable was not set when the editor opened.
- **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.

If the editor opens a login screen or mentions OAuth, it is the same 401 in disguise: without a valid header, it tries the other authentication path, which FluxOS MCP does not use. Fix the key and restart the editor.

If the tool does not appear, check that the server is **published** and that the tool is among the ones enabled for that key.

## Best practices

- **One key per person.** The key in your editor should not be the same one a production system uses.
- **Few tools turned on.** The more tools the assistant sees, the worse it chooses. Turn off the servers you do not use in that project.
- **Read the arguments before approving.** That is what the approval screen is for, especially with tools that change data.

## Next steps

The same server also works [in Claude Code](https://www.fluxosmcp.com/en/blog/how-to-connect-claude-code-to-your-mcp-server), [in Codex and the OpenAI API](https://www.fluxosmcp.com/en/blog/how-to-connect-chatgpt-and-codex-to-your-mcp-server) and [in Gemini](https://www.fluxosmcp.com/en/blog/how-to-connect-gemini-to-your-mcp-server).
