SimplyAISolution/Obsidian-MCP-Server
If you are the rightful owner of Obsidian-MCP-Server 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.
The Obsidian MCP Server is a Model Context Protocol server designed to integrate AI assistants with Obsidian vaults, enabling secure and efficient interaction with vault contents.
Obsidian MCP Server
🔗 Model Context Protocol (MCP) server for Obsidian integration
Enables AI assistants to read, search, and interact with your Obsidian vault through secure, standardized protocols.
Features
- 🔒 Secure vault access with path validation
- 📝 Markdown file reading with metadata extraction
- 🔍 Search capabilities across vault contents
- ⚡ High performance with efficient file handling
- 🛡️ Security-first design with input validation
Quick Start
# Install dependencies
npm install
# Set up your vault path
cp .env.example .env
# Edit .env with your vault path
# Start the server
npm run dev
Installation
Prerequisites
- Node.js 18.0.0 or higher
- An existing Obsidian vault
Setup
-
Clone the repository:
git clone https://github.com/SimplyAISolution/Obsidian-MCP-Server.git cd Obsidian-MCP-Server -
Install dependencies:
npm install -
Configure environment:
cp .env.example .envEdit
.envand set your vault path:VAULT_PATH=/path/to/your/obsidian/vault -
Build the project:
npm run build
Usage
Development Mode
npm run dev
Production Mode
npm run build
npm start
Running Tests
# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Run tests with coverage
npm run test:coverage
Code Quality
# Lint code
npm run lint
# Fix linting issues
npm run lint:fix
# Type checking
npm run typecheck
Configuration
The server can be configured through environment variables:
| Variable | Description | Default |
|---|---|---|
VAULT_PATH | Path to your Obsidian vault | Required |
SERVER_PORT | Server port number | 3000 |
LOG_LEVEL | Logging level (debug, info, warn, error) | info |
MAX_FILE_SIZE | Maximum file size in bytes | 10485760 (10MB) |
ALLOWED_EXTENSIONS | Comma-separated list of allowed file extensions | .md,.txt,.json |
API Reference
Resources
List Resources
{
"method": "resources/list",
"params": {}
}
Read Resource
{
"method": "resources/read",
"params": {
"uri": "obsidian://path/to/file.md"
}
}
Security
- Path Traversal Protection: All file paths are validated to prevent directory traversal attacks
- File Extension Filtering: Only allowed file extensions can be accessed
- File Size Limits: Large files are rejected to prevent resource exhaustion
- Input Validation: All inputs are validated using Zod schemas
Development
Project Structure
src/
├── handlers/ # Request handlers
│ └── vault.ts # Vault-specific handlers
├── utils/ # Utility functions
│ ├── logger.ts # Logging utility
│ └── security.ts # Security utilities
├── types/ # Type definitions
│ └── config.ts # Configuration types
├── config.ts # Configuration management
├── server.ts # MCP server implementation
└── index.ts # Main entry point
tests/
├── unit/ # Unit tests
├── integration/ # Integration tests
└── fixtures/ # Test fixtures
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
License
This project is licensed under the MIT License - see the file for details.
Support
If you encounter any issues or have questions:
- Check the
- Search existing issues
- Create a new issue with detailed information
Roadmap
- Advanced search functionality
- File writing capabilities
- Plugin integration
- Batch operations
- Real-time file watching
- Enhanced metadata extraction