> ## Documentation Index
> Fetch the complete documentation index at: https://docs.floprouter.com/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP server

> Add floprouter's tools to Claude Code, Claude Desktop, Cursor, VS Code, Windsurf, Codex CLI, Cline, Zed, Gemini CLI, Continue or any MCP client.

`floprouter-mcp` gives an AI agent the floprouter API as tools: it can list models and miners, send paid chat requests to GPU miners on FLOP Network, and check generations, sessions, balance and grant state. It runs on your machine over stdio and is on npm, so every client starts it the same way:

```bash theme={null}
npx -y floprouter-mcp
```

You need Node 18.17 or later and an API key (`fr_...`). Create the key with your wallet on the [account page](https://floprouter.com/account/), or run `npx floprouter login`. Without a key, the read-only tools still work.

The commands below read the key from your shell. Run `export FLOPROUTER_API_KEY=fr_...` first, or put the key in place of `$FLOPROUTER_API_KEY`.

## Add it to your client

Choose your client

**Add it** for all your projects (`--scope user`). The key is saved in `~/.claude.json` on your machine.

```bash theme={null}
claude mcp add floprouter --scope user -e FLOPROUTER_API_KEY="$FLOPROUTER_API_KEY" -- npx -y floprouter-mcp
```

Keep the server name before `-e`: the `-e` flag takes every `KEY=value` that follows it, and everything after `--` goes to the server.

**For one repository**, shared through git, put this in `.mcp.json` at the project root. Claude Code fills `${FLOPROUTER_API_KEY}` from each person's environment, so no key is committed. It asks once before it loads a project server.

```json .mcp.json theme={null}
{
  "mcpServers": {
    "floprouter": {
      "command": "npx",
      "args": ["-y", "floprouter-mcp"],
      "env": { "FLOPROUTER_API_KEY": "${FLOPROUTER_API_KEY}" }
    }
  }
}
```

**Check it loaded:** `claude mcp list` shows `floprouter` as connected. In a session, `/mcp` lists its 9 tools.

**Remove it:**

```bash theme={null}
claude mcp remove floprouter --scope user
```

**Add it** to the config file. In the app, Settings, Developer, Edit Config opens it.

| System | File |
| - | - |
| macOS | `~/Library/Application Support/Claude/claude_desktop_config.json` |
| Windows | `%APPDATA%\Claude\claude_desktop_config.json` |
| Linux | `~/.config/Claude/claude_desktop_config.json` |

Add the `floprouter` entry inside `mcpServers`. Keep any servers already there.

```json claude_desktop_config.json theme={null}
{
  "mcpServers": {
    "floprouter": {
      "command": "npx",
      "args": ["-y", "floprouter-mcp"],
      "env": { "FLOPROUTER_API_KEY": "fr_..." }
    }
  }
}
```

Quit Claude Desktop completely and open it again. Closing the window is not enough.

**Check it loaded:** the local MCP servers list in Settings shows `floprouter` as running, and its tools appear in a chat's tools menu. If it does not start, the log is `mcp-server-floprouter.log` in `~/Library/Logs/Claude/` (macOS) or `%APPDATA%\Claude\logs` (Windows).

**Remove it:** delete the `floprouter` entry from the file and restart the app.

**Add it** with one click. Run `npx floprouter login` first: the server reads the key from the file it writes, so the link carries no key.

[![](https://docs.floprouter.com/images/clients/cursor-light.svg)
![](https://docs.floprouter.com/images/clients/cursor-dark.svg)
Add to Cursor](cursor://anysphere.cursor-deeplink/mcp/install?name=floprouter\&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsImZsb3Byb3V0ZXItbWNwIl19)

**Or by hand:** `~/.cursor/mcp.json` for all projects, or `.cursor/mcp.json` in one project. The path is the same on macOS, Windows and Linux (`~` is your home folder).

```json ~/.cursor/mcp.json theme={null}
{
  "mcpServers": {
    "floprouter": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "floprouter-mcp"],
      "env": { "FLOPROUTER_API_KEY": "fr_..." }
    }
  }
}
```

Cursor also reads `"${env:FLOPROUTER_API_KEY}"` from its environment. An app started from the dock or Start menu often does not see variables from your shell profile, so the login file or a literal key is the reliable choice.

**Check it loaded:** Cursor Settings, MCP (Customize, MCPs in recent versions) lists `floprouter` with its tools. The Output panel, MCP Logs, shows why a server did not start.

**Remove it:** delete it in the same MCP settings, or remove the entry from `mcp.json`.

**Add it** with one click. Run `npx floprouter login` first, so the link needs no key. VS Code shows the server's details before it installs anything.

[Install in VS Code](https://vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522floprouter%2522%252C%2522type%2522%253A%2522stdio%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522-y%2522%252C%2522floprouter-mcp%2522%255D%257D)

**Or by hand,** for GitHub Copilot in VS Code: `~/.copilot/mcp-config.json` for all workspaces, or `.mcp.json` at a workspace root. The `${FLOPROUTER_API_KEY}` reference reads the key from the environment VS Code runs in, so the file holds no key.

```json ~/.copilot/mcp-config.json theme={null}
{
  "mcpServers": {
    "floprouter": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "floprouter-mcp"],
      "env": { "FLOPROUTER_API_KEY": "${FLOPROUTER_API_KEY}" }
    }
  }
}
```

Older VS Code releases use `.vscode/mcp.json` with a `servers` object instead of `mcpServers`. VS Code marks that format as deprecated.

**Check it loaded:** run `MCP: List Servers` from the Command Palette, pick `floprouter` and choose Show Output. In Copilot Chat agent mode, the tools picker lists its tools.

**Remove it:** `MCP: List Servers`, `floprouter`, Uninstall. Or delete the entry from the file.

Windsurf is now called Devin Desktop. The steps are the same for both names.

**Add it** with the Devin CLI, for all projects (`-s user`):

```bash theme={null}
devin mcp add -s user -e FLOPROUTER_API_KEY="$FLOPROUTER_API_KEY" floprouter -- npx -y floprouter-mcp
```

**Or by hand,** in the user config file:

| System | File |
| - | - |
| macOS, Linux | `~/.config/devin/mcp_config.json` |
| Windows | `%APPDATA%\devin\mcp_config.json` |
| Windsurf before the rename | `~/.codeium/windsurf/mcp_config.json` |

```json mcp_config.json theme={null}
{
  "mcpServers": {
    "floprouter": {
      "command": "npx",
      "args": ["-y", "floprouter-mcp"],
      "env": { "FLOPROUTER_API_KEY": "fr_..." }
    }
  }
}
```

For one project, use `.devin/mcp_config.local.json`: it is kept out of git, so the key stays on your machine.

**Check it loaded:** `devin mcp list`, or Customize, MCPs in the app.

**Remove it:**

```bash theme={null}
devin mcp remove -s user floprouter
```

**Add it:**

```bash theme={null}
codex mcp add floprouter --env FLOPROUTER_API_KEY="$FLOPROUTER_API_KEY" -- npx -y floprouter-mcp
```

This writes to `~/.codex/config.toml` (Windows: `%USERPROFILE%\.codex\config.toml`). The CLI, the IDE extension and the desktop app share that file.

**Then raise the startup timeout.** Codex waits 10 s for a server to start by default, and the first `npx` run downloads the package. Add `startup_timeout_sec` to the entry:

```toml ~/.codex/config.toml theme={null}
[mcp_servers.floprouter]
command = "npx"
args = ["-y", "floprouter-mcp"]
startup_timeout_sec = 60

[mcp_servers.floprouter.env]
FLOPROUTER_API_KEY = "fr_..."
```

To keep the key out of the file, replace the `env` table with `env_vars = ["FLOPROUTER_API_KEY"]`. Codex then passes the variable from the shell you start it in.

**Check it loaded:** `codex mcp list` shows `floprouter` as enabled. In a session, `/mcp` lists its tools.

**Remove it:**

```bash theme={null}
codex mcp remove floprouter
```

**Add it** in Cline: Customize, MCP, Edit Configuration (older versions: the MCP Servers icon, Configure MCP Servers). This opens `cline_mcp_settings.json`, which the VS Code extension and the Cline CLI share:

| System | File |
| - | - |
| macOS, Linux | `~/.cline/data/settings/cline_mcp_settings.json` |
| Windows | `%USERPROFILE%\.cline\data\settings\cline_mcp_settings.json` |

```json cline_mcp_settings.json theme={null}
{
  "mcpServers": {
    "floprouter": {
      "command": "npx",
      "args": ["-y", "floprouter-mcp"],
      "env": { "FLOPROUTER_API_KEY": "fr_..." },
      "disabled": false,
      "timeout": 120
    }
  }
}
```

`timeout` is in seconds. Cline's default is 60.

**With the Cline CLI,** `cline mcp add floprouter -- npx -y floprouter-mcp` starts a short wizard. Enter `FLOPROUTER_API_KEY=fr_...` when it asks for environment variables.

**Check it loaded:** the Installed list in Cline's MCP view shows `floprouter` with its tools.

**Remove it:** the trash icon on the server's row, `cline mcp remove floprouter`, or delete the entry from the file.

**Add it** in Zed: Settings, AI, MCP Servers, Add Server, Add Local Server. Or edit `settings.json` yourself:

| System | File |
| - | - |
| macOS, Linux | `~/.config/zed/settings.json` |
| Windows | `%APPDATA%\Zed\settings.json` |

```json settings.json theme={null}
{
  "context_servers": {
    "floprouter": {
      "command": "npx",
      "args": ["-y", "floprouter-mcp"],
      "env": { "FLOPROUTER_API_KEY": "fr_..." }
    }
  }
}
```

Zed calls MCP servers `context_servers`. It gives a tool call 60 s by default, which covers `chat`.

**Check it loaded:** on the MCP Servers page, the dot next to `floprouter` turns green and its tooltip reads "Server is active".

**Remove it:** the Uninstall (trash) button on its row, or delete the entry from `settings.json`.

**Add it** for all projects (`-s user`):

```bash theme={null}
gemini mcp add -s user -e FLOPROUTER_API_KEY="$FLOPROUTER_API_KEY" floprouter npx -- -y floprouter-mcp
```

Pass the key with `-e`. Gemini CLI removes environment variables whose names contain `KEY` before it starts a server, so a variable exported in your shell does not reach it otherwise.

This writes to `~/.gemini/settings.json` (a project's own is `.gemini/settings.json`):

```json ~/.gemini/settings.json theme={null}
{
  "mcpServers": {
    "floprouter": {
      "command": "npx",
      "args": ["-y", "floprouter-mcp"],
      "env": { "FLOPROUTER_API_KEY": "fr_..." }
    }
  }
}
```

In the file, `"$FLOPROUTER_API_KEY"` is also accepted: Gemini CLI fills it from its environment.

**Check it loaded:** `gemini mcp list` shows `floprouter` as connected. In a session, `/mcp` lists its tools. A server in an untrusted folder is not started; run `gemini trust` in that folder.

**Remove it:**

```bash theme={null}
gemini mcp remove -s user floprouter
```

Continue was acquired by Cursor. These steps are for the open-source extension, which stays available.

**Add it** as a block file in your project, `.continue/mcpServers/floprouter.yaml` (or in `~/.continue/mcpServers/` for all projects):

```yaml .continue/mcpServers/floprouter.yaml theme={null}
name: floprouter
version: 0.0.1
schema: v1
mcpServers:
  - name: floprouter
    type: stdio
    command: npx
    args:
      - "-y"
      - "floprouter-mcp"
    env:
      FLOPROUTER_API_KEY: ${{ secrets.FLOPROUTER_API_KEY }}
```

The extension cannot read your shell's environment. Put the key in `~/.continue/.env` (or a `.env` at the workspace root) as `FLOPROUTER_API_KEY=fr_...`. Keep that file out of git.

**Check it loaded:** MCP tools work in Agent mode. The tools menu in the chat input lists the `floprouter` tools.

**Remove it:** delete the block file. Continue reloads its config by itself.

Most MCP clients take the same JSON: an `mcpServers` object with a command, its arguments and its environment. Add this entry to your client's MCP config:

```json theme={null}
{
  "mcpServers": {
    "floprouter": {
      "command": "npx",
      "args": ["-y", "floprouter-mcp"],
      "env": { "FLOPROUTER_API_KEY": "fr_..." }
    }
  }
}
```

If the client asks for fields instead: transport `stdio`, command `npx`, arguments `-y floprouter-mcp`, environment variable `FLOPROUTER_API_KEY`.

If it speaks streamable HTTP, see [Local HTTP transport](#local-http-transport) below.

**Check it loaded:** the client should list 9 tools from `floprouter`, starting with `list_models`. Ask it to call `router_status`; that call is free.

**Remove it:** delete the entry and restart the client.

## Tools

| Tool | What it does | Moves FLOP |
| - | - | - |
| `list_models` | Models in the on-chain registry, with ready and reachable miners, the escrow per 1,000 tokens, the least charge per request and the largest request served. `only_available` filters. | no |
| `list_miners` | Miners with score, rank, settle rate, sessions, strikes, calibration and reachability. Filters: `reachable`, `ready`, `model`, `min_score`, `sort`, `limit`, `offset`. | no |
| `get_miner` | One miner in detail: history, stake, calibration, slashing, models, endpoints and recent channels. | no |
| `chat` | One paid chat request. Takes `prompt` or `messages`, `model`, and optional `fallback_models`, `miner` (pin one or a list), `allow_fallbacks`, `max_tokens`, `payer`, `fallback_payer`, `wait_for_settlement`. Returns the reply, the `generation_id`, the cost in FLOP and the session. | spends FLOP |
| `generation` | One request by its id: tokens, cost in FLOP (final once settled), finish reason, latency and the verified reply. | no |
| `session_status` | Settlement state of a session: status, channel, miner, escrow, amount paid to the miner, explorer links. | no |
| `account` | Your prepaid balance and deposit address, this key's usage and limits, and the state of your grant. | no |
| `withdraw` | Sends prepaid FLOP back to the wallet that owns the key. That wallet is the one destination the API allows. | to your own wallet |
| `router_status` | Network, sync state, miner and endpoint counts, and which payer modes the router offers. | no |

The server describes these tools to the agent and tells it that each `chat` call spends FLOP, so it should not loop on it. Many clients also ask you before a tool runs.

## Your key

The server reads the key from `FLOPROUTER_API_KEY`. If that is not set, it reads the file `npx floprouter login` writes (`~/.config/floprouter/config.json`), so one login serves the CLI and the MCP server. With neither, the read-only tools work and `account` says that no key is set.

The server never sees a wallet key or seed. Creating an API key, signing a grant, depositing and withdrawing to the chain happen in your wallet on the [account page](https://floprouter.com/account/), or with the [CLI](https://docs.floprouter.com/cli.md) on your machine. A key in a client's config file stays on your machine; do not commit it.

## Who pays

Each key has a payer mode. In `grant` mode (the default) your wallet is the payer on chain, through a grant you sign once. In `credit` mode the router's wallet opens the channel and takes the cost from your prepaid balance. `chat` can override the mode per request with `payer`. See [payer modes and grants](https://docs.floprouter.com/payer-modes.md).

## Timing

A verified reply usually takes 15 to 50 s on devnet. `chat` waits up to 50 s, below the 60 s at which many clients stop a tool call. If the reply is not verified by then, `chat` returns `pending: true` with a `generation_id`; the request carries on, and `generation` returns it a minute later. Settlement on chain follows 2 to 4 minutes after the reply: check it with `session_status`.

| Variable | Default | What it sets |
| - | - | - |
| `FLOPROUTER_TOOL_BUDGET_MS` | `50000` | How long `chat` waits before it returns the id |
| `FLOPROUTER_TIMEOUT_MS` | `300000` | Per-request timeout of the other tools |
| `FLOPROUTER_SETTLE_WAIT_MS` | `300000` | How long `chat` polls when `wait_for_settlement` is true |
| `FLOPROUTER_BASE_URL` | `https://api.floprouter.com` | The router the server talks to |

## Local HTTP transport

The package also serves streamable HTTP, for clients that connect to a URL instead of starting a process:

```bash theme={null}
npx -y floprouter-mcp --http          # http://127.0.0.1:8792/mcp
npx -y floprouter-mcp --http --port 9000 --host 127.0.0.1
```

Each request may carry its own key as `Authorization: Bearer fr_...`; otherwise the server uses its configured key. It listens on `127.0.0.1` by default. Bind it to another address only if everyone who can reach it may use that key. There is no hosted floprouter MCP server: the server runs on your machine.

## Troubleshooting

> [accordion] The server does not start
>
> Run `node --version`: the server needs 18.17 or later. A client started from the dock or Start menu may find a different `node` than your terminal; put the full path to `npx` in `command` (for example `/usr/local/bin/npx`, or the output of `which npx`). Run `npx -y floprouter-mcp --version` in a terminal: it prints `0.1.0` when the package installs and runs.

> [accordion] An old version keeps running
>
> `npx` caches packages. Run `npx -y floprouter-mcp@latest --version` once to fetch the newest release, or pin a version in `args`, for example `"floprouter-mcp@0.1.0"`.

> [accordion] The key is not set
>
> `account` returns `no API key configured` and `chat` fails with 401. Check the `env` block in your client's config, or run `npx floprouter login`. Restart the client after a change. In Gemini CLI, pass the key with `-e`; in Continue, put it in a `.env` file.

> [accordion] 401 unauthorized
>
> The key is missing, mistyped or revoked. Create a new one on the [account page](https://floprouter.com/account/) or with `npx floprouter login`, and replace it in the config.

> [accordion] 402 insufficient balance or grant
>
> `insufficient_balance`: your prepaid balance does not cover the escrow and fee. Deposit FLOP (`npx floprouter deposit 1`) or lower `max_tokens`. `grant_required`, `grant_expired` and similar: in grant mode your grant cannot pay. Sign one with `npx floprouter grant` or on the account page, or pass `payer: "credit"`. `insufficient_funds`: your wallet cannot cover the escrow.

> [accordion] 503 no miner ready
>
> `no_miner_available`: no ready miner serves that model right now. Call `list_models` with `only_available: true` and pick one, or give `fallback_models`. `all_attempts_failed`: every miner tried failed before any output; wait for the retry time in the message and try again. If an attempt locked escrow, it comes back to the payer when that channel closes; `session_status` shows it.

> [accordion] chat returns pending
>
> The reply took longer than 50 s. Call `generation` with the `generation_id` a minute later. Raising `FLOPROUTER_TOOL_BUDGET_MS` helps only if your client allows tool calls longer than 60 s.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.