Facilitating integration between Large Language Models and local Knowledge Bases.
The Obsidian Notes Model Context Protocol (MCP) server provides a standardized interface for AI models (such as those utilized in LM Studio, Claude Desktop, and other MCP-compatible clients) to interact with a local Obsidian Vault. This implementation enables AI agents to navigate directory structures, index available notes, and retrieve Markdown content in real-time, effectively extending the model's context with personal knowledge.
- Recursive Vault Indexing: Provides a comprehensive list of all Markdown files and directories within the vault, automatically excluding system directories (e.g.,
.git,.obsidian). - Contextual Content Retrieval: Facilitates the retrieval of full Markdown note content for use as grounding context in LLM prompts.
- Enhanced Security: Implements robust path validation and traversal protection to ensure access is restricted to the designated vault directory.
- Standards-Compliant: Developed using the
fastmcpSDK, ensuring compatibility with the Model Context Protocol.
- Python 3.10 or higher
- An Obsidian Vault or a structured directory of Markdown files.
- An MCP-compatible Client (e.g., LM Studio, Claude Desktop, or MCP Inspector).
-
Clone the Repository:
git clone <repository-url> cd obsidian-notes-server
-
Environment Setup: It is recommended to use a virtual environment for dependency management.
python -m venv venv # Windows venv\Scripts\activate # macOS/Linux source venv/bin/activate pip install -r requirements.txt
The server requires the absolute path to your Obsidian Vault.
- Open
server.py. - Modify the
VAULT_PATHvariable:# Specify the absolute path to your vault VAULT_PATH = r"C:\Path\To\Your\Obsidian Vault"
- Save the modifications.
To verify the server executes correctly within your environment:
python server.pyNote: While MCP servers are typically invoked by client applications, manual execution confirms the environment is correctly configured.
Incorporate the following configuration into your MCP client settings:
{
"mcpServers": {
"obsidian-notes-server": {
"command": "C:/path/to/your/venv/Scripts/python.exe",
"args": [
"C:/path/to/your/repo/server.py"
]
}
}
}For detailed guidance on integrating MCP servers with LM Studio, please refer to the official documentation.
Recursively retrieves all Markdown file paths within the vault.
- Returns: A newline-delimited string of relative file paths.
Retrieves all directory paths within the vault to provide structural context.
- Returns: A newline-delimited string of relative folder paths.
Retrieves the raw text content of a specified note.
- Parameters:
filename: The relative path to the Markdown file.
- Returns: The complete string content of the document.
- Exception Handling: Returns sanitized error messages in the event of missing files or security violations.
- Read-Only Access: The server is restricted to read operations. It does not possess the capability to modify, delete, or create files within the vault.
- Input Validation: The
read_notetool implements strict input sanitization, rejecting any paths containing parent directory references (..) or absolute path indicators to prevent directory traversal attacks.
For a detailed breakdown and comprehensive information regarding the Obsidian Notes MCP Server, please visit: project-breakdown101.web.app