Linkly AI CLI

May 8, 2026 · View on GitHub

Command-line interface for Linkly AI — search your local documents from the terminal.

The CLI connects to the Linkly AI desktop app's MCP server, giving you fast access to your indexed documents without leaving the terminal.

Prerequisites

By default, the Linkly AI desktop app must be running with MCP server enabled. The CLI automatically discovers the app via ~/.linkly/port. Alternatively, use LAN mode (--endpoint + --token) or Remote mode (--remote with a saved API key) — see Connection Modes.

Installation

macOS / Linux

curl -sSL https://updater.linkly.ai/cli/install.sh | sh

Windows (PowerShell)

irm https://updater.linkly.ai/cli/install.ps1 | iex

Homebrew (macOS / Linux)

brew tap LinklyAI/tap
brew install linkly

Cargo

cargo install linkly-ai-cli

GitHub Releases

Pre-built binaries for all platforms are available on the Releases page.

PlatformFile
macOS (Apple Silicon)linkly-aarch64-apple-darwin.tar.gz
macOS (Intel)linkly-x86_64-apple-darwin.tar.gz
Linux (x86_64)linkly-x86_64-unknown-linux-gnu.tar.gz
Linux (ARM64)linkly-aarch64-unknown-linux-gnu.tar.gz
Windows (x64)linkly-x86_64-pc-windows-msvc.zip

From Source

cargo install --path .

Usage

Find Paths

Locate folder candidates when you only know a fuzzy or cross-language container name (e.g. "WeChat" but the actual path contains xinWeChat). Pass several variants in --patterns so the keywords are OR-matched in a single call. Output is intended as a --path-glob source for linkly search.

linkly find-paths --patterns "WeChat,微信,wxid"
linkly find-paths --patterns "Notion,notion" --library my-research
linkly find-paths --patterns "Dropbox" --limit 5
OptionDescription
--patterns <list>Comma-separated keywords (OR-matched); ASCII case-insensitive, CJK literal
--library <name>Restrict to a specific library by name
--limit <N>Maximum folder candidates returned (default: 10, max: 50)

Search Documents

linkly search "machine learning"
linkly search "API design" --limit 5
linkly search "notes" --type pdf,md,docx
linkly search "attention" --library my-research
linkly search "transformer" --path-glob "*.pdf"
linkly search "quarterly report" --modified-after 2024-01-01 --modified-before 2024-12-31
linkly search "weekly notes" --time-sort newest --limit 10
OptionDescription
--limit <N>Maximum results (default: 20, max: 50)
--type <types>Filter by document types, comma-separated (e.g. pdf,md,docx,txt,html)
--library <name>Restrict search to a specific library by name
--path-glob <pat>SQLite GLOB pattern to filter by file path. * matches any chars (including /), ? matches one char (e.g. *.pdf, *papers*, 2024/*.md). When the actual path is unknown, run linkly find-paths first to obtain it.
--modified-after <iso>Inclusive lower bound on file modification time. Accepts a bare date (2024-01-01) or RFC 3339 (2024-01-01T00:00:00Z). UTC. Use for explicit windows like "after January 2024".
--modified-before <iso>Inclusive upper bound. Same format as --modified-after.
--time-sort <mode>Reorder by modification time: newest or oldest. Omit (default) to keep BM25 + vector relevance ordering. Use newest for "recent / latest" intent without a fixed window.

View Document Outline

Get structural outlines for one or more documents (IDs come from search results):

linkly outline <doc-id>
linkly outline <id1> <id2> <id3>

Locate Lines in a Document

linkly grep "pattern" <doc-id>
linkly grep "error|warning" <doc-id> -C 3 -i
linkly grep "TODO" <doc-id> --mode count
OptionDescription
-C, --contextLines of context before and after each match
-B, --beforeLines of context before each match
-A, --afterLines of context after each match
-iCase-insensitive matching
--modeOutput mode: content or count
--limitMaximum matches (default: 20, max: 100)

Read Document Content

linkly read <doc-id>
linkly read <doc-id> --offset 50 --limit 100
OptionDescription
--offset <N>Starting line number (1-based)
--limit <N>Number of lines to read (max: 500)

Check Status

linkly status

MCP Bridge Mode

Run as a stdio MCP server for Claude Desktop, Cursor, or other MCP clients:

linkly mcp

Claude Desktop configuration (claude_desktop_config.json):

{
  "mcpServers": {
    "linkly-ai": {
      "command": "linkly",
      "args": ["mcp"]
    }
  }
}

Diagnose Connection Issues

linkly doctor
linkly doctor --remote
linkly doctor --endpoint http://192.168.1.100:60606/mcp --token abc123

Runs a series of checks (port file, server reachability, auth, MCP round-trip) and reports pass/fail with actionable advice.

List Libraries

List all available knowledge libraries (useful with search --library):

linkly list-libraries
linkly list-libraries --remote

Self-Update

linkly self-update

Connection Modes

The CLI supports three connection modes:

ModeFlagsAuthHow it works
Local(default)None (localhost)Reads ~/.linkly/port, connects to 127.0.0.1
LAN--endpoint <url> --token <token>Bearer token from desktop appDirect connection to a LAN device
Remote--remoteAPI Key via auth set-keyConnects via https://mcp.linkly.ai tunnel

Note: --endpoint and --token are required together for LAN access and conflict with --remote. For remote access, use linkly auth set-key. The mcp command also accepts --endpoint alone (without --token).

Remote mode setup

# Save your API Key (from https://linkly.ai/dashboard)
linkly auth set-key lkai_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

# Search via remote tunnel
linkly search "machine learning" --remote

LAN mode with token

# Connect to another device on the same network (token from desktop Settings → MCP)
linkly search "report" --endpoint http://192.168.1.100:60606/mcp --token your_lan_token

Options

Connection options (--endpoint, --token, --remote) are available on search, find-paths, explore, grep, outline, read, status, doctor, and list-libraries commands. --endpoint alone is also available on mcp. --json is available on all commands.

FlagScopeDescription
--endpoint <url>LANConnect to a specific MCP endpoint (e.g. http://192.168.1.100:60606/mcp), requires --token
--token <token>LANBearer token for LAN authentication (required with --endpoint, conflicts with --remote)
--remoteRemoteConnect via https://mcp.linkly.ai tunnel (conflicts with --endpoint, requires auth set-key)
--jsonGlobalOutput in JSON format (useful for scripting)
-V, --versionGlobalPrint version
-h, --helpGlobalPrint help

Examples

# Local search (default, requires desktop app running)
linkly search "budget report"

# Search across LAN with token
linkly search "budget report" --endpoint http://192.168.1.100:60606/mcp --token abc123

# Search via remote tunnel
linkly search "TODO" --remote

# JSON output for scripting
linkly search "TODO" --json | jq '.content'

# Pipe document content
linkly read abc123 --limit 50 | head -20

License

Apache-2.0