Skip to main content
Glama

用于 Obsidian 集成的模型上下文协议服务器

这是一个基于 TypeScript 的 MCP 服务器,实现了与 Obsidian 的集成。它通过提供以下功能演示了 MCP 的核心概念:

  • 代表黑曜石金库内容的资源

  • 访问保险库数据的工具

  • 与 Obsidian 的 API 集成

项目统计

  • 代码总行数:345

  • 主要文件:

    • src/tool-handlers.ts (76 行)

    • src/resource-handlers.ts (45 行)

    • src/server.ts (32 行)

    • src/api-client.ts (25 行)

Related MCP server: my-server MCP Server

目录结构

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

特征

资源

  • 通过obsidian://server-info URI 访问 Obsidian 服务器信息

  • 获取带有元数据的保管库内容

  • JSON 格式,易于集成

工具

  • get_vault_contents - 检索 Obsidian 保险库的内容

    • 将路径作为可选参数(默认值:根目录)

    • 返回结构化的 JSON 响应

API 集成

  • 使用 Obsidian API 进行安全 HTTPS 连接

  • 具有错误处理功能的自定义 axios 客户端

  • Windows 路径规范化支持

发展

先决条件

  • Node.js v18+

  • TypeScript 5.3+

  • Obsidian API 密钥(设置为 OBSIDIAN_API_KEY 环境变量)

设置

# Install dependencies
npm install

# Build the server
npm run build

# Start development server with auto-rebuild
npm run watch

安装

要与 Claude Desktop 一起使用,请添加服务器配置:

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

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

调试

我们建议使用MCP 检查器

npm run inspector

检查器将提供一个 URL 来访问浏览器中的调试工具。

依赖项

运行时

  • @modelcontextprotocol/sdk:MCP 服务器实现

  • axios:用于 API 通信的 HTTP 客户端

发展

  • @types/node:Node.js 的 TypeScript 定义

  • typescript:TypeScript 编译器

Install Server
A
security – no known vulnerabilities
F
license - not found
A
quality - confirmed to work

Resources

Looking for Admin?

Admins can modify the Dockerfile, update the server description, and track usage metrics. If you are the server author, to access the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Sunwood-ai-labs/obsidian-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server