Skip to main content

Introduction to Linkly AI CLI

Linkly AI CLI is a command-line tool that connects to Linkly AI Desktop’s MCP service, allowing you to search, browse, and read local documents from the terminal. It also serves as a bridge between AI Agents (such as Claude Desktop, Cursor) and Linkly AI.

Terminal Search

Search your documents directly from the command line — ideal for developers and power users

MCP Bridge

Run in stdio MCP mode, enabling Claude Desktop, Cursor, and other AI tools to call Linkly AI

Installation

Run in your terminal:
Or install via Homebrew:
After installation, verify the installation:
By default, the CLI discovers and connects to the local Linkly AI Desktop app via ~/.linkly/port. You can also connect to a remote device via LAN or the cloud tunnel — see Connection Modes below.

Usage

The CLI follows a search → grep or outline → read progressive workflow: first search to find target documents, then use grep to find patterns or view the outline to understand the structure, and finally read the specific content. When the user describes a container (“in my Notion notes”, “in my Dropbox papers folder”) whose actual path is unknown, call find-paths before search to discover the path.
Every successful command output ends with a [meta] now=2026-05-08T...Z UTC timestamp line (or a top-level _meta.now field in JSON mode). This is metadata Desktop provides to AI assistants for computing relative dates like “last month” — human users can ignore it; for scripting, you may want to filter out the last line before further parsing.

Check Connection Status

Returns the running status, version number, number of indexed documents, and indexing status of Linkly AI Desktop.

Search Documents

Searches your local documents and returns the most relevant results, including title, path, relevance score, and content snippet. Common parameters:
--modified-after / --modified-before accept ISO 8601 UTC: a bare date 2024-01-01 (treated as 00:00:00Z) or a full RFC 3339 timestamp 2024-01-01T00:00:00Z. --time-sort accepts newest / oldest; omit it to keep the default BM25 + vector relevance order.

View Document Outline

Retrieves the structured outline and metadata of a document. DOC_ID is obtained from search results. You can view multiple documents at once:
The outline feature works best with Markdown, DOCX, PowerPoint (PPTX), and EPUB documents, as their heading structures can be parsed. For plain text or PDFs without bookmarks, it’s recommended to use the read command directly.

Search Patterns in Documents

Search for regex pattern matches within a single document. Use when you need to find specific text (terms, names, dates, identifiers, etc.):

Read Document Content

Reads the full content of a document, outputting text with line numbers. For long documents, you can read in pages:
Pagination strategy: By default, 200 lines are read per request (max 500 lines). For long documents, adjust --offset to read progressively:

Find Paths (find-paths)

Fuzzy-matches keywords against the file path field of indexed documents, aggregates matches at folder granularity, and returns the top folder candidates. It is positioned as a helper for search: when the user names a container (“in my Notion notes”, “in my Dropbox papers folder”) but you don’t know its on-disk path, call find-paths first, then pass a distinctive segment of the returned path to search as --path-glob. When a folder name contains glob metacharacters (* ? [), use the returned path_glob field directly — it is already escaped to match that folder literally. Two-step workflow:
Variant matching: --patterns takes a comma-separated list of keywords, OR-matched against the path. Pass several variants in one call (translation pairs, casing, real app/SDK identifiers when known) to maximise first-pass recall:
find-paths is a “find folders” tool, not a “find files” tool: only matches on directory segments count. If keywords match only the filename segment (an “orphan file”), they are silently dropped. If a query returns zero folders even though you expect matching files, fall back to calling linkly search directly without --path-glob.

MCP Mode

Runs as a stdio MCP server, exposing Linkly AI’s tools to MCP-compatible AI clients. Configure Claude Desktop and other local AI apps: Add the following to the configuration file of Claude Desktop or similar apps:
Edit ~/.config/Claude/claude_desktop_config.json:
Configure Cursor: In Cursor, open Settings → MCP Servers → Add Server, and add:
  • Name: linkly-ai
  • Command: linkly mcp

Update CLI

Automatically checks for and updates to the latest version. The CLI also checks for updates in the background on each launch and will prompt you to run this command if a new version is available.

Connection Modes

The CLI supports three ways to connect to your Linkly AI knowledge base:

Local Mode (default)

No extra flags needed. The CLI reads ~/.linkly/port to find the running desktop app:

LAN Mode

Connect to a Linkly AI instance running on another device in your local network. The token can be found in the desktop app under Settings → MCP:

Remote Mode

Connect to your knowledge base from anywhere via the cloud tunnel. First, save your API key (from linkly.ai/dashboard):
Then use --remote with any command:
--endpoint and --token are required together for LAN access. They cannot be combined with --remote. For remote access, use linkly auth set-key to save your API key.

Parameter Reference

Global Options

--endpoint, --token, and --remote are available on search, grep, outline, read, and status commands. --endpoint alone (without --token) is also available on the mcp command. --json is available on all commands.

search Parameters

find-paths Parameters

outline Parameters

grep Parameters

read Parameters