loydmilligan/MCPforObsidian
If you are the rightful owner of MCPforObsidian and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
This project provides a Model Context Protocol (MCP) server for interacting with your Obsidian vault using the Obsidian Local REST API plugin.
/tools/list_files
A tool to list all markdown files.
/tools/read_file
Reads the content of a specific file.
/tools/write_file
Writes content to a specific file.
MCP for Obsidian
This project provides a Model Context Protocol (MCP) server for interacting with your Obsidian vault. It uses the Obsidian Local REST API plugin to connect to your vault and expose its contents as resources and tools.
Prerequisites
- Obsidian: You must have Obsidian installed.
- Obsidian Local REST API Plugin: You need to install and enable this plugin in your Obsidian vault. You can find it in the community plugins browser or install it manually from its GitHub repository.
- Python 3.9+
- Poetry: This project uses Poetry for dependency management. You can find installation instructions here.
Setup
-
Clone the repository:
git clone <repository-url> cd obsidian-mcp-server
-
Install dependencies:
poetry install
-
Configure Environment Variables:
Make a copy of the
.env.example
file and name it.env
.cp .env.example .env
-
Open the
.env
file and fill in the following values:OBSIDIAN_API_KEY=<Your API key from the Obsidian Local REST API plugin settings> OBSIDIAN_VAULT_NAME=<The name of your Obsidian vault>
Running the Server
To start the MCP server, run the following command from the project's root directory:
poetry run uvicorn main:app --reload
The server will be running at http://127.0.0.1:8000
. You can access the API documentation at http://127.0.0.1:8000/docs
.
Resources and Tools
The server exposes the following resources and tools as defined in main.py
. You can extend this file to add more functionality.
Resources
/files
: Lists all markdown files in the vault./tags
: Lists all tags in the vault.- ...and others as defined in the requirements.
Tools
/tools/list_files
: A tool to list all markdown files./tools/read_file
: Reads the content of a specific file./tools/write_file
: Writes content to a specific file.- ...and others.