- Fix version.ts to use build-time injection instead of runtime package.json reading - Update sync-version.mjs to also sync version.ts file - Eliminate "Could not read version from package.json" warnings - Plugin now correctly displays v0.3.2 instead of fallback v0.2.0 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> |
||
|---|---|---|
| .github/workflows | ||
| src | ||
| tests | ||
| .eslintrc.json | ||
| .gitignore | ||
| ARCHITECTURE.md | ||
| CLAUDE.md | ||
| DEVELOPMENT.md | ||
| esbuild.config.mjs | ||
| jest.config.js | ||
| manifest.json | ||
| package-lock.json | ||
| package.json | ||
| PROJECT-PLAN.md | ||
| README.md | ||
| REQUIREMENTS.md | ||
| styles.css | ||
| sync-version.mjs | ||
| tsconfig.json | ||
| version-bump.mjs | ||
| versions.json | ||
Obsidian MCP Plugin
A semantic MCP (Model Context Protocol) server implemented as an Obsidian plugin, providing AI tools with direct access to your vault through HTTP transport with intelligent semantic operations.
🎉 Current Status: v0.3.0 - Full Semantic Integration Complete!
✅ Working HTTP MCP Transport - Claude Code successfully connects
✅ 5 Semantic Tools Implemented - vault, edit, view, workflow, system
✅ Direct Obsidian API Integration - Maximum performance, no HTTP overhead
✅ Fragment Retrieval System - Advanced content indexing for large files
✅ Workflow Intelligence - AI guidance and suggestions
✅ MCP Resources - Real-time vault metadata via obsidian://vault-info
Quick Start
- Install via BRAT: Add
aaronsb/obsidian-mcp-pluginto BRAT - Enable HTTP Server: Go to plugin settings → Enable HTTP Server
- Connect Claude Code:
claude mcp add obsidian http://localhost:3001/mcp --transport http - Test Connection: Use any semantic tool like
vaultwith actionlist
Architecture Overview
This plugin implements a semantic MCP server that runs natively within Obsidian, providing:
- Direct Obsidian API Integration: No external HTTP calls - direct vault access for maximum performance
- Semantic Operations: Enhanced search with content snippets, intelligent fragment retrieval, and contextual workflows
- HTTP MCP Transport: Claude Code and other AI tools can connect via streamable HTTP MCP protocol
Key Innovation: ObsidianAPI Abstraction Layer
The critical architectural pattern is preserving the existing ObsidianAPI abstraction layer from our semantic MCP server while changing its implementation:
Before (External MCP Server):
MCP Server → ObsidianAPI → HTTP calls → REST API Plugin → Obsidian App
Now (Plugin-Integrated MCP Server):
MCP Server → ObsidianAPI → Direct calls → Obsidian App
This allows us to:
- Reuse all existing semantic MCP logic without modification
- Provide the same Obsidian tools as the MCP+REST approach
- Improve performance by eliminating HTTP overhead
- Access the full Obsidian API - not limited to what the REST API plugin exposes
- Rich plugin ecosystem integration - Dataview, Canvas, community plugins, etc.
Goals & Requirements
Primary Goals
- Native MCP Integration: Run MCP server directly within Obsidian for optimal performance
- Semantic Intelligence: Provide enhanced search, fragment retrieval, and contextual operations
- Direct Vault Access: Eliminate HTTP overhead with direct Obsidian API integration
- HTTP Transport: Support Claude Code's streamable HTTP MCP transport
- Community Ready: Proper plugin structure for BRAT testing and official submission
Technical Requirements
Semantic Tools Available
The plugin provides 5 intelligent semantic tools, each with multiple actions:
🗂️ vault - File and Folder Operations
- list - List files and directories with optional filtering
- read - Read file content with fragment support for large files
- create - Create new files with automatic directory creation
- update - Update existing file content
- delete - Delete files and folders
- search - Enhanced search with content snippets and relevance scoring
- fragments - Advanced fragment retrieval for specific content sections
✏️ edit - Smart Editing Operations
- window - Smart editing with automatic content buffering
- append - Append content to files
- patch - Intelligent patch operations with fuzzy matching
- at_line - Edit content at specific line numbers
- from_buffer - Recover and apply content from edit buffers
👁️ view - Content Viewing and Navigation
- file - View file content with metadata
- window - View content windows with context
- active - Get currently active file information
- open_in_obsidian - Open files in Obsidian interface
🔄 workflow - AI Workflow Guidance
- suggest - Get contextual workflow suggestions and efficiency hints based on current vault state and operation history
⚙️ system - System Operations
- info - Get vault and plugin information
- commands - List and execute Obsidian commands
- fetch_web - Fetch and convert web content to markdown
MCP Resources
obsidian://vault-info- Real-time vault metadata including file counts, active file, plugin status, and timestamps
Technical Implementation Status
Core Functionality ✅ COMPLETE
- ✅ All semantic MCP operations integrated with direct API calls
- ✅ Enhanced search with content snippets and media file discovery
- ✅ Fragment retrieval and intelligent content extraction
- ✅ Workflow hints and contextual suggestions
- ✅ HTTP MCP transport with session management
- ✅ Direct Obsidian plugin API integration
Architecture Requirements
- ✅ Plugin-native implementation (no external processes)
- ✅ Direct Obsidian API integration via
app.vault.*andapp.workspace.* - ✅ HTTP server for REST and MCP protocol endpoints
- ✅ Maintained abstraction layer for code reuse
- ✅ TypeScript implementation with proper types
Performance Requirements
- ✅ Sub-100ms response times for file operations
- ✅ Efficient search with combined API + filename results
- ✅ Memory-efficient fragment retrieval
- ✅ Minimal plugin startup time
Compatibility Requirements
- ✅ Obsidian API version compatibility
- ✅ Cross-platform support (Windows, macOS, Linux)
- ✅ Mobile Obsidian compatibility considerations
- ✅ Plugin ecosystem integration capabilities
Implementation Plan
Phase 1: Foundation (Initial BRAT Release)
-
Fork and Setup
- Fork REST API plugin codebase
- Set up TypeScript build pipeline
- Create proper plugin manifest and structure
-
Direct API Implementation
- Replace
ObsidianAPIHTTP calls with direct vault operations - Implement plugin lifecycle management
- Add error handling for plugin context
- Replace
-
MCP Server Integration
- Embed semantic router and operations
- Add HTTP MCP protocol endpoints
- Preserve existing semantic operations
Phase 2: Enhancement (BRAT Testing)
-
Advanced Features
- Real-time vault change notifications
- Enhanced metadata access (tags, links, frontmatter)
- Plugin ecosystem integration hooks
-
Performance Optimization
- Caching layer for frequently accessed files
- Efficient search indexing
- Memory usage optimization
-
Testing & Iteration
- Community feedback via BRAT
- Performance benchmarking
- API stability testing
Phase 3: Production (Official Submission)
-
Documentation & Polish
- Complete user documentation
- Developer API documentation
- Migration guides from existing setups
-
Official Submission
- Obsidian plugin directory submission
- Community announcement
- Support and maintenance plan
Technical Architecture
Core Components
┌─────────────────────────────────────────────────────────────┐
│ Obsidian MCP Plugin │
├─────────────────────────────────────────────────────────────┤
│ HTTP Server (Express/Fastify) │
│ ├── REST API Endpoints (coddingtonbear compatibility) │
│ └── MCP Protocol Endpoints (streamable) │
├─────────────────────────────────────────────────────────────┤
│ Semantic Operations Layer │
│ ├── Enhanced Search (API + filename + snippets) │
│ ├── Fragment Retrieval │
│ ├── Workflow Hints │
│ └── File Type Detection │
├─────────────────────────────────────────────────────────────┤
│ ObsidianAPI Abstraction Layer (CRITICAL) │
│ ├── Direct Vault Operations (app.vault.*) │
│ ├── Workspace Operations (app.workspace.*) │
│ ├── Search Integration │
│ └── Plugin Lifecycle Management │
├─────────────────────────────────────────────────────────────┤
│ Obsidian Plugin Foundation │
│ ├── Plugin Class & Lifecycle │
│ ├── Settings Management │
│ ├── UI Components (optional) │
│ └── Error Handling │
└─────────────────────────────────────────────────────────────┘
Key Abstraction Layer Transformation
Current (HTTP-based):
class ObsidianAPI {
async getFile(path: string): Promise<ObsidianFileResponse> {
const response = await this.client.get(`/vault/${path}`);
return response.data;
}
}
New (Direct plugin API):
class ObsidianAPI {
constructor(private app: App) {}
async getFile(path: string): Promise<ObsidianFileResponse> {
const file = this.app.vault.getAbstractFileByPath(path);
if (file instanceof TFile) {
const content = await this.app.vault.read(file);
return { content, path, stat: file.stat };
}
throw new Error(`File not found: ${path}`);
}
}
Development Workflow
Local Development
- Clone repo to Obsidian plugins folder:
.obsidian/plugins/obsidian-mcp-plugin/ - Install dependencies:
npm install - Build and watch:
npm run dev - Reload plugin in Obsidian: Ctrl/Cmd+P → "Reload app without saving"
BRAT Testing
- Push changes to GitHub
- Users install via BRAT:
aaronsb/obsidian-mcp-plugin - Automatic updates for testers
- Collect feedback and iterate
Official Release
- Final testing and documentation
- Create GitHub release with plugin assets
- Submit to Obsidian plugin directory
- Community announcement
Success Metrics
Technical Metrics
- ⚡ Performance: 50%+ faster than HTTP-based approach
- 🔍 Search Quality: Enhanced results with snippets + media files
- 🛠️ Compatibility: 100% API compatibility with existing tools
- 📈 Adoption: BRAT testing with community feedback
Community Metrics
- 📥 Installation: Target 1000+ BRAT installations during testing
- ⭐ Reviews: Positive feedback on functionality and performance
- 🔧 Integration: AI tools adopting the plugin for Obsidian access
- 📖 Documentation: Clear migration path from existing setups
Next Steps
- Repository Setup: Initialize TypeScript plugin structure
- Core Implementation: Begin ObsidianAPI direct integration
- MCP Integration: Embed existing semantic operations
- BRAT Preparation: Prepare for beta testing release
This plugin represents the natural evolution of Obsidian AI integration, combining the best of REST API access with semantic MCP operations in a single, high-performance package.