slug: obsidian-mcp descriptionMarkdown: 一个允许AI助手通过标准化接口读取、写入和操作您Obsidian vault中笔记的模型上下文协议服务器。 中文名:黑曜石-MCP协议服务器
一种模型上下文协议服务器,它通过标准化接口使AI助手能够读取、写入和操作您Obsidian保险库中的笔记。
MCP 服务配置
复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用
{
"mcpServers": {
"Obsidian": {
"args": [
"/Users/\u003cYour Own Path\u003e/obsisian-mcp/build/index.js"
],
"command": "node",
"env": {
"apiKey": "\u003cYour API Token\u003e",
"host": "127.0.0.1",
"port": "27123"
}
}
}
}
该服务需要配置环境变量:apiKey、host、port
服务介绍
Obsidian MCP (Model Context Protocol)
Obsidian MCP 是一个工具,它允许你通过 Model Context Protocol 与你的 Obsidian 仓库进行交互。这使得 AI 助手能够通过标准化的接口读取、写入和操作你 Obsidian 仓库中的笔记。
前提条件
- Node.js 18 或更高版本
- 安装并配置了 Local REST API 插件 的 Obsidian
- 从 Local REST API 插件生成的 API 密钥
设置 MCP 服务器(例如 Claude 桌面应用程序)
-
克隆此仓库
-
安装依赖项:
npm install -
构建项目:
npm run build -
配置 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": "要插入的内容" } -
searchWithJsonLogic - 使用 JsonLogic 格式查询搜索 Obsidian 笔记
{ "query": { // JsonLogic 查询对象 } }