TSLinkTSLink Docs

Let your coding agent share a private preview

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.

Last updated on

View as Markdown

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 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, Codex CLI, Cursor, Gemini CLI or 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.

Plugin route

Enter these two commands separately inside Claude Code:

Code
/plugin marketplace add anydoor7/tslink
Code
/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.

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.

For optional workflow instructions, copy the skills/tslink-preview directory from 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.

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 and CLI MCP commands. 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.

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 and configuration locations. 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:

Code
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; 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 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 for enrollment, login, hot reload and cleanup, or quickstart for a first manual share.

Local stdio MCP uses owner authority by default. See MCP roles before delegating management, and MCP server reference for tools and protocol details. Private local services for agents explains CLI JSON and MCP choices.

Client documentation checked on 2026-10-18 (America/Los_Angeles).

Table of Contents