Skip to main content
Glama

MCP 黑曜石

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

特征

  • 读取 Obsidian 中的活动文件

  • 删除活动文件

  • 在特定位置插入内容(标题、块引用、前言)

  • 将内容附加到文件

  • 打开特定文件

  • 列出保管库中的文件

  • 搜索你的笔记

Related MCP server: Vault Cortex Obsidian MCP Server

先决条件

  • 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 请求。

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    F
    maintenance
    A Model Context Protocol server that enables AI assistants to read, write, and manipulate notes in your Obsidian vault through a standardized interface.
    5
    3,647 npm
    4
    ISC
  • A
    license
    A
    quality
    A
    maintenance
    Standalone MCP server for Obsidian vaults - hybrid search (FTS5 + vector + cross-encoder reranking), images and PDFs in agent-readable form, Kanban-aware tasks (Tasks-plugin + Dataview formats), structured memory with topic recall, fine-grained read/write tools for optimal token efficiency, and link graph support. Run locally, self-host, or one-click deploy for remote access. OAuth 2.1.
    16
    33
    116 npm
    34
    MIT
  • A
    license
    A
    quality
    F
    maintenance
    A Model Context Protocol (MCP) server that provides AI assistants with secure access to Obsidian vaults. Enables reading, writing, searching, and managing notes without requiring Obsidian to be running.
    50
    7,779 npm
    Apache 2.0
  • F
    license
    Not graded
    quality
    C
    maintenance
    MCP server that provides tools and resources for AI models to interact with an Obsidian vault, enabling file operations, search, and management via the Model Context Protocol.
    2
    -