obsidian-codex-mcp

obsidian-codex-mcp

Local-first MCP server for working with an Obsidian vault. No API key required

Category
访问服务器

README

Obsidian Codex MCP

CI Python MCP Obsidian Codex Local first License: MIT

Local-first MCP server for working with an Obsidian vault.

  • No Obsidian plugin required
  • No API key required
  • No cloud service required
  • No Obsidian running in the background

This is for people who want MCP clients to work directly with markdown files on disk.

Independent open-source project. Not affiliated with Obsidian, Anthropic, OpenAI, or any MCP client.

What it does

It lets MCP clients work with your vault to:

  • read and search notes
  • create and update notes
  • generate summaries, status reports, and release notes
  • automate local knowledge workflows

All directly against your local markdown files.

Best for

  • Codex users who want safe local access to an Obsidian vault
  • Claude Desktop, Cline, Cursor, and other MCP clients that can run a local Python server
  • Developers who prefer filesystem-based Obsidian automation over the Local REST API plugin
  • Personal knowledge bases, project logs, daily notes, task notes, and markdown-first workflows

Why this exists

There are already a handful of Obsidian MCP servers. Many depend on the Obsidian Local REST API plugin or run as an Obsidian plugin. This project is intentionally simpler:

  • direct filesystem access to a local vault
  • no network calls
  • no Obsidian API token
  • Codex-friendly TOML configuration
  • tolerant of real-world vaults with imperfect frontmatter
  • path traversal protection so tools cannot escape the configured vault
  • optional read-only mode for safer review/search workflows
  • optional backup-on-write before updates and deletes

How it compares

Need This project
Use Obsidian with Codex Yes, with ~/.codex/config.toml examples
Use Obsidian with Claude Desktop Yes, with JSON config examples
Require an Obsidian plugin No
Require an API key No
Require Obsidian to be open No
Read/write markdown files directly Yes
Work over a remote HTTP API No, local stdio MCP only

Safety features

Designed to be useful without being reckless:

  • read-only mode, which refuses writes
  • backup-on-write mode before updates and deletes
  • vault path isolation
  • path traversal protection
  • no external network calls

Tools

  • configure_vault - set or change the vault path
  • get_note - read one markdown note by vault-relative path
  • create_note - create a new markdown note with optional metadata
  • update_note - update note content and/or frontmatter
  • delete_note - delete a markdown note
  • list_notes - list notes in the vault or a folder
  • search_notes - search note title, content, and tags
  • get_all_tags - list unique tags from frontmatter and inline tags
  • get_backlinks - find notes that link to a note
  • get_note_links - extract wikilinks from a note
  • create_folder - create a folder inside the vault
  • get_folder_structure - return the vault folder tree

Demo

Short launch clip:

Obsidian + MCP + Codex demo

Useful follow-up demos to record:

  • AI edits a note in the vault, then Obsidian shows the result
  • read-only and backup-on-write behavior

Quick start

Install

Requirements:

  • Python 3.10 or newer recommended
  • An Obsidian vault stored as local markdown files
git clone https://github.com/dot-RealityTest/obsidian-codex-mcp.git
cd obsidian-codex-mcp
python3 -m venv .venv
.venv/bin/python -m pip install --upgrade pip
.venv/bin/python -m pip install -r requirements.txt

Verify against your vault:

OBSIDIAN_VAULT_PATH="/absolute/path/to/your/vault" .venv/bin/python test_server.py

Codex configuration

Add this to ~/.codex/config.toml and restart Codex:

[mcp_servers.obsidian]
command = "/absolute/path/to/obsidian-codex-mcp/.venv/bin/python"
args = ["/absolute/path/to/obsidian-codex-mcp/server.py"]
enabled = true

[mcp_servers.obsidian.env]
OBSIDIAN_VAULT_PATH = "/absolute/path/to/your/obsidian-vault"
OBSIDIAN_READ_ONLY = "false"
OBSIDIAN_BACKUP_ON_WRITE = "true"

For a safer read/search-only setup:

OBSIDIAN_READ_ONLY = "true"

Claude Desktop configuration

Add this to claude_desktop_config.json:

{
  "mcpServers": {
    "obsidian": {
      "command": "/absolute/path/to/obsidian-codex-mcp/.venv/bin/python",
      "args": ["/absolute/path/to/obsidian-codex-mcp/server.py"],
      "env": {
        "OBSIDIAN_VAULT_PATH": "/absolute/path/to/your/obsidian-vault",
        "OBSIDIAN_READ_ONLY": "false",
        "OBSIDIAN_BACKUP_ON_WRITE": "true"
      }
    }
  }
}

Environment

Variable Required Default Description
OBSIDIAN_VAULT_PATH yes none Absolute path to the vault folder.
OBSIDIAN_READ_ONLY no false When true, create/update/delete/folder creation tools refuse writes.
OBSIDIAN_BACKUP_ON_WRITE no false When true, copies existing notes into .obsidian-mcp-backups/ before update/delete.

Safety model

  • All note paths are resolved relative to OBSIDIAN_VAULT_PATH.
  • Absolute paths and ../ path traversal are rejected.
  • Writes can be disabled with OBSIDIAN_READ_ONLY=true.
  • Existing notes can be copied to .obsidian-mcp-backups/ before update/delete with OBSIDIAN_BACKUP_ON_WRITE=true.
  • Only markdown notes can be deleted.
  • The server makes no external network calls.
  • Broken YAML frontmatter does not break listing/search; the note is still readable with empty metadata.

Development

Run the local test script:

OBSIDIAN_VAULT_PATH="/absolute/path/to/your/vault" .venv/bin/python test_server.py

Start the MCP server:

OBSIDIAN_VAULT_PATH="/absolute/path/to/your/vault" .venv/bin/python server.py

Optional automation

Generate a daily project status report from your vault:

OBSIDIAN_VAULT_PATH="/absolute/path/to/your/vault" .venv/bin/python scripts/daily_status_report.py --folder "Projects"

Write the report back into Obsidian:

OBSIDIAN_VAULT_PATH="/absolute/path/to/your/vault" .venv/bin/python scripts/daily_status_report.py \
  --folder "Projects" \
  --write "Codex/Daily Project Status.md"

The script reports recent notes, markdown checkbox tasks, and top tags. It uses backup-on-write when updating an existing report note.

Common workflows

See docs/common-workflows.md for practical examples:

  • safe vault exploration
  • project catch-up
  • daily status reports
  • release notes after shipping
  • vault triage
  • index note creation
  • finding underlinked notes
  • safe editing checklist

Templates

Copyable Obsidian note templates live in docs/templates:

Optional skill

This repo includes lightweight agent workflow skills:

skills/obsidian-vault-workflow/SKILL.md
skills/release-note-captain/SKILL.md

Use them as guidance for agents that work with this MCP server. They cover safe vault exploration, editing discipline, daily status reports, vault triage, project catch-up prompts, and release-note capture after a project ships.

FAQ

Is this an Obsidian MCP server?

Yes. It is a local MCP server for Obsidian vaults. It exposes tools for notes, tags, backlinks, wikilinks, folders, search, and optional writes.

Does it work with Codex?

Yes. The main setup path is Codex-first and uses ~/.codex/config.toml.

Does it need the Obsidian Local REST API plugin?

No. It reads and writes markdown files directly from the vault folder.

Does Obsidian need to be running?

No. Because this server works on local files, Obsidian does not need to be open.

Can I make it read-only?

Yes. Set OBSIDIAN_READ_ONLY=true to allow search and inspection while refusing create, update, delete, and folder creation tools.

Current limitations

  • Search is simple substring search, not semantic or indexed search.
  • No Obsidian command palette or plugin API access.
  • No conflict resolution for simultaneous edits.
  • No template expansion.
  • No sync-provider awareness.

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选