MCP Obsidian

by gregkonush
Verified
MIT License
1,801
1

Integrations

  • Allows AI assistants to read, create, and manipulate notes in Obsidian vaults, with capabilities for reading active files, deleting files, inserting content at specific positions, appending content, opening files, listing vault files, and searching through notes.

MCP 黑曜石

用于与Obsidian集成的模型上下文协议 (MCP)的服务器实现。这允许 AI 助手读取、创建和操作 Obsidian 库中的笔记。

特征

  • 读取 Obsidian 中的活动文件
  • 删除活动文件
  • 在特定位置插入内容(标题、块引用、前言)
  • 将内容附加到文件
  • 打开特定文件
  • 列出保管库中的文件
  • 搜索你的笔记

先决条件

  • Bun运行时
  • Obsidian桌面应用程序
  • 兼容MCP的AI助手

添加到光标

将您的机密放入 .env 文件中

选择命令 MCP 然后输入此命令

bun __REPO_PATH__/src/index.ts

安装

  1. 克隆此存储库:
    git clone https://github.com/gregkonush/mcp-obsidian.git cd mcp-obsidian
  2. 安装依赖项:
    bun install
  3. 复制示例环境文件并进行配置:
    cp .env.example .env

配置

使用您的特定配置编辑.env文件:

OBSIDIAN_BASE_URL=http://localhost:27123 OBSIDIAN_TOKEN=your_token_here DEBUG=false

用法

启动 MCP 服务器:

bun run src/index.ts

服务器将启动并通过标准 I/O 与 MCP 兼容的 AI 助手进行通信。

可用工具

此实现为AI助手提供了以下工具:

  • get_active_file - 返回当前活动文件的内容
  • delete_active_file - 删除当前活动文件
  • insert_active_file - 修改相对于标题、块引用或前置字段的内容
  • append_active_file - 将内容附加到活动文件的末尾
  • open_file - 在 Obsidian 中打开特定文件
  • search_simple - 搜索与文本查询匹配的文档
  • list_files - 列出你的 Vault 根目录中的文件
  • list_directory_files - 列出保管库特定目录中的文件

发展

项目结构

mcp-obsidian/ ├── src/ │ ├── index.ts # Main server implementation │ └── tools/ # Individual tool implementations │ ├── get-active-file.ts │ ├── delete-active-file.ts │ └── ... ├── .env # Environment configuration ├── package.json # Project dependencies └── tsconfig.json # TypeScript configuration

添加新工具

要添加新工具:

  1. src/tools/目录中创建一个新文件
  2. 使用 MCP SDK 实现该工具
  3. src/index.ts中导入并注册该工具

执照

该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅LICENSE.md文件。

贡献

欢迎贡献代码!欢迎提交 Pull 请求。

-
security - not tested
A
license - permissive license
-
quality - not tested

一种服务器实现,允许 AI 助手通过模型上下文协议读取、创建和操作 Obsidian 保险库中的注释。

  1. Features
    1. Prerequisites
      1. Add to cursor
        1. Installation
          1. Configuration
            1. Usage
              1. Available Tools
                1. Development
                  1. Project Structure
                  2. Adding New Tools
                2. License
                  1. Contributing
                    ID: 4jgajfksuj