Skip to main content
Glama
Obsidian MCP Local

Obsidian MCP Local

Obsidian MCP Local

基于 Node.js + TypeScript 的 MCP 本地服务器,用于将您的 Obsidian 库 暴露给 VS Code + GitHub Copilot。

它专为通过 stdio 进行本地使用而设计,专注于在您的库中读取和写入 Markdown 笔记。

安装

npm install -g obsidian-mcp-local

Related MCP server: Obsidian MCP Server

功能

可用工具

  • search_notes(query)

    • 在笔记的路径、Frontmatter 和内容中搜索文本

    • 返回带有简短摘要的排名结果

  • get_note(path)

    • 打开库中的笔记

    • 返回 path、frontmatter 和 content

  • create_note(path, content, overwrite?)

    • 创建新笔记

    • 可选地覆盖现有笔记

  • append_to_note(path, content)

    • 将内容添加到现有笔记的末尾

  • find_by_tag(tag)

    • 按标签查找笔记

    • 支持 Frontmatter 中的 tags 和内容中的内联标签

已实现的规则

  • 仅访问 配置的库内 的文件

  • 忽略以下目录:

    • .obsidian

    • .git

    • node_modules

  • 仅处理 .md 文件

  • 规范化路径以防止访问基础目录之外的文件

项目结构

obsidian-mcp-local/
  package.json
  tsconfig.json
  README.md
  .vscode/
    mcp.example.json
  src/
    index.ts

先决条件

  • Node.js 20+

  • npm

  • 安装了 GitHub Copilot 的 VS Code

  • 本地 Obsidian 库

安装

在项目目录中:

npm install
npm run build

用于开发:

npm run dev

运行编译后的版本:

npm start

如何在 VS Code 中使用

1. 编译项目

npm install
npm run build

2. 调整 VS Code 的 MCP 文件

将 .vscode/mcp.example.json 的内容复制到您将使用 Copilot 的工作区中的 .vscode/mcp.json。

示例: 本地使用:

{
  "servers": {
    "obsidian-local-vault": {
      "type": "stdio",
      "command": "node",
      "args": ["C:/caminho/para/obsidian-mcp-local/dist/index.js"],
      "env": {
        "OBSIDIAN_VAULT_PATH": "D:/Obsidian/Vault"
      }
    }
  }
}

通过 npx 使用(无需本地构建):

{
  "servers": {
    "obsidian-local-vault": {
      "command": "npx",
      "args": ["-y", "obsidian-mcp-local"],
      "env": {
        "OBSIDIAN_VAULT_PATH": "D:/Obsidian/Vault"
      }
    }
  }
}

3. 更新路径

替换:

  • C:/caminho/para/obsidian-mcp-local/dist/index.js

  • D:/Obsidian/Vault

为您的机器上的实际路径。

4. 重启/重新加载 VS Code

之后,Copilot 应该能发现 MCP 服务器。

Copilot Chat 中的使用示例

  • “在我的库中搜索关于 .NET 的笔记”

  • “打开笔记 knowledge/backend/dotnet.md”

  • “在 inbox/ideias-mcp.md 中创建一个笔记,总结我们讨论的内容”

  • “在笔记 daily/2026-04-06.md 的末尾添加文本 - testar MCP local”

  • “查找带有 #arquitetura 标签的笔记”

未来可能的改进

  • append_under_heading

  • [[wikilinks]] 解析

  • get_backlinks(note)

  • 用于快速搜索的 SQLite 索引

  • 写入文件夹白名单 (inbox/, daily/, scratch/)

  • 可配置的特定文件夹写入锁定

重要说明

  • 本项目 不依赖于打开 Obsidian。

  • 它直接对库文件进行操作。

  • 如果您同时在 Obsidian 和 VS Code 中启用写入,则需要自行负责并发控制。

  • 目前该项目假设库是一个本地 Markdown 文件夹。

主文件

实现位于:

  • src/index.ts

许可证

个人使用 / 自定义初始基础。

Available Tools

5 tools
append_to_noteD

Inputs: path (required), content (required).

create_noteD

Inputs: path (required), content (required), overwrite.

find_by_tagD

Inputs: tag (required).

get_noteD

Inputs: path (required).

search_notesD

Inputs: query (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.1/5.0

    Scored across 5 tools

    Disambiguation5/5

    Each tool name clearly indicates a distinct operation: create, get, append, search, and find by tag. No significant overlap is apparent.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern in snake_case (e.g., create_note, search_notes), making the set predictable.

    Tool Count5/5

    Five tools cover essential note operations (create, retrieve, modify, search, tag) without unnecessary bloat or deficiency for the domain.

    Completeness3/5

    The set includes create, read, update (via append), and search operations but lacks a delete operation, which is a notable gap for a complete CRUD surface.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Enables direct file system access to Obsidian vaults with auto-discovery, full-text search, and note operations. Supports reading, writing, and searching across Obsidian notes without requiring plugins or REST API.
      6
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to interact with Obsidian vaults through direct filesystem access, supporting note management, lightning-fast search with SQLite indexing, image analysis, tag/link management, and bulk operations.
      MIT
    • F
      license
      Not graded
      quality
      Not graded
      maintenance
      Enables AI assistants to read, write, search, and navigate Obsidian vault notes with support for CRUD operations, full-text search, graph navigation, daily notes, and frontmatter management.
      3,713 npm
      -
    • A
      license
      A
      quality
      D
      maintenance
      Enables AI assistants to interact with local Obsidian vaults through direct filesystem access for reading, creating, and managing notes. It features high-performance SQLite indexing for fast searches, regex support, and tools for organizing tags and links without requiring additional plugins.
      27
      1
      MIT