Back to MCP directory
publicPublicdnsLocal runtime

obsidian-mcp

Obsidian MCP是一个通过Model Context Protocol与Obsidian知识库交互的工具,支持AI助手读写和操作笔记。

article

README

🚀 Obsidian MCP (模型上下文协议)

Obsidian MCP是一款工具,它允许你通过模型上下文协议与你的Obsidian知识库进行交互。借助标准化接口,该工具能让AI助手读取、写入和操作你Obsidian知识库中的笔记。

🚀 快速开始

🔍 前提条件

  • Node.js 18 或更高版本
  • 安装并配置了 本地REST API插件 的Obsidian
  • 从本地REST API插件生成的API密钥

📦 安装指南

设置MCP服务器(例如Claude桌面应用)

  1. 克隆此仓库。
  2. 安装依赖项:
    npm install
    
  3. 构建项目:
    npm run build
    
  4. 配置Claude桌面应用以使用此MCP服务器:
    {
       "mcpServers": {
         "Obsidian": {
           "command": "node",
           "args": ["/Users/<Your Own Path>/obsisian-mcp/build/index.js"],
           "env": {
             "apiKey": "<Your API Token>",
             "port": "27123",
             "host": "127.0.0.1"
           }
         }
       }
     }
    

💻 使用示例

开发

创建 .env 文件,并按上述说明配置 "apiKey"、"port" 和 "host"。

可用工具

以下是已实现的工具:

基础用法
  • readNote - 读取特定笔记的内容
    {
      "path": "path/to/note.md"
    }
    
  • readActiveNote - 读取当前活动笔记的内容
    {}
    
  • listNotes - 递归列出整个知识库或指定文件夹下的文件和文件夹
    {
      "path": "optional/folder/path"
    }
    
高级用法
  • patchNote - 相对于标题、块引用或前置元数据字段,将内容插入到现有笔记中
    {
      "path": "path/to/note.md",
      "operation": "append|prepend|replace",
      "targetType": "heading|block|frontmatter",
      "target": "target_identifier",
      "content": "content to insert"
    }
    
  • searchWithJsonLogic - 使用JsonLogic格式的查询搜索Obsidian笔记
    {
      "query": {
        // JsonLogic查询对象
      }
    }
    
help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client