Obsidian MCP Server
Enables AI assistants to search, read, and append content to notes in an Obsidian vault via the MCP protocol.
README
Obsidian MCP Server Plugin
Project Overview
This is an Obsidian plugin that functions as an MCP (Model Context Protocol) server, enabling Claude Desktop and other AI assistants to interact directly with an Obsidian vault. It provides a bridge between the MCP protocol (used by Claude Desktop) and the Obsidian API.
Author: Bas van Laarhoven / Sensei Bas License: MIT Version: 1.0.0
Architecture
High-Level Design
Claude Desktop (stdio)
↓
stdio-bridge.js (converts stdio ↔ HTTP)
↓
MCP Server (HTTP on localhost:3000)
↓
Obsidian API (vault access)
Why HTTP Instead of stdio?
Obsidian runs in Electron, which doesn't have direct stdio access. This plugin runs an HTTP server locally (localhost:3000) and uses a stdio bridge (stdio-bridge.js) to convert between:
- Claude Desktop's stdio-based MCP protocol
- This plugin's HTTP-based implementation
This architecture is security-conscious: the HTTP server only listens on localhost, preventing external network access.
Core Components
1. MCP Server (src/mcp-server.ts)
The main server class that:
- Runs an HTTP server on port 3000 (localhost only)
- Implements MCP protocol over JSON-RPC 2.0
- Handles three core MCP methods:
initialize- Protocol handshaketools/list- Returns available toolstools/call- Executes a tool
Key Implementation Details:
- Uses Electron's built-in
httpmodule (not Node's) - CORS enabled for localhost
- All requests are POST (OPTIONS for CORS preflight)
- Notifications (methods starting with
notifications/) are acknowledged but not processed
2. Available Tools
The plugin provides four tools for vault interaction:
search_notes
Location: src/tools/search-notes.ts
Purpose: Search vault notes by query text
Parameters:
query(required): Search text (searches titles and content)folder(optional): Filter by folder pathtag(optional): Filter by tag (without #)limit(optional): Max results (default: 10)
Returns: JSON array of matching notes with snippets
get_note
Location: src/tools/get-note.ts
Purpose: Read a specific note's full content and metadata
Parameters:
path(required): Vault path to note
Returns: Note content, metadata, frontmatter, tags, links
Important: Use search_notes first to find the correct path, then use get_note to read the full content.
get_related_notes
Location: src/tools/get-related-notes.ts
Purpose: Find notes related to a specific note
Parameters:
path(required): Vault path to note
Returns:
- Outgoing links (notes this note links to)
- Incoming links/backlinks (notes that link to this note)
Note: Returns only paths - use get_note to read full content of related notes.
append_to_note
Location: src/tools/append-to-note.ts
Purpose: Append content to the end of an existing note
Parameters:
path(required): Vault path to notecontent(required): Markdown content to append
Returns: Success message
Use Cases: Adding new information, logging, extending notes without replacing content
3. Plugin Entry Point (main.ts)
The main Obsidian plugin class that:
- Loads/unloads the plugin
- Starts/stops the MCP server
- Integrates with Obsidian's plugin system
4. stdio Bridge (stdio-bridge.js)
Standalone Node.js script that:
- Reads JSON-RPC from stdin (from Claude Desktop)
- Forwards to HTTP server (this plugin)
- Sends HTTP responses back to stdout
- Handles initialization and tool calls
Development Guide
Build Commands
npm install # Install dependencies
npm run dev # Watch mode (rebuilds on changes)
npm run build # Production build
Project Structure
.
├── src/
│ ├── mcp-server.ts # Main MCP server implementation
│ ├── types.ts # TypeScript types
│ └── tools/
│ ├── search-notes.ts # Search functionality
│ ├── get-note.ts # Note reading
│ ├── get-related-notes.ts # Link traversal
│ └── append-to-note.ts # Note appending
├── main.ts # Obsidian plugin entry point
├── stdio-bridge.js # Claude Desktop bridge
├── manifest.json # Plugin manifest
└── package.json # Dependencies
Key Dependencies
obsidian- Obsidian API typesesbuild- Build tooltypescript- Language- Built-in Node.js
httpmodule (via Electron)
Testing
node test-connection.js # Test HTTP server directly
node test-mcp.js # Test MCP protocol
Protocol Details
MCP (Model Context Protocol)
This plugin implements MCP 2024-11-05 protocol version over JSON-RPC 2.0.
Supported Methods:
initialize- Handshake, returns capabilitiestools/list- Returns tool definitions with JSON schemastools/call- Executes a tool with arguments
Tool Response Format:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"content": [
{
"type": "text",
"text": "Tool result as string"
}
]
}
}
Error Handling
Standard JSON-RPC error codes:
-32601- Method not found-32603- Internal error / tool execution failed
Configuration
Claude Desktop Setup
Windows:
{
"mcpServers": {
"obsidian-vault": {
"command": "node",
"args": [
"C:\\Path\\To\\Vault\\.obsidian\\plugins\\mcp-server\\stdio-bridge.js"
]
}
}
}
macOS/Linux:
{
"mcpServers": {
"obsidian-vault": {
"command": "node",
"args": [
"/path/to/vault/.obsidian/plugins/mcp-server/stdio-bridge.js"
]
}
}
}
Common Patterns
Searching for Notes
- Use
search_noteswith a query - Optionally filter by folder or tag
- Get list of matching notes with paths
Reading Note Content
- Use
search_notesto find the note path - Use
get_notewith the exact path to read full content
Exploring Related Notes
- Use
get_related_notesto find linked notes - Use
get_noteon each related path to read content - Recursively explore to build a knowledge graph
Adding to Notes
- Use
search_notesorget_noteto verify note exists - Use
append_to_noteto add content to the end
Security Considerations
- HTTP server only listens on
localhost(127.0.0.1) - No external network access
- No authentication required (assumes trusted local environment)
- CORS enabled only for localhost
Troubleshooting
Server won't start
- Check if port 3000 is already in use
- Check Obsidian Developer Console (Ctrl+Shift+I)
Claude Desktop can't connect
- Verify Obsidian is running
- Verify plugin is enabled in Obsidian settings
- Check path in
claude_desktop_config.jsonis correct - Restart Claude Desktop completely
Tool calls fail
- Check Obsidian console for error messages
- Verify note paths are correct (case-sensitive)
- Ensure notes exist before reading
Future Enhancement Ideas
Based on findings.md, potential features to add:
- Bases Query Execution - Execute Dataview queries, return results
- Plugin Integration - List installed plugins, access their data
- Note Creation - Create new notes (currently only append)
- Note Modification - Edit existing content (not just append)
- File Operations - Move, rename, delete notes
- Graph Analysis - Advanced link graph queries
- Canvas Integration - Read/modify canvas files
References
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.