The Obsidian Semantic MCP Server is an AI-optimized interface that consolidates 21+ Obsidian tools into 5 semantic operations, offering:
Vault Operations:
list
,read
,create
,update
,delete
,search
, andfragments
for managing files and retrieving relevant content sections to conserve tokens.Smart Editing: Precise content modification with
window
(fuzzy-matched replacements),append
,patch
(for structured edits),at_line
, andfrom_buffer
(for edit recovery).Content Viewing: Navigate notes with
file
,window
,active
, andopen_in_obsidian
actions with support for highlighting and centering.Workflow Guidance: Get contextual
suggestions
andanalyze
actions to guide your next steps.System Operations: Access
info
,commands
, andfetch_web
for retrieving web content.
The server includes state tracking to prevent invalid operations, error recovery with intelligent hints, and configurable fragment retrieval strategies (adaptive
, proximity
, semantic
).
Provides a semantic interface for Obsidian note-taking, offering file and folder operations, content editing with fuzzy matching, viewing and navigation, workflow suggestions, and system operations. Enables working with vault files, editing content, following links, and managing notes with intelligent context-aware workflows.
Obsidian Semantic MCP Server
š Exciting News! We've taken everything we learned from this project and created something even better! Check out the new Obsidian MCP Plugin - a native Obsidian plugin that runs directly inside your vault with improved performance, simplified setup, and enhanced features. We encourage you to try it out!
A semantic, AI-optimized MCP server for Obsidian that consolidates 20 tools into 5 intelligent operations with contextual workflow hints.
š Try Our New Native Plugin!
This MCP server taught us valuable lessons about AI integration with Obsidian. We've applied these insights to create the Obsidian MCP Plugin, which offers:
Native Integration: Runs directly inside Obsidian (no external dependencies!)
Better Performance: Direct vault access without REST API overhead
Easier Setup: Install like any Obsidian plugin - no API keys or external servers
Enhanced Features: Full access to Obsidian's internal APIs and search capabilities
Improved Reliability: No more connection issues or timeouts
š Get the Obsidian MCP Plugin
Prerequisites
Obsidian installed on your computer
Local REST API plugin installed in your Obsidian vault
Claude Desktop app
Installation
Or use directly with npx (recommended):
View on npm: https://www.npmjs.com/package/obsidian-semantic-mcp
Quick Start
Install the Obsidian Plugin:
Open Obsidian Settings ā Community Plugins
Browse and search for "Local REST API"
Install the Local REST API plugin by Adam Coddington
Enable the plugin
In the plugin settings, copy your API key (you'll need this for configuration)
Configure Claude Desktop:
The npx command is automatically used in the Claude Desktop configuration. Add this to your Claude Desktop config (usually found at
~/Library/Application Support/Claude/claude_desktop_config.json
on macOS):{ "mcpServers": { "obsidian": { "command": "npx", "args": ["-y", "obsidian-semantic-mcp"], "env": { "OBSIDIAN_API_KEY": "your-api-key-here", "OBSIDIAN_API_URL": "https://127.0.0.1:27124", "OBSIDIAN_VAULT_NAME": "your-vault-name" } } } }
Features
This server consolidates traditional MCP tools into an AI-optimized semantic interface that makes it easier for AI agents to understand and use Obsidian operations effectively.
Key Benefits
Simplified Interface: 5 semantic operations instead of 21+ individual tools
Contextual Workflows: Intelligent hints guide AI agents to the next logical action
State Tracking: Token-based system prevents invalid operations
Error Recovery: Smart recovery hints when operations fail
Fuzzy Matching: Resilient text editing that handles minor variations
Fragment Retrieval: Automatically returns relevant sections from large files to conserve tokens
Why Semantic Operations?
Traditional MCP servers expose many granular tools (20+), which can overwhelm AI agents and lead to inefficient tool selection. Our semantic approach:
Consolidates 20 tools into 5 semantic operations based on intent
Provides contextual workflow hints to guide next actions
Tracks state with tokens (inspired by Petri nets) to prevent nonsensical suggestions
Offers recovery hints when operations fail
The 5 Semantic Operations
vault
- File and folder operationsActions:
list
,read
,create
,update
,delete
,search
,fragments
edit
- Smart content editingActions:
window
(fuzzy match),append
,patch
,at_line
,from_buffer
view
- Content viewing and navigationActions:
window
(with context),open_in_obsidian
workflow
- Get guided suggestionsActions:
suggest
system
- System operationsActions:
info
,commands
,fetch_web
Note:
fetch_web
fetches and converts web content to markdown (uses onlyurl
parameter)
Example Usage
Instead of choosing between get_vault_file
, get_active_file
, read_file_content
, etc., you simply use:
The response includes intelligent workflow hints:
State-Aware Suggestions
The system tracks context tokens to provide relevant suggestions:
After reading a file with
[[links]]
, it suggests following themAfter a failed edit, it offers buffer recovery options
After searching, it suggests refining or reading results
Advanced Features
Content Buffering
The window
edit action automatically buffers your new content before attempting the edit. If the edit fails or you want to refine it, you can retrieve from buffer:
Fuzzy Window Editing
The semantic editor uses fuzzy matching to find and replace content:
Smart PATCH Operations
Target specific document structures:
Fragment Retrieval for Large Documents
The system automatically uses intelligent fragment retrieval when reading files, significantly reducing token consumption while maintaining relevance:
Returns relevant fragments instead of the entire file:
Fragment Search Strategies:
adaptive - TF-IDF keyword matching (default for short queries)
proximity - Finds fragments where query terms appear close together
semantic - Chunks documents into meaningful sections
You can explicitly search for fragments across your vault:
To retrieve the full file (when needed), use:
Workflow Examples
Daily Note Workflow
Create today's note ā 2. Add template ā 3. Link yesterday's note
Research Workflow
Search topic ā 2. Read results ā 3. Create synthesis note ā 4. Link sources
Refactoring Workflow
Find all mentions ā 2. Update links ā 3. Rename/merge notes
Configuration
The semantic workflow hints are defined in src/config/workflows.json
and can be customized for your workflow preferences.
Fragment Retrieval Configuration
The fragment retrieval system automatically activates when reading files to conserve tokens. You can control this behavior:
Default behavior: Returns up to 5 relevant fragments when reading files
Full file access: Use
returnFullFile: true
parameter to get complete contentStrategy selection: The system auto-selects based on query length, or you can specify:
adaptive
for keyword matching (1-2 word queries)proximity
for finding related terms together (3-5 word queries)semantic
for conceptual chunking (longer queries)
Error Recovery
When operations fail, the semantic interface provides intelligent recovery hints:
Environment Variables
The server automatically loads environment variables from a .env
file if present. Variables can be set in order of precedence:
Existing environment variables (highest priority)
.env
file in current working directory.env
file in the server directory
Required variables:
OBSIDIAN_API_KEY
- Your API key from the Local REST API plugin
Optional variables:
OBSIDIAN_API_URL
- API URL (default: https://localhost:27124)Supports both HTTP (port 27123) and HTTPS (port 27124)
HTTPS uses self-signed certificates which are automatically accepted
OBSIDIAN_VAULT_NAME
- Vault name for context
Example .env
file:
PATCH Operations
The PATCH operations (patch_active_file
and patch_vault_file
) allow sophisticated content manipulation:
Target Types:
heading
: Target content under specific headings using paths like "Heading 1::Subheading"block
: Target specific block referencesfrontmatter
: Target frontmatter fields
Operations:
append
: Add content after the targetprepend
: Add content before the targetreplace
: Replace the target content
Example: Append content under a specific heading:
Development
Architecture
The semantic system consists of:
Semantic Router (
src/semantic/router.ts
) - Routes operations to handlersState Tokens (
src/semantic/state-tokens.ts
) - Tracks context stateWorkflow Config (
src/config/workflows.json
) - Defines hints and suggestionsCore Utilities (
src/utils/
) - Shared functionality like file reading and fuzzy matching
Testing
The project includes comprehensive Jest tests for the semantic system:
Known Issues
Search functionality: The search operation may occasionally timeout on large vaults due to API limitations in the Obsidian Local REST API plugin.
Contributing
Contributions are welcome! Areas of interest:
Additional workflow patterns in
workflows.json
New semantic operations
Enhanced state tracking
Integration with Obsidian plugins
License
MIT
local-only server
The server can only run on the client's local machine because it depends on local resources.
A server that consolidates 21+ Obsidian tools into 5 intelligent operations (vault, edit, view, workflow, system) with contextual workflow hints to help AI agents effectively interact with Obsidian.
Related MCP Servers
- -securityAlicense-qualityEnables AI assistants to interact with Obsidian vaults, providing tools for reading, creating, editing and managing notes and tags.Last updated -228545MIT License
- -securityAlicense-qualityProvides a standardized interface for AI assistants to interact with Obsidian vaults through a local REST API, enabling reading, writing, searching, and managing notes.Last updated -58MIT License
- -securityFlicense-qualityA lightweight server that enables AI assistants like Cursor & Claude to read from and write to Obsidian vaults, allowing actions like creating notes, checking existing content, and managing todos through natural language.Last updated -20917
- -securityAlicense-qualityProvides an MCP server that allows AI assistants to interact with Obsidian vaults, enabling reading/writing notes, managing metadata, searching content, and working with daily notes.Last updated -28MIT License