> ## Documentation Index
> Fetch the complete documentation index at: https://linkly.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 在 Cursor 中使用 Linkly AI

> 将 Linkly AI 本地知识库集成到 Cursor，让 AI 编程助手可以搜索和阅读你的项目文档

## 可以用来做什么

> [accordion] 写代码时自动引用需求文档
>
> 不用手动复制粘贴需求，Cursor 通过 Linkly AI 的 `read` 工具直接读取你计算机中的产品规范文档，在生成代码前先理解需求，减少因理解偏差导致的返工。

> [accordion] 精准搜索项目内部文档
>
> 用 Linkly AI 的 `search` 工具在本地文档中快速定位接口说明、数据字典或技术规范，不必离开编辑器切换窗口翻文档。

> [accordion] 结合业务背景 debug
>
> 调试时让 Cursor 通过 Linkly AI 读取业务逻辑文档，AI 了解业务规则后更容易定位问题根因，而不只是就代码论代码。

## 前置条件

* 已安装 [Cursor](https://cursor.com)
* Linkly AI Desktop 已启动，MCP 服务正在运行

## 配置步骤

> [tab] MCP HTTP（推荐）
>
> **1. 打开 MCP 设置**
>
> 在 Cursor 中，打开 **Settings → MCP Servers → Add Server**。
>
> **2. 添加 Linkly AI MCP**
>
> 填写以下信息：
>
> * Name：`linkly-ai`
> * Type：`StreamableHTTP`
> * URL：`http://127.0.0.1:60606/mcp`

> [tab] MCP Stdio
>
> 需要先[安装 Linkly AI CLI](https://linkly.ai/docs/zh/use-cli.md)。
>
> **1. 打开 MCP 设置**
>
> 在 Cursor 中，打开 **Settings → MCP Servers → Add Server**。
>
> **2. 添加 Linkly AI MCP**
>
> 填写以下信息：
>
> * Name：`linkly-ai`
> * Type：`stdio`
> * Command：`linkly`
> * Args：`mcp`

> [tab] CLI
>
> 需要先[安装 Linkly AI CLI](https://linkly.ai/docs/zh/use-cli.md)。安装后，Cursor 的 AI 助手可以直接调用 CLI 命令来搜索和阅读你的文档：
>
> ```bash theme={null}
> linkly search "关键词"
> linkly read <document-id>
> ```

> [!TIP]
>
> 建议同时安装 [Linkly AI Skills](https://linkly.ai/docs/zh/use-skills.md)，教会 AI 助手如何高效地使用 Linkly AI 的工具，提升搜索和阅读效率。

## 开始使用

配置完成后，在 Cursor 的 AI 对话中直接提问，Cursor 会自动调用 Linkly AI 的工具。例如：

* "搜索我的文档中关于数据库设计的内容"
* "读一下项目的 API 文档"

## 常见问题

> [accordion] 无法连接 MCP 服务
>
> 请检查： 1. Linkly AI Desktop 是否已启动 2. MCP 服务是否正在运行（「Agent 使用」页「允许本机访问」一行显示「运行中」） 3. 端口号是否为 60606（可在「Agent 使用」页的「查看 MCP 接入配置」中确认）


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.