
markuspfundstein/mcp-obsidian
Productivity workflowこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
Obsidian REST APIコミュニティプラグインを介してObsidianと連携するMCPサーバー
概要
ローカルREST APIコミュニティプラグインを通じてObsidianと連携するためのMCPサーバー。 サーバーはObsidianとやり取りするための複数のツールを実装しています: - list_files_in_vault:Obsidian Vaultのルートディレクトリにあるすべてのファイルとディレクトリを一覧表示 - list_files_in_dir:特定のObsidianディレクトリ内のすべてのファイルとディレクトリを一覧表示 - get_file_contents:Vault 内の単一のファイルの内容を返します。- 検索:Vault 内のすべてのファイルで指定されたテキストクエリに一致する文書を検索 - patch_content:見出し、ブロック参照、フロントマターフィールドに関連した既存のメモにコンテンツを挿入します。- append_content:Vault 内の新規または既存のファイルに内容を追加します。- delete_file:Vault からファイルやディレクトリを削除します。 まずはクロードにObsidianを使うように指示するのが良いです。そうすれば必ずツールを呼び出します。
概要(AI 翻訳)
ローカルREST APIコミュニティプラグインを通じてObsidianと連携するためのMCPサーバー。
構成要素
道具
サーバーはObsidianとやり取りするための複数のツールを実装しています:
- list_files_in_vault:Obsidian Vaultのルートディレクトリにあるすべてのファイルとディレクトリを一覧表示します
- list_files_in_dir:特定のObsidianディレクトリ内のすべてのファイルとディレクトリを一覧化
- get_file_contents:自分の金庫にある単一のファイルの内容を返却します。
- 検索:指定されたテキストクエリに一致する文書を、ボールト内のすべてのファイルで検索します
- patch_content:既存のノートに見出し、ブロック参照、フロントマターフィールドに関連して内容を挿入します。
- append_content:ボールト内の新規または既存のファイルにコンテンツを追加します。
- delete_file: ボールトからファイルやディレクトリを削除します。
例示プロンプト
まずはクロードにObsidianを使うように指示するのが良いです。そうすれば必ずツールを呼び出します。
使用プロンプトは以下の通りです:
- 最後のアーキテクチャコールノートの内容を取得し、それを要約する
- Azure CosmosDbが言及されているすべてのファイルを検索し、その文脈を素早く説明してください
- 直近の会議ノートを要約し、新しいノート「summary meeting.md」にまとめる。
このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。
README
以下は原文 README の抜粋です。原文を見る。
MCP server for Obsidian
MCP server to interact with Obsidian via the Local REST API community plugin.
Components
Tools
The server implements multiple tools to interact with Obsidian:
- list_files_in_vault: Lists all files and directories in the root directory of your Obsidian vault
- list_files_in_dir: Lists all files and directories in a specific Obsidian directory
- get_file_contents: Return the content of a single file in your vault.
- search: Search for documents matching a specified text query across all files in the vault
- patch_content: Insert content into an existing note relative to a heading, block reference, or frontmatter field.
- append_content: Append content to a new or existing file in the vault.
- delete_file: Delete a file or directory from your vault.
Example prompts
Its good to first instruct Claude to use Obsidian. Then it will always call the tool.
The use prompts like this:
- Get the contents of the last architecture call note and summarize them
- Search for all files where Azure CosmosDb is mentioned and quickly explain to me the context in which it is mentioned
- Summarize the last meeting notes and put them into a new note ‘summary meeting.md’. Add an introduction so that I can send it via email.
Requirements
- Python >= 3.11
mcpPython SDK>=1.1.0,=2.0will crash at import withAttributeError: 'Server' object has no attribute 'list_tools'.
Configuration
Obsidian REST API Key
There are two ways to configure the environment with the Obsidian REST API Key.
- Add to server config (preferred)
{
"mcp-obsidian": {
"command": "uvx",
"args": [
"mcp-obsidian"
],
"env": {
"OBSIDIAN_API_KEY": "",
"OBSIDIAN_HOST": "",
"OBSIDIAN_PORT": ""
}
}
}
Sometimes Claude has issues detecting the location of uv / uvx. You can use which uvx to find and paste the full path in above config in such cases.
- Create a
.envfile in the working directory with the following required variables:
OBSIDIAN_API_KEY=your_api_key_here
OBSIDIAN_HOST=your_obsidian_host
OBSIDIAN_PORT=your_obsidian_port
Note:
- You can find the API key in the Obsidian plugin config
- Default port is 27124 if not specified
- Default host is 127.0.0.1 if not specified
Quickstart
Install
Obsidian REST API
You need the Obsidian REST API community plugin running: https://github.com/coddingtonbear/obsidian-local-rest-api
インストール
uvx mcp-obsidian設定
{
"mcpServers": {
"mcp-obsidian": {
"command": "uv",
"args": [
"--directory",
"<dir_to>/mcp-obsidian",
"run",
"mcp-obsidian"
],
"env": {
"OBSIDIAN_API_KEY": "<your_api_key_here>",
"OBSIDIAN_HOST": "<your_obsidian_host>",
"OBSIDIAN_PORT": "<your_obsidian_port>"
}
}
}
}