Obsidian Knowledge Management MCP Server
Enables LLMs to read, search, and manage Obsidian vault markdown files, including YAML frontmatter, wikilinks, and graph operations through a secure stateless I/O layer.
README
Obsidian Knowledge Management MCP Server
A local MCP (Model Context Protocol) server that provides stateless I/O access to Obsidian vaults. This server enables LLMs to read, analyze, and manage Obsidian markdown files, YAML frontmatter, and wikilinks.
Key Features
- Stateless I/O Layer: Pure data access and atomic operations - no semantic analysis
- 35+ MCP Tools: Comprehensive vault management across 5 categories
- Frontmatter Management: Parse, update, and validate YAML metadata
- Wikilink Operations: Extract, analyze, and manipulate
[[wikilinks]] - Graph Operations: Build link graphs, find backlinks, identify orphan notes
- Full-Text Search: Literal and regex pattern matching across vault
- Security: Path validation prevents directory traversal attacks
Installation
npm install
npm run build
Configuration
Create a .env file based on .env.example:
VAULT_PATH=./Test Vault
LOG_LEVEL=info
MAX_CONCURRENT_OPS=10
Or set environment variables when running:
VAULT_PATH="./Test Vault" node dist/index.js
Usage
Running the Server
The server uses stdio transport for MCP communication:
VAULT_PATH="./Test Vault" node dist/index.js
Claude Desktop Integration
Add to your Claude Desktop MCP configuration:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"obsidian-knowledge": {
"command": "node",
"args": ["/absolute/path/to/obsidian-knowledge-mcp/dist/index.js"],
"env": {
"VAULT_PATH": "/absolute/path/to/your/vault"
}
}
}
}
Available Tools (Phase 1 - Navigation)
1. list_notes
List all notes with optional filtering.
Arguments:
folder(optional): Filter by folder pathtags(optional): Array of tags (note must have all)dateRange(optional):{ start, end }in ISO formatoffset(optional): Skip N notes for paginationlimit(optional): Return max N notes
Example:
{
"folder": "Studies/MATH 31AH",
"tags": ["MATH31AH"],
"limit": 10
}
Returns: Array of NoteMetadata with path, title, created date, tags, modified date, size.
2. read_note
Read a note with full metadata.
Arguments:
path(required): Vault-relative path (e.g.,"Studies/MATH 31AH/Vectors.md")
Returns:
content: Full markdown contentfrontmatter: Parsed YAML (or null if missing/malformed)frontmatterError: Parse error message if YAML is malformedoutgoingLinks: Array of wikilinks with target, alias, heading, line, columnheadings: Array of headings with level, text, line, idstats: Line count, character count, modified timestamp
3. read_notes_batch
Read multiple notes in one call.
Arguments:
paths(required): Array of vault-relative paths
Returns: Array of ReadNoteResult (same as read_note)
4. search_notes
Full-text search across vault.
Arguments:
pattern(required): Search string or regexisRegex(optional): Treat pattern as regex (default: false)folder(optional): Limit search to folderlimit(optional): Max occurrences per note (default: 10)
Returns: Array of SearchResult with path, match count, and occurrences (with line, column, context).
5. get_vault_structure
Get folder hierarchy with note counts.
Arguments: None
Returns: FolderNode tree with path, name, note count, and children.
Architecture
┌─────────────────────────────────────────┐
│ MCP Server (index.ts) │
│ - Tool registration │
│ - Request routing │
└─────────────────────────────────────────┘
↓
┌─────────────────────────────────────────┐
│ Tool Handlers (tools/*.ts) │
│ - navigation.ts - list, read, search │
│ - notes.ts - create, update, move │
│ - frontmatter.ts - get, update, bulk │
│ - links.ts - get links, backlinks │
│ - stats.ts - tags, titles │
└─────────────────────────────────────────┘
↓
┌──────────────────┬──────────────────────┐
│ Vault (vault.ts)│ Parser (parser.ts) │
│ - Path security │ - Frontmatter parse │
│ - File I/O │ - Wikilink extract │
│ - Validation │ - Heading extract │
└──────────────────┴──────────────────────┘
Error Handling
The server returns structured errors with actionable suggestions:
{
"success": false,
"error": {
"code": "FILE_NOT_FOUND",
"message": "File not found: nonexistent.md",
"context": { "path": "nonexistent.md" },
"actionable": "Use list_notes or get_note_titles to find available notes"
}
}
Error Codes:
PATH_OUTSIDE_VAULT: Path contains..or escapes vaultFILE_NOT_FOUND: File does not existFILE_LOCKED: File in use by another processINVALID_FRONTMATTER: YAML parse errorINVALID_PATH: Path contains illegal characters
Development
Building
npm run build # Compile TypeScript
npm run dev # Watch mode
Testing
npm test # Run all tests
npm run test:unit # Unit tests only
npm run test:integration # Integration tests with Test Vault
Linting
npm run lint
Roadmap
Phase 1: Foundation & Navigation (Completed)
- [x] MCP server initialization
- [x] Vault access with path security
- [x] Frontmatter and wikilink parsing
- [x] 5 navigation tools (list, read, search, structure)
Phase 2: Note Management (Planned)
- [ ] create_note - Create with content + frontmatter
- [ ] update_note - Replace or patch sections
- [ ] move_note - Relocate + update backlinks
- [ ] delete_note - Remove + clean dangling references
Phase 3: Frontmatter Operations (Planned)
- [ ] get_frontmatter - Parse metadata
- [ ] update_frontmatter - Modify fields
- [ ] bulk_update_frontmatter - Update across multiple notes
- [ ] audit_frontmatter - Validate against schema
Phase 4: Link Operations (Planned)
- [ ] get_links - Outgoing wikilinks
- [ ] get_backlinks - Incoming links
- [ ] get_all_links - Complete link graph
- [ ] insert_link - Add wikilink
- [ ] get_orphan_notes - Notes with no links
- [ ] get_headings - Heading structure
- [ ] find_text_occurrences - Pattern matching
Phase 5: Statistics & Polish (Planned)
- [ ] get_tag_list - All tags with counts
- [ ] get_note_titles - All titles + aliases
- [ ] Comprehensive documentation
- [ ] Integration tests
- [ ] Performance optimization
Design Principles
- Stateless: No caching, each call is independent
- Security: Path validation prevents escapes
- Rich Metadata: Include line numbers and positions for precise edits
- Graceful Degradation: Malformed frontmatter returns with error flag
- SOLID Principles: Clean separation of vault, parser, and tool layers
License
MIT
Contributing
Contributions welcome! This project follows SOLID principles and maintains a strict separation between the I/O layer (server) and intelligence layer (LLM).
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。