# FlagQuantum MCP server

> Build, compile, simulate, and export quantum circuits locally using the FlagQuantum SDK.

- Repository: https://github.com/FlagQuantum/mcp-servers
- Page: https://hostedmcp.org/servers/flagquantum/flagquantum-mcp-server
- Transport: stdio
- Stars: 1
- License: Apache-2.0
- Latest version: 0.3.2

## Install

### Claude Code

```sh
claude mcp add flagquantum-mcp-server -- uvx flagquantum-mcp-server
```

### Cursor (`~/.cursor/mcp.json`)

```json
{
  "mcpServers": {
    "flagquantum-mcp-server": {
      "command": "uvx",
      "args": [
        "flagquantum-mcp-server"
      ]
    }
  }
}
```

### VS Code (`.vscode/mcp.json`)

```json
{
  "servers": {
    "flagquantum-mcp-server": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "flagquantum-mcp-server"
      ]
    }
  }
}
```

### VS Code CLI

```sh
code --add-mcp '{"name":"flagquantum-mcp-server","type":"stdio","command":"uvx","args":["flagquantum-mcp-server"]}'
```

### Claude Desktop (`claude_desktop_config.json`)

```json
{
  "mcpServers": {
    "flagquantum-mcp-server": {
      "command": "uvx",
      "args": [
        "flagquantum-mcp-server"
      ]
    }
  }
}
```

### Codex

```sh
codex mcp add flagquantum-mcp-server -- uvx flagquantum-mcp-server
```

### Codex config.toml (`~/.codex/config.toml`)

```toml
[mcp_servers.flagquantum-mcp-server]
command = "uvx"
args = ["flagquantum-mcp-server"]
```

### Gemini CLI

```sh
gemini mcp add -s user flagquantum-mcp-server uvx -- flagquantum-mcp-server
```

### Gemini settings.json (`~/.gemini/settings.json`)

```json
{
  "mcpServers": {
    "flagquantum-mcp-server": {
      "command": "uvx",
      "args": [
        "flagquantum-mcp-server"
      ]
    }
  }
}
```

## Environment variables

| Name | Required | Secret | Description |
|---|---|---|---|
| `FLAGQUANTUM_MCP_MAX_GATES` | no | no | Largest instruction count the server will process. Defaults to 10000. |
| `FLAGQUANTUM_MCP_MAX_IR_BYTES` | no | no | Largest serialized circuit payload accepted, in bytes. Defaults to 262144. |
| `FLAGQUANTUM_MCP_MAX_QUBITS` | no | no | Largest circuit width the server will process. Defaults to 24. |

## FAQ

### Can I import OpenQASM text directly into the server?

No, OpenQASM text is not a supported input format. You must load OpenQASM into the FlagQuantum SDK first and then send the resulting IR.

### What circuit formats are supported for input?

The server accepts two FlagQuantum serialization formats: 'ir' (canonical JSON) and 'qir' (a compact gate list).

### How can I run the server over a network?

You can serve the server over HTTP using the --transport http flag, which allows a gateway to connect to it.
