这是 Obsidian 官方的 MCP 服务器吗?
不是。mcp-obsidian 是 Markus Pfundstein(GitHub 用户 MarkusPfundstein)的社区项目,它依赖的 Local REST API 插件同样是社区插件,并非 Obsidian 出品。
@MarkusPfundstein
基本信息
通过 Obsidian REST API 社区插件与 Obsidian 交互的 MCP 服务器
使用下面的配置,将此服务器添加到你的 MCP 客户端。
{
"mcpServers": {
"mcp-obsidian": {
"command": "uvx",
"args": [
"mcp-obsidian"
],
"env": {
"OBSIDIAN_API_KEY": "<your_api_key_here>",
"OBSIDIAN_HOST": "<your_obsidian_host>",
"OBSIDIAN_PORT": "<your_obsidian_port>"
}
}
}
}Lists all files and directories in the root directory of your Obsidian vault
Lists all files and directories in a specific Obsidian directory
Return the content of a single file in your vault.
Search for documents matching a specified text query across all files in the vault
Insert content into an existing note relative to a heading, block reference, or frontmatter field.
Append content to a new or existing file in the vault.
Delete a file or directory from your vault.
这个 Obsidian MCP 服务器(mcp-obsidian,作者 Markus Pfundstein)是一个开源 Python 服务器,借助 Local REST API 社区插件,让 Claude 等 MCP 客户端列出、读取、搜索、写入和删除 Obsidian 仓库(vault)中的笔记。
它是社区项目,并非 Obsidian 官方出品。服务器从不直接读写你的仓库文件,所有操作都通过运行在 Obsidian 应用内的 Obsidian Local REST API 插件完成,因此使用时 Obsidian 必须保持打开。它以 mcp-obsidian 发布在 PyPI 上,采用 MIT 许可证,通过 uvx 运行。
前置条件:
uvx)以及 Python 3.11 或更高版本。环境变量:
OBSIDIAN_API_KEY:Local REST API 插件中的密钥(必填)OBSIDIAN_HOST:默认 127.0.0.1OBSIDIAN_PORT:默认 27124可以在 MCP 服务器配置中设置(推荐),也可以写在工作目录下的 .env 文件中。
在 macOS 上编辑 ~/Library/Application Support/Claude/claude_desktop_config.json,在 Windows 上编辑 %APPDATA%/Claude/claude_desktop_config.json:
{
"mcpServers": {
"mcp-obsidian": {
"command": "uvx",
"args": ["mcp-obsidian"],
"env": {
"OBSIDIAN_API_KEY": "<your_api_key_here>",
"OBSIDIAN_HOST": "127.0.0.1",
"OBSIDIAN_PORT": "27124"
}
}
}
}
如果 Claude 找不到 uvx,运行 which uvx,把完整路径填为 command。
README 只记录了 Claude Desktop。由于这是标准的 stdio 服务器,其他客户端可以用相同的 env 值运行同样的 uvx mcp-obsidian 命令,例如写入 .cursor/mcp.json 或 .vscode/mcp.json。在 Claude Code 中,将其添加为启动 uvx mcp-obsidian 并设置这三个变量的 stdio 服务器即可。
如果不想安装 uv 和 Python,可以把 .env.example 复制为 .env,运行 docker compose build,再让客户端指向容器。MCP 需要连接 stdin 且不能分配 TTY,所以要用 run --rm -T,而不是 up:
{
"mcpServers": {
"mcp-obsidian": {
"command": "docker",
"args": ["compose", "-f", "<dir_to>/mcp-obsidian/docker-compose.yml", "run", "--rm", "-T", "mcp-obsidian"]
}
}
}
在容器中,OBSIDIAN_HOST 默认为 host.docker.internal,以便访问你电脑上的 Obsidian。
当前源码注册了 15 个工具,全部以 obsidian_ 为前缀;mcp.so 页面和 README 列出的是最初的七个。
obsidian_list_files_in_vault、obsidian_list_files_in_dir、obsidian_get_file_contents、obsidian_batch_get_file_contents。obsidian_simple_search(带上下文的文本匹配)、obsidian_complex_search(JsonLogic 查询,例如对路径使用 glob 模式)、obsidian_search_by_tag。obsidian_append_content、obsidian_patch_content(在标题、块或 frontmatter 目标处 append、prepend 或 replace)、obsidian_put_content(替换整个文件)。obsidian_delete_file 需要 confirm: true。obsidian_get_frontmatter、obsidian_get_periodic_note、obsidian_get_recent_periodic_notes、obsidian_get_recent_changes。README 建议先告诉 Claude 使用 Obsidian,这样它会稳定地调用这些工具。
Obsidian 没有官方 MCP 服务器,可选方案都来自社区。mcp-obsidian 通过 Local REST API 插件工作,因此能做到按标题打补丁、支持周期笔记和 JsonLogic 搜索,代价是 Obsidian 必须处于运行状态。把普通的 Filesystem MCP Server 指向仓库文件夹,则无需打开 Obsidian,但它只认识文件,不理解 frontmatter 或周期笔记等 Obsidian 概念。其他笔记应用可参考 Apple Notes MCP 或 Notion MCP Server。
AttributeError: 'Server' object has no attribute 'list_tools':该服务器需要 mcp Python SDK 1.x(>=1.1.0,<2.0.0),装了 mcp>=2.0 就会崩溃,请通过 uvx mcp-obsidian 使用锁定版本的包。uv/uvx,请在配置中填写 which uvx 得到的完整路径。OBSIDIAN_HOST/OBSIDIAN_PORT 与插件一致(默认 127.0.0.1:27124)。docker compose run --rm -T 运行,而不是 docker compose up,因为 MCP 通过 stdin 通信。npx @modelcontextprotocol/inspector uv --directory /path/to/mcp-obsidian run mcp-obsidian),或在 macOS 上 tail ~/Library/Logs/Claude/mcp-server-mcp-obsidian.log。不是。mcp-obsidian 是 Markus Pfundstein(GitHub 用户 MarkusPfundstein)的社区项目,它依赖的 Local REST API 插件同样是社区插件,并非 Obsidian 出品。
免费。它采用 MIT 许可证,Local REST API 插件也是免费的,不需要任何 Obsidian 付费方案。
需要 Obsidian Local REST API 插件生成的 API 密钥,设置为 `OBSIDIAN_API_KEY`,不涉及任何外部服务或云端密钥。
README 只介绍了 Claude Desktop,但任何能启动 stdio 服务器的 MCP 客户端都可以用相同的环境变量运行 `uvx mcp-obsidian`。
需要。服务器与 Local REST API 插件通信,而该插件只有在 Obsidian 打开且插件启用时才会运行。
笔记保留在本地仓库中,服务器通过 `127.0.0.1` 上的插件读取它们;不过 AI 读取到的内容会作为对话的一部分发送给你的模型提供商。
可能会。`obsidian_put_content` 会替换整个文件,`obsidian_delete_file` 会删除文件或文件夹,不过删除需要显式的 `confirm` 参数。重要的仓库请做好备份或使用版本控制。

MCP connector for Snipara, the Project Brain for AI coding agents
Memlord is a remote MCP server available at https://app.memlord.com.

Shared memory for AI coding agents. Claude Code, Cursor and Codex read your project's decisions, lessons and tasks before they act.
Shared, serverless, conflict-free memory for AI agents: a multi-machine drop-in for the MCP memory knowledge graph.
The ultimate RAG for your monorepo. Query, understand, and edit multi-language codebases with the power of AI and knowledge graphs
评论