SA

sunwood-ai-labs/obsidian-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

10 stars 2 forks 质量 54 趋势 18

A Model Context Protocol server for Obsidian integration

概览

A Model Context Protocol server for Obsidian integration This is a TypeScript-based MCP server that implements integration with Obsidian. It demonstrates core MCP concepts by providing: - Resources representing Obsidian vault contents - Tools for accessing vault data - API integration with Obsidian - Total lines of code: 345 - Main files: - src/tool-handlers.ts (76 lines) - src/resource-handlers.ts (45 lines) - src/server.ts (32 lines) - src/api-client.ts (25 lines) - Access Obsidian server info via obsidian://server-info URI - Get vault contents with metadata - JSON format for easy integration - get_vault_contents - Retrieve contents of Obsidian vault - Takes path as optional parameter (default: root directory) - Returns structured JSON response - Secure HTTPS connection with Obsidian API - Custom axios client with error handling - Windows path normalization support - Node.js v18+ - TypeScript 5.3+ - Obsidian API key (set as OBSIDIAN_API_KEY environment variable)

README

以下为原文 README 节选,完整内容请查看原文。

A Model Context Protocol server for Obsidian integration

This is a TypeScript-based MCP server that implements integration with Obsidian. It demonstrates core MCP concepts by providing:

  • Resources representing Obsidian vault contents
  • Tools for accessing vault data
  • API integration with Obsidian

Project Statistics

  • Total lines of code: 345
  • Main files:
    • src/tool-handlers.ts (76 lines)
    • src/resource-handlers.ts (45 lines)
    • src/server.ts (32 lines)
    • src/api-client.ts (25 lines)

Directory Structure

obsidian-mcp/
├── .codegpt/
│   └── head
├── src/
│   ├── api-client.ts
│   ├── index.ts
│   ├── resource-handlers.ts
│   ├── server.ts
│   └── tool-handlers.ts
├── .SourceSageignore
├── package.json
├── README.md
└── tsconfig.json

Features

Resources

  • Access Obsidian server info via obsidian://server-info URI
  • Get vault contents with metadata
  • JSON format for easy integration

Tools

  • get_vault_contents - Retrieve contents of Obsidian vault
    • Takes path as optional parameter (default: root directory)
    • Returns structured JSON response

API Integration

  • Secure HTTPS connection with Obsidian API
  • Custom axios client with error handling
  • Windows path normalization support

Development

Prerequisites

  • Node.js v18+
  • TypeScript 5.3+
  • Obsidian API key (set as OBSIDIAN_API_KEY environment variable)

Setup

# Install dependencies
npm install

# Build the server
npm run build

# Start development server with auto-rebuild
npm run watch

Installation

To use with Claude Desktop, add the server config:

On MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json On Windows: %APPDATA%/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "obsidian-mcp": {
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "obsidian-mcp": { "command": "/path/to/obsidian-mcp/build/index.js", "env": { "OBSIDIAN_API_KEY": "your-api-key-here" } } } }