Metadata-Version: 2.4
Name: lucidlink-mcp-cloudflared
Version: 0.3.0
Summary: Team gateway (one URL, per-person sign-in) and quick-tunnel wrapper for the LucidLink MCP server
Author: LucidLink
License-Expression: LicenseRef-Proprietary
Project-URL: Homepage, https://www.lucidlink.com
Keywords: mcp,lucidlink,cloudflared,tunnel,claude
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: lucidlink-mcp<1.1,>=1.0.1
Requires-Dist: httpx<1,>=0.27
Requires-Dist: starlette<2,>=0.37
Requires-Dist: uvicorn<1,>=0.31.1
Requires-Dist: anyio<5,>=4
Requires-Dist: mcp<3,>=2.0
Requires-Dist: pydantic<3,>=2
Dynamic: license-file

# lucidlink-mcp-cloudflared

One command, one URL: serve the [LucidLink MCP](https://pypi.org/project/lucidlink-mcp/)
to **any MCP client that supports remote connectors** — claude.ai (web,
mobile, Cowork), Cursor, Codex, and friends — through a
[Cloudflare quick tunnel](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/do-more-with-tunnels/trycloudflare/).

```bash
uvx lucidlink-mcp-cloudflared
```

starts the **team gateway** and prints one connector URL
(`https://<random>.trycloudflare.com/mcp`). Add it once to your client
(claude.ai: Settings → Connectors); each person who connects enrolls with their
own service-account token and gets their own isolated backend and identity.
Ctrl+C stops the server and the tunnel and retires the URL; the member list
and sign-ins stay in `~/.lucidlink/` on this machine (see State under
[Team mode](#team-mode-one-url-per-member-auth)).

For a personal, no-OAuth endpoint (the URL itself is the credential):

```bash
uvx lucidlink-mcp-cloudflared solo
```

prints `https://<random-words>.trycloudflare.com/<secret>/mcp`, paste-ready,
and self-tests it over the exact edge-and-back path a remote client will use.

## Why a separate package

The official `lucidlink-mcp` package deliberately never spawns a tunnel
vendor's binary or routes your traffic anywhere — its `--http` mode binds a
local port and leaves the pipe to you. This companion is the
explicitly-chosen convenience that adds the pipe. Installing it is the
opt-in.

## Prerequisites

- A LucidLink service-account token per person (a workspace admin mints
  them in the LucidLink admin app under Service Accounts). **No pre-setup
  needed**: in team mode each member pastes their token on the enrollment
  page when they click Connect; in `solo` mode, first run walks you
  through pasting and verifying yours — the same wizard as
  `lucidlink-mcp-setup`, saved to the same `~/.lucidlink/mcp-config.json`
  every LucidLink MCP client reads.
- `cloudflared` on PATH — **never downloaded for you**:
  - macOS: `brew install cloudflared`
  - Windows: `winget install --id Cloudflare.cloudflared`
  - Linux: [Cloudflare's downloads page](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/downloads/)

## Flags

Bare invocation takes `team serve` flags:

- `--public-url URL` — serve behind your own pipe (reverse proxy, named
  tunnel) instead of a quick tunnel
- `--port N`, `--host ADDR` — where the gateway listens (default
  `127.0.0.1:8000`). It speaks plain HTTP: put HTTPS in front, and only use
  a non-loopback `--host` with the port firewalled to that front door
- `--workspace-id UUID` (repeatable) — only accept tokens from these
  LucidLink workspaces. Without it the gateway pins itself to the workspace
  of the first member who enrolls; `--allow-any-workspace` turns the check off
- `--allowed-redirect-host HOST` (repeatable, `*.example.com` allowed) —
  extra hosts an OAuth client may send people back to. Built in: Claude
  (`claude.ai`), ChatGPT (`chatgpt.com`), Copilot Studio / Microsoft 365
  (`global.consent.azure-apim.net`, `*.consent.azure-apim.net`,
  `teams.microsoft.com`), VS Code (`vscode.dev`, `insiders.vscode.dev`),
  Cursor (`cursor.com`, `www.cursor.com`), plus loopback.
  `--allow-any-redirect` turns the check off
- `--allowed-redirect-scheme SCHEME` (repeatable) — extra desktop-app link
  schemes that may receive sign-ins. Built in: `cursor`, `vscode`,
  `vscode-insiders`, `windsurf`. Never add a browser's or an office app's
  scheme (`microsoft-edge`, `googlechrome`, `ms-word`, …): those open any web
  address, so a sign-in could be sent anywhere
- `--access-log FILE` — also write one JSON line per tool call (the service
  log always gets a line; see below)
- `--rate-limit CALLS` — tool calls per minute per member (default: the
  server's own, 100)
- `--idle-timeout SECONDS` (default 900), `--max-backends N` (default 8)
- `--write` — mutating tools for every member that session

`solo` flags:

- `--port N` — local port (default 8000; always binds loopback)
- `--write` — register mutating tools (**read-only by default**)
- `--path-secret SECRET` — bring your own secret path segment (one is always
  generated otherwise; a public quick-tunnel URL never runs without one)

## Team mode: one URL, per-member auth

The default command (`team serve` spelled out):

```bash
uvx lucidlink-mcp-cloudflared team serve
```

It prints **one connector URL** (`https://<host>/mcp`). Add it once as a
remote connector in your MCP client (claude.ai: Settings → Connectors —
on Team/Enterprise plans a workspace Owner does this; members then connect
individually). When a member connects,
their browser lands on the gateway's enrollment page and they paste **their
own** service-account token — verified with LucidLink, stored only on the
gateway box (0600). The client receives an opaque, revocable OAuth token
per member; SA tokens never pass through an admin, a URL, or a conversation.

Each member gets their **own backend process** under their own SA — own
permissions, own locks and rate limits — spawned lazily on first request and
reaped when idle (`--idle-timeout`, default 15 min; `--max-backends` caps
concurrent members, default 8; budget roughly 150-550 MB of memory and up to
~1 GB of disk cache per *active* member). Each backend's disk cache lives in
its own folder under `~/.lucidlink/mcp-team-state/<sa_id>/tmp/` and is
deleted when the backend stops.

**Who read what.** The LucidLink audit trail does not record reads made
through the SDK, so the gateway logs one line per tool call: member, tool,
path or search arguments (never file contents), result and duration — to
the service log, and as JSON lines to `--access-log FILE` if given.

Admin console:

```bash
uvx lucidlink-mcp-cloudflared team list                # who's enrolled (any time)
uvx lucidlink-mcp-cloudflared team remove maria        # revoke: kills all her tokens
uvx lucidlink-mcp-cloudflared team allow-write maria   # register mutating tools for her
uvx lucidlink-mcp-cloudflared team revoke-write maria  # back to read-only (the default)
uvx lucidlink-mcp-cloudflared team readmit maria       # let a removed member enroll again
```

All of these work while the gateway runs, with no restart: the gateway notices
the change on the next request (or within 5 seconds). `remove` revokes all of
that member's sign-ins, stops their backend, and blocks them from enrolling
again until `readmit`; `allow-write`/`revoke-write`
restart only that member's backend (a call in progress is cut off). Nobody
else is affected. Also delete or expire a removed member's service account
in LucidLink. For a sandbox
session where everyone should be able to write (demo filespace, kicking
the tires), skip the per-member ceremony: `team serve --write` registers
mutating tools for every member for that session only.

Caveat that matters: OAuth binds to the hostname, and a quick tunnel mints a
**new** hostname every restart — the whole team reconnects. Fine for a demo;
a real deployment runs `team serve --public-url https://mcp.yourco.example`
behind a named tunnel or reverse proxy.

**For a real deployment, also:**

- **Put a password on `/enroll`** at your reverse proxy (HTTP basic auth on
  that path only). The gateway's enrollment page has no password of its own:
  on a quick tunnel the random hostname is the only secret, and behind
  `--public-url` anyone who finds the address could enroll with any valid
  token. Leave every other path open: sign-in calls come from the AI
  provider's servers.
- **Pass `--workspace-id`** for the workspace(s) you serve, rather than
  letting the first enrollment pin it. If the members already enrolled
  belong to several workspaces and nothing says which to serve, the gateway
  refuses to start until you choose (`--workspace-id` per workspace, or
  `--allow-any-workspace`).
- Rate-limit `/register` and `/authorize` at the proxy if it can; they are
  open to the internet. The gateway caps what one registration may store and
  refuses OAuth request bodies over 64 KB.

State: `~/.lucidlink/mcp-team.json` (members and their service-account
tokens, 0600, rewritten only on enrollment or an admin change),
`~/.lucidlink/mcp-team-oauth.json` (OAuth clients and hashed bearer tokens),
two lock files (`mcp-team.lock`: one gateway per state folder;
`mcp-team-members.lock`: one member-file edit at a time), and
`~/.lucidlink/mcp-team-state/`. Access
tokens last 8 hours; refresh tokens rotate on each use and expire after 30
days without use (or when the member is removed).

Platforms: the LucidLink SDK ships Linux wheels for glibc 2.35+ on x86-64
(Ubuntu 22.04/24.04, Debian 12), plus macOS and Windows for development.
The locks are POSIX-only.

The backends are stock `lucidlink-mcp` servers, so they send its usage
telemetry (see that package's docs); its rate limit (100 tool calls per
minute per member by default) is set with `--rate-limit`.

## What to know before pasting the URL anywhere

- **In `solo` mode the URL is a bearer credential.** Anyone who has it has
  the endpoint. Treat it like a password; it dies on Ctrl+C and a restart
  mints a new one. In team mode the URL alone gets nobody in (each person
  signs in with their own token), but see the enrollment password above.
- **The model reading files is the exposure.** Content the agent reads
  enters your conversation and your AI provider's infrastructure under
  *your* plan's data terms. The tunnel adds Cloudflare's edge as a TLS
  terminator in the path.
- **Quick tunnels are best-effort.** No SLA; a reconnect mints a new
  hostname (re-paste in your client). For anything persistent, run
  `team serve --public-url` behind your own reverse proxy or named tunnel.
