---
title: "Let your coding agent share a private preview"
description: "Connect Claude Code, Codex, Cursor, Gemini CLI or OpenCode to TSLink. Let your agent share its running dev server as a private HTTPS address for your phone or a colleague."
url: "https://tslink.md/docs/agent-integrations"
locale: "en"
product_version: "0.2.0"
source: "https://github.com/anydoor7/tslink/blob/v0.2.0/docs/agents.md"
---

> Documentation index: https://tslink.md/llms.txt · Installed binary is authoritative: `tslink manifest`.

Your agent starts the app. You open it on your phone, privately. Connect TSLink once, then ask the agent to share the port it just started. It can return a private HTTPS address through Tailscale for your phone or an authorized colleague.

[Install TSLink](https://tslink.md/docs/installation.md) on the machine running the agent and dev server first. The lines below register the installed `tslink` binary as a local MCP server with args `mcp`; they do not install the binary or start your app. If the agent cannot find `tslink` on `PATH`, use the binary's absolute path. Approve the connection in your client and start a fresh session if the tools do not appear.

Choose [Claude Code](https://tslink.md/docs/agent-integrations.md#claude-code), [Codex CLI](https://tslink.md/docs/agent-integrations.md#codex-cli), [Cursor](https://tslink.md/docs/agent-integrations.md#cursor), [Gemini CLI](https://tslink.md/docs/agent-integrations.md#gemini-cli) or [OpenCode](https://tslink.md/docs/agent-integrations.md#opencode).

## Claude Code

Run in your terminal:

```bash
claude mcp add --transport stdio --scope user tslink -- tslink mcp
```

This adds a user-wide entry in `~/.claude.json`. Run `/mcp` inside Claude Code to check it. See the [official MCP setup](https://code.claude.com/docs/en/mcp).

### Plugin route

Enter these two commands separately inside Claude Code:

```text
/plugin marketplace add anydoor7/tslink
```

```text
/plugin install tslink@tslink
```

Choose Install for you (user scope) in the plugin panel; this records enablement in `~/.claude/settings.json`. Downloaded plugins live under `~/.claude/plugins`. Reload plugins or restart Claude Code after installation. The plugin supplies the preview skill and MCP connection. Choose one route to avoid duplicate TSLink connections. See the [official plugin guide](https://code.claude.com/docs/en/discover-plugins).

## Codex CLI

Run in your terminal:

```bash
codex mcp add tslink -- tslink mcp
```

This writes to `~/.codex/config.toml` (or `$CODEX_HOME/config.toml` when set). Run `/mcp` inside Codex to check it. The equivalent TOML entry is:

```toml
[mcp_servers.tslink]
command = "tslink"
args = ["mcp"]
```

See [official Codex MCP configuration](https://learn.chatgpt.com/docs/extend/mcp?surface=cli#configure-with-the-cli).

For optional workflow instructions, copy the `skills/tslink-preview` directory from [anydoor7/tslink](https://github.com/anydoor7/tslink) into `.agents/skills/tslink-preview` in your project, or `~/.agents/skills/tslink-preview` for your user. The entry file is `SKILL.md`. Codex scans `.agents/skills` from the working directory up to the repository root and also reads user skills. The skill supplies instructions; keep the MCP connection above. See [official skill locations](https://learn.chatgpt.com/docs/build-skills#where-codex-loads-local-skills).

## Cursor

Merge this entry into `.cursor/mcp.json` in your project, or `~/.cursor/mcp.json` for all projects. Keep any other servers already in the file:

```json
{
  "mcpServers": {
    "tslink": {
      "command": "tslink",
      "args": ["mcp"]
    }
  }
}
```

Enable TSLink in Cursor's MCP settings. Cursor CLI reads the same files; its terminal approval command is:

```bash
agent mcp enable tslink
```

The CLI's older name is `cursor-agent`. See [official Cursor MCP configuration](https://cursor.com/docs/mcp) and [CLI MCP commands](https://cursor.com/docs/cli/mcp). The JSON entry registers the server; the enable command approves an existing entry.

## Gemini CLI

Sign in to Gemini CLI first, then run in your terminal:

```bash
gemini mcp add --transport stdio --scope user tslink tslink mcp
```

This adds a user-wide entry in `~/.gemini/settings.json`. Use `/mcp` in Gemini to inspect tools. See [official Gemini MCP setup](https://geminicli.com/docs/tools/mcp-server/).

## OpenCode

Merge this entry into your project's `opencode.json`, preserving other settings:

```json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "tslink": {
      "type": "local",
      "command": ["tslink", "mcp"],
      "enabled": true
    }
  }
}
```

For user-wide configuration, use `~/.config/opencode/opencode.json`. Start a new session to load the server. See [official local MCP setup](https://opencode.ai/docs/mcp-servers/) and [configuration locations](https://opencode.ai/docs/config/). The installed CLI's `opencode mcp add` is interactive, so the configuration entry keeps setup copyable.

## Ask for a private preview

After your agent starts the dev server, send:

```text
Use TSLink to share the dev server you just started as a private preview.
Use its actual port and restrict access to my Tailscale login; ask if unknown.
If enrollment is needed, give me the auth URL and wait
for me to finish it. Then retrieve the exact app URL for the returned name.
Keep it private and remove the share when I ask you to finish the preview.
```

With MCP, the agent calls `share` with the actual target and `allow: ["<your Tailscale login>"]`, then `url` for the returned name. For CLI access restrictions, use the `add --allow` workflow in [people sharing](https://tslink.md/docs/people-sharing.md); `tslink share 3000` shares port 3000 without a per-person restriction.

## What happens on first run

On first use, a person must open the returned Tailscale enrollment URL in a browser and complete any device approval. `needs_login` with `auth_url` means enrollment is pending; it is not an app URL. The agent can then retrieve the real address with `tslink url <returned-name> --wait`. No stored API token is required for this default private flow.

The first share may also install TSLink's persistent OS background service. If TSLink is already running, you can skip installation with CLI `--no-daemon-install` or MCP `no_daemon_install: true`; if you decline the service and TSLink is not running, the share cannot start. When the service is installed, MCP results include `daemon_installed` with `manager`, `path` and `undo`, and the CLI prints a notice ending `Undo with: tslink uninstall`. `tslink uninstall` removes the service for every TSLink app, so check other apps first. Removing the preview with `tslink remove <returned-name>` does not uninstall that service.

## Who can open it

Your phone needs Tailscale connected and permission to reach the app node. By default, every tailnet member allowed by tailnet policy can reach the share. For a preview on your own phone, restrict access to your own Tailscale login. Use [people sharing](https://tslink.md/docs/people-sharing.md) for access restrictions, named grants and deadlines.

A colleague also needs Tailscale and authorized access; an outsider must accept the relevant device share. The URL alone does not grant access. See [the phone walkthrough](https://tslink.md/docs/agent-ui-phone.md) for enrollment, login, hot reload and cleanup, or [quickstart](https://tslink.md/docs/quickstart.md) for a first manual share.

Local stdio MCP uses owner authority by default. See [MCP roles](https://tslink.md/docs/mcp-scopes.md) before delegating management, and [MCP server reference](https://tslink.md/docs/mcp-server.md) for tools and protocol details. [Private local services for agents](https://tslink.md/blog/ai-local-services) explains CLI JSON and MCP choices.

Client documentation checked on 2026-10-18 (America/Los\_Angeles).
