Beyin引擎如何构建本地可查询知识库?(附AI代理集成方案)
AI Summary (BLUF)
Beyin is a local-first engine for building reusable knowledge packs from various sources like videos, articles, and local files. It integrates with MCP-compatible AI agents (e.g., Claude Code, Codex) and supports fully offline workflows with Ollama, keeping your data private and reusable across tools.
原文翻译: Beyin 是一个本地优先的引擎,用于从视频、文章和本地文件等多种来源构建可重复使用的知识包。它与 MCP 兼容的 AI 代理(如 Claude Code、Codex)集成,并支持通过 Ollama 实现完全离线工作流,确保您的数据在跨工具使用时保持私密和可重用。
Beyin: The Engine for Building Local, Queryable Knowledge Packs
概述
beyin 是一个“本地优先”的引擎,用于从您日常使用的各类资源(如视频、文章、播客、本地文件)中构建可复用的知识包。您的知识包完全存储在本地,并可通过 MCP 协议与您的 AI 智能体交互查询,或直接使用本地模型进行探索,确保您的知识上下文不会被锁定在单一工具或会话中。
beyin is a "local-first" engine for building reusable knowledge packs from the sources you already use, such as videos, articles, podcasts, and local files. Your packs stay entirely on your machine and can be queried through the MCP protocol with your AI agent or explored directly with a local model, ensuring your knowledge context is never trapped inside a single tool or session.
注:beyin 在土耳其语中意为“大脑”。
Note: beyin means "brain" in Turkish.
🎥 演示视频
| 演示 | 说明 |
|---|---|
| 快速演示 | 通过 MCP 提问,无需离开您的工作流即可从本地知识包中检索答案。 |
| CLI 设置 | 选择源类型,启用本地 Ollama 和文件工作流,并选择适合您转录需求的 Whisper 模型。 |
| 端到端工作流 | 在 CLI 中创建知识包、构建、连接到 MCP 智能体,并在常规工作流中自然地进行查询。 |
Note: Some source material used in these demos is from Adam Lyttle’s YouTube playlist, processed as demo input, and is licensed under CC BY 4.0.
✨ 核心特性
- 🔗 MCP 兼容:可与 Claude Code、Codex、Cursor、Windsurf、Zed 等工具协同工作 (MCP compatible: works with Claude Code, Codex, Cursor, Windsurf, Zed and more)
- 🔄 跨智能体知识包:一次构建,即可在任何 MCP 兼容的智能体或 CLI 中使用相同的本地知识包 (Cross-agent packs: build once, then use the same local packs from any MCP-compatible agent or the CLI)
- 📦 本地优先处理流程:处理、嵌入和存储全部在您的本地机器上完成 (Local-first pipeline: processing, embedding, and storage all happen on your machine)
- 🎬 丰富的源支持:YouTube 视频/播放列表、播客、PDF、文章、本地文件 (Rich source support: YouTube videos and playlists, podcasts, PDFs, articles, local files)
- 🌍 支持 50+ 种语言:开箱即用的多语言嵌入模型 (50+ languages: multilingual embedding model out of the box)
- 🤖 Ollama 支持:可使用本地模型完全离线运行 (Ollama support: run fully offline with a local model)
- ⚡ 即插即用:一条命令即可通过 MCP 连接,之后只需与您的智能体对话即可管理一切 (Plug and play: one command to connect via MCP, then manage everything by just talking to your agent)
- 🎯 多查询扩展:自动生成查询变体以提升检索效果 (Multi-query expansion: generates query variants automatically for better retrieval)
⚙️ 工作原理
推荐的使用方式是通过 MCP 与您已有的 AI 智能体(如 Claude Code、Codex、Cursor)协同工作。您的知识包存储在本地机器上,不绑定于任何特定的智能体会话或供应商。将 beyin 连接到您的 MCP 客户端后,您可以从任何客户端访问相同的知识包。
The recommended way to use beyin is through MCP with the AI agent you already use (e.g., Claude Code, Codex, Cursor). Your packs are stored locally on your machine and are not tied to any specific agent session or vendor. Once you connect beyin to your MCP client, you can access the same packs from whichever client you prefer.
对于音频和视频源,beyin 会先转录内容,然后对生成的文本进行分块和嵌入,以备检索。
For audio and video sources, beyin transcribes the content before chunking and embedding the resulting text for retrieval.
基本工作流程如下:
- 安装 beyin 并通过 MCP 将其连接到您的智能体 (Install beyin and connect it to your agent via MCP)
- 指示您的智能体创建知识包、添加源并构建它 (Tell your agent to create a pack, add your sources, and build it)
- 自然地提问,让您的智能体处理检索 (Ask questions naturally and let your agent handle retrieval)
这将成为您智能体工作流的一部分,在您需要时准确引入相关上下文,同时让您保持专注。
It becomes part of your agent’s natural workflow, bringing in the right context exactly when you need it while keeping you focused.
您也可以直接使用本地模型查询知识包,无需外部 API 或智能体。详见 使用本地模型查询。
You can also query packs directly with a local model, no external API or agent needed. See Query with a Local Model.
📂 支持的源类型
| 类型 | 示例 |
|---|---|
| 网页文章 | 公开 URL |
| YouTube | 视频及播放列表 |
| 播客 | RSS 订阅源 URL |
| 本地文档 | .pdf, .docx, .pptx, .epub, .xlsx, .csv |
| 本地文本 | .txt, .md, .rst, .html |
| 本地音频 | .mp3, .m4a, .wav |
| 本地视频 | .mp4, .mov, .mkv, .webm |
beyin is built for local processing on your own machine. Use it with content you are allowed to process, preferably public, permitted sources or material you own or have rights to use. Avoid copied, paywalled, private, restricted, or illegally shared content.
📦 安装指南
我们推荐使用 uv 进行安装,因为它能保持 CLI 安装的隔离性,并在您的 PATH 中提供一个干净的 beyin 命令。
We recommend
uvbecause it keeps the CLI install isolated and gives you a plainbeyincommand on yourPATH.
如果您尚未安装 uv,请先安装:
If you do not have
uvyet, install it first:
# macOS / Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows (PowerShell)
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
您也可以使用包管理器,例如在 macOS 上使用 brew install uv,或在 Windows 上使用 winget install --id=astral-sh.uv -e。更多选项请参阅官方 uv 安装指南。
Package manager alternatives also work, for example
brew install uvon macOS orwinget install --id=astral-sh.uv -eon Windows. See the officialuvinstallation guide for more options: docs.astral.sh/uv/getting-started/installation.
推荐使用 uv 安装 beyin:
The recommended way to install beyin is with
uv:
uv tool install beyin
如果您后续需要支持可选文档格式(如 .pdf、.docx 或 .xlsx),请在 beyin 的同一环境中安装相应的 Python 包。对于使用 uv tool install 的用户,可以使用一个命令重新安装并包含所有需要的额外功能,例如:
If you later want optional document support such as
.docx, or.xlsx, install those Python packages in the same environment as beyin. Foruv tool installusers, rerun the install with all desired extras in one command, for example:
uv tool install --reinstall --with pdfplumber --with openpyxl beyin
如果您已经管理着一个专用的 Python 环境,并明确希望在其中安装 beyin,那么 pip install beyin 仍然有效,但这是一种备选方案,而非推荐的默认方式。
If you already manage a dedicated Python environment and explicitly want beyin inside it,
pip install beyinstill works, but it is a fallback path rather than the recommended default.
ffmpeg 是处理视频和音频源所必需的。如果您仅使用文章和本地文件,可以跳过此步:
ffmpeg is required for video and audio sources. Skip if you only use articles and local files:
# macOS
brew install ffmpeg
# Linux
sudo apt install ffmpeg
# Windows
winget install ffmpeg
如果在 macOS 上没有 Homebrew 或 Windows 上的 winget 无法使用?请直接从 ffmpeg.org/download.html 下载。
No Homebrew on macOS or winget not working? Download directly from ffmpeg.org/download.html.
Windows 用户须知
如果您在 Windows 上并计划通过 Codex MCP 使用 beyin,建议使用 WSL 而非原生 Windows 环境。有关推荐设置和详细信息,请参阅 Windows 注意事项。
If you are on Windows and plan to use beyin through Codex MCP, prefer WSL over native Windows. See Windows Notes for the recommended setup and details.
🖥️ 通过 CLI 使用
您可以直接在终端中使用 beyin,无需 MCP:
You can use beyin directly in your terminal without MCP:
beyin
如果您想在构建任何内容之前验证运行时依赖:
If you want to verify runtime dependencies before building anything:
beyin check-deps
如果是全新安装,您的首次文本构建可能会要求下载 NLTK punkt_tab 分词器数据。这是正常现象。使用以下命令将其安装到当前的 beyin 环境中:
If this is a fresh install, your first text build may ask for the NLTK
punkt_tabtokenizer data. That is expected. Install it into the current beyin environment with:
beyin check-deps --fix
之后,重新运行您的 beyin build ... 命令。
After that, rerun your
beyin build ...command.
首次运行时的流程:
- beyin 会启动一个引导式设置流程 (beyin starts a guided setup flow)
- 设置完成后,如果您还没有任何知识包,beyin 会显示一个开始屏幕,您可以在其中创建新知识包或导入现有知识包 (after setup, if you do not have any packs yet, beyin shows a start screen where you can create a new pack or import an existing one)
- 如果设置已完成且没有可用的知识包,则会显示相同的开始屏幕 (if setup is already complete and no packs are available, that same start screen is shown)
常见问题(FAQ)
Beyin 如何确保我的数据隐私和安全?
Beyin 采用本地优先架构,所有知识包的处理、嵌入和存储均在您的本地机器上完成,数据不会上传到云端,确保完全私密和安全。
Beyin 支持哪些类型的文件或内容源?
支持 YouTube 视频/播放列表、播客、PDF、文章以及本地文件等多种源类型,并能转录音频视频内容进行检索。
如何将 Beyin 与我的 AI 工具(如 Claude Code)集成使用?
通过 MCP 协议连接,只需一条命令即可将 Beyin 集成到 MCP 兼容的 AI 代理中,之后可直接通过对话管理知识包和查询。
版权与免责声明:本文仅用于信息分享与交流,不构成任何形式的法律、投资、医疗或其他专业建议,也不构成对任何结果的承诺或保证。
文中提及的商标、品牌、Logo、产品名称及相关图片/素材,其权利归各自合法权利人所有。本站内容可能基于公开资料整理,亦可能使用 AI 辅助生成或润色;我们尽力确保准确与合规,但不保证完整性、时效性与适用性,请读者自行甄别并以官方信息为准。
若本文内容或素材涉嫌侵权、隐私不当或存在错误,请相关权利人/当事人联系本站,我们将及时核实并采取删除、修正或下架等处理措施。 也请勿在评论或联系信息中提交身份证号、手机号、住址等个人敏感信息。