# CLI MCP Server

Source: https://userguide.qualytics.io/cli/mcp-server/

> **Tip: Connecting an AI client to Qualytics?**
>
> Claude Desktop, Claude Code, Cursor, ChatGPT, and other MCP-compatible clients connect to your Qualytics deployment directly, with no CLI required. See [Connecting External AI Clients](https://userguide.qualytics.io/using-the-platform/mcp/connecting-external-ai-clients/requirements/) for the setup steps for each client.

The CLI includes `qualytics mcp serve`, a local bridge to the [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server built into your Qualytics deployment. Use it when:

- The client only supports MCP servers that run as a local command (the `stdio` transport) and cannot connect to an HTTP endpoint.
- You already use the CLI and want a local bridge for a command-based MCP client.

## Start the Server

```bash
qualytics mcp serve
```

The command reads the URL and SSL setting saved by [CLI login](https://userguide.qualytics.io/cli/authentication/), then starts a separate MCP OAuth connection. Your browser opens so you can authorize the bridge with your Qualytics API token. The bridge stores and refreshes its MCP grant locally. It does not send the CLI API token as the MCP bearer. MCP clients normally launch this command in the background; you rarely run it by hand.

### Options

| Option | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `--transport`, `-t` | TEXT | `stdio` | No | Transport protocol: `stdio` or `streamable-http` |
| `--host` | TEXT | `127.0.0.1` | No | Host for `streamable-http` transport |
| `--port`, `-p` | INTEGER | 8000 | No | Port for `streamable-http` transport |

## Register the Bridge in a Client

Register `qualytics mcp serve` as a command-based (stdio) MCP server. In Claude Code, for example:

```bash
claude mcp add qualytics -- qualytics mcp serve
```

Other clients follow the same pattern: the command is `qualytics` and the arguments are `mcp serve`. Check the client's documentation for where it stores command-based MCP servers.

## HTTP Transport

To expose the bridge over the network, for example when the assistant runs on a different machine than the CLI:

```bash
qualytics mcp serve --transport streamable-http --host 0.0.0.0 --port 8000
```

Then point the client at `http://<host>:8000`. The bridge carries the permissions granted during MCP authorization, so restrict network access accordingly.

## Available Tools

The bridge exposes the same tools as your deployment's MCP server, so the list is always current with your Qualytics version. See [MCP](https://userguide.qualytics.io/using-the-platform/mcp/) for what those tools can do. It adds one local tool, `auth_status`, which reports the CLI's configured URL, API token validity, and expiry so the assistant can confirm the saved CLI connection before making calls.

> **Info: Prerequisites**
>
> The bridge needs a saved CLI connection and a valid API token for the browser authorization. Complete [CLI login or manual token setup](https://userguide.qualytics.io/cli/authentication/) before starting it.

*Last updated: November 7, 2026.*
