Linkly AI Desktop 在后台默默为你的文档建索引。但怎么用这些索引?
一种方式是通过 MCP 协议让 AI 助手直接调用。另一种更直接的方式——在终端里用命令行。
Linkly AI CLI 就是这个命令行工具。用 Rust 写的,二进制只有几 MB,通过 MCP 协议连接桌面应用,把文档搜索能力带到终端。
三个核心命令
CLI 遵循 Outlines Index 的渐进式工作流:search → outline → read。
search — 搜索文档
$ linkly search "Docker 部署" --limit 5
Found 5 results:
#1 生产环境部署指南
doc_id: 1044 | type: pdf | words: 12,400 | lines: 580
has_outline: yes | relevance: 0.89
#2 Docker Compose 配置说明
doc_id: 591 | type: md | words: 1,200 | lines: 85
has_outline: yes | relevance: 0.82
...
支持按文档类型过滤:
$ linkly search "API 文档" --type pdf,md,docx
outline — 查看文档大纲
$ linkly outline 1044
[1] 概述 [L1-30, 30行]
[2] 环境准备 [L31-80, 50行]
[3] Docker 部署 [L81-250, 170行]
[3.1] Dockerfile 配置 [L85-140, 56行]
[3.2] Docker Compose [L141-220, 80行]
[3.3] 环境变量 [L221-250, 30行]
[4] Kubernetes 部署 [L251-450, 200行]
...
支持批量查看多个文档的大纲:
$ linkly outline 1044 591 302
read — 阅读内容
$ linkly read 1044 --offset 141 --limit 80
141 | ## Docker Compose
142 |
143 | 使用 docker-compose 管理多容器部署...
...
220 | 运行 `docker-compose up -d` 启动服务。
Showing lines 141-220 of 580.
找到目标章节后,精准阅读。不用打开 PDF 阅读器,不用离开终端。
MCP 桥接:让 AI 工具接入
CLI 最重要的功能之一是 mcp 命令:
$ linkly mcp
这会以 stdio MCP 服务器模式运行,把 Linkly AI 的 HTTP MCP 转换为 stdio MCP。这样,任何支持 stdio MCP 的 AI 客户端都能接入。
Claude Desktop 配置:
{
"mcpServers": {
"linkly-ai": {
"command": "linkly",
"args": ["mcp"]
}
}
}
Cursor 配置:Settings → MCP Servers → Add Server,填入 linkly mcp。
配好后,你的 Claude Desktop 或 Cursor 就能直接搜索和阅读你电脑上的文档了。
其他实用功能
状态检查:
$ linkly status
CLI version: 0.1.5
App version: 0.1.9
Endpoint: http://127.0.0.1:60606/mcp
Documents: 3,260
Status: Up to date (watching)
JSON 输出(方便脚本处理):
$ linkly search "合同" --json | jq '.results[0].title'
局域网搜索(访问其他设备上的文档):
$ linkly search "报告" --endpoint http://192.168.1.100:60606/mcp
自更新:
$ linkly self-update
安装
# macOS / Linux(推荐)
curl -sSL https://updater.linkly.ai/cli/install.sh | sh
# Homebrew
brew tap LinklyAI/tap && brew install linkly
# Cargo
cargo install linkly-ai-cli
# Windows (PowerShell)
irm https://updater.linkly.ai/cli/install.ps1 | iex
安装后确保 Linkly AI Desktop 在运行,CLI 会通过 ~/.linkly/port 文件自动发现桌面应用。零配置。
