@fazer-ai/mcp-obsidian 1.0.9 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +165 -8
- package/dist/index.js +9 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,20 +1,177 @@
|
|
|
1
|
-
#
|
|
1
|
+
# MCP server for Obsidian (TypeScript + Bun)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
> A Model-Context-Protocol (MCP) server that lets Claude (or any MCP-compatible LLM) interact with your Obsidian vault through the [**Local REST API**](https://github.com/coddingtonbear/obsidian-local-rest-api) community plugin – written in **TypeScript** and runnable with **bunx**.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## ✨ Components
|
|
10
|
+
|
|
11
|
+
### Tools
|
|
12
|
+
|
|
13
|
+
| Tool name | Description |
|
|
14
|
+
|-----------|-------------|
|
|
15
|
+
| **status** | Returns basic details about the Obsidian Local REST API server and your authentication status |
|
|
16
|
+
| **delete_active** | Deletes the note that is currently active in the Obsidian UI |
|
|
17
|
+
| **get_active** | Retrieves the full content of the active note (Markdown or JSON view) |
|
|
18
|
+
| **patch_active** | Inserts, replaces or prepends content in the active note relative to a heading, block reference, or front-matter field |
|
|
19
|
+
| **post_active** | Appends Markdown to the end of the active note |
|
|
20
|
+
| **put_active** | Replaces the entire body of the active note |
|
|
21
|
+
| **get_commands** | Lists every command available in Obsidian’s command palette |
|
|
22
|
+
| **execute_command** | Executes a specific Obsidian command by its ID |
|
|
23
|
+
| **open_file** | Opens the given file inside Obsidian (creates it if missing); optional flag to open in a new leaf |
|
|
24
|
+
| **delete_periodic** | Deletes the current daily / weekly / monthly / quarterly / yearly note for the requested period |
|
|
25
|
+
| **get_periodic** | Returns the content of the current periodic note for the requested period |
|
|
26
|
+
| **patch_periodic** | Inserts / replaces content in a periodic note relative to a heading, block reference, or front-matter field |
|
|
27
|
+
| **post_periodic** | Appends Markdown to the periodic note (creates it if it doesn’t exist) |
|
|
28
|
+
| **put_periodic** | Replaces the entire body of a periodic note |
|
|
29
|
+
| **search_dataview** | Runs a Dataview-DQL query across the vault and returns matching rows |
|
|
30
|
+
| **search_json_logic** | Runs a JsonLogic query against structured note metadata |
|
|
31
|
+
| **simple_search** | Performs a plain-text fuzzy search with optional surrounding context |
|
|
32
|
+
| **list_vault_root** | Lists all files and directories at the **root** of your vault |
|
|
33
|
+
| **list_vault_directory** | Lists files and directories inside a **specific folder** of the vault |
|
|
34
|
+
| **delete_file** | Deletes a specific file (or directory) in the vault |
|
|
35
|
+
| **get_file** | Retrieves the content of a file in the vault (Markdown or JSON view) |
|
|
36
|
+
| **patch_file** | Inserts / replaces content in an arbitrary file relative to a heading, block reference, or front-matter field |
|
|
37
|
+
| **post_file** | Appends Markdown to a file (creates it if it doesn’t exist) |
|
|
38
|
+
| **put_file** | Creates a new file or replaces the entire body of an existing file |
|
|
39
|
+
|
|
40
|
+
*See [Local REST API specifications](https://coddingtonbear.github.io/obsidian-local-rest-api) for more details.*
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
### Example prompts
|
|
45
|
+
|
|
46
|
+
```text
|
|
47
|
+
# Summarise the latest “architecture call” note
|
|
48
|
+
# (Claude will transparently call list_files_in_vault → get_file_contents)
|
|
49
|
+
Get the contents of the last “architecture call” note and summarise them.
|
|
50
|
+
|
|
51
|
+
# Find all mentions of Cosmos DB
|
|
52
|
+
Search for all files where “Azure CosmosDb” is mentioned and explain the context briefly.
|
|
53
|
+
|
|
54
|
+
# Create a summary note
|
|
55
|
+
Summarise yesterday’s meeting and save it as
|
|
56
|
+
“summaries/2025-04-24-meeting.md”. Add a short intro suitable for e-mail.
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## ⚙️ Configuration
|
|
62
|
+
|
|
63
|
+
### Environment variables
|
|
64
|
+
|
|
65
|
+
Copy `.env.example` to `.env` and fill in your values:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
PORT=3045 # TCP port the MCP server will listen on
|
|
69
|
+
OBSIDIAN_API_KEY= # Obtain this from the plugin settings in Obsidian
|
|
70
|
+
OBSIDIAN_PROTOCOL=http
|
|
71
|
+
OBSIDIAN_HOST=localhost
|
|
72
|
+
OBSIDIAN_PORT=27123 # Port the Local REST API plugin is bound to
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Obsidian REST API key
|
|
76
|
+
|
|
77
|
+
You can supply the key either by:
|
|
78
|
+
|
|
79
|
+
1. **Server config (recommended)** – pass it via the `env` field in your Claude (or other client) MCP-server declaration:
|
|
80
|
+
|
|
81
|
+
```jsonc
|
|
82
|
+
{
|
|
83
|
+
"mcpServers": {
|
|
84
|
+
"mcp-obsidian-ts": {
|
|
85
|
+
"command": "bunx",
|
|
86
|
+
"args": ["mcp-obsidian-ts"], // or the binary of your package
|
|
87
|
+
"env": {
|
|
88
|
+
"OBSIDIAN_API_KEY": "paste_key_here",
|
|
89
|
+
"OBSIDIAN_HOST": "localhost"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
2. **`.env` file** – place the key in the `.env` you created above.
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## 🚀 Quickstart
|
|
101
|
+
|
|
102
|
+
### Prerequisites
|
|
103
|
+
|
|
104
|
+
* **Bun** ≥ 1.1 → <https://bun.sh/docs/installation>
|
|
105
|
+
* Obsidian with the **Local REST API** plugin enabled.
|
|
106
|
+
|
|
107
|
+
### Install & run
|
|
4
108
|
|
|
5
109
|
```bash
|
|
110
|
+
# 1. Grab the package
|
|
111
|
+
git clone https://github.com/your-org/mcp-obsidian-ts.git
|
|
112
|
+
cd mcp-obsidian-ts
|
|
6
113
|
bun install
|
|
114
|
+
|
|
115
|
+
# 2. Configure env vars
|
|
116
|
+
cp .env.example .env # then edit as needed
|
|
117
|
+
|
|
118
|
+
# 3. Launch the server
|
|
119
|
+
bunx mcp-obsidian-ts # starts on $PORT (default 3045)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
When the server starts you should see:
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
▶ MCP server (obsidian) listening on http://localhost:3045
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Add / update the entry in your Claude Desktop or MCP-compatible client and you’re ready to chat with your vault.
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## 🛠 Development
|
|
133
|
+
|
|
134
|
+
### Scripts
|
|
135
|
+
|
|
136
|
+
| Script | What it does |
|
|
137
|
+
|--------|--------------|
|
|
138
|
+
| `bun run dev` | Starts the server with live-reload (tsx) |
|
|
139
|
+
| `bun run build` | Bundles to `dist/` (ESM) |
|
|
140
|
+
| `bun test` | Runs unit tests (vitest) |
|
|
141
|
+
|
|
142
|
+
### Debugging
|
|
143
|
+
|
|
144
|
+
MCP servers talk over **stdio**, so normal debuggers aren’t helpful.
|
|
145
|
+
Use the excellent **[MCP Inspector]**:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
npx @modelcontextprotocol/inspector bunx --directory /path/to/mcp-obsidian-ts run dev
|
|
7
149
|
```
|
|
8
150
|
|
|
9
|
-
|
|
151
|
+
Open the URL it prints to step through requests, inspect tool calls, and watch logs in real time.
|
|
152
|
+
Alternatively, tail the log file written by Claude Desktop:
|
|
10
153
|
|
|
11
154
|
```bash
|
|
12
|
-
|
|
155
|
+
tail -f ~/Library/Logs/Claude/mcp-server-mcp-obsidian-ts.log
|
|
13
156
|
```
|
|
14
157
|
|
|
15
|
-
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## 📦 Publishing
|
|
16
161
|
|
|
17
|
-
|
|
162
|
+
1. Run `bun run build`.
|
|
163
|
+
2. `npm publish --access public` (or `np`, `release-it`, etc.).
|
|
164
|
+
3. Update the badge URL at the top of this file with the server ID from <https://glama.ai/mcp>.
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
### Licence
|
|
169
|
+
|
|
170
|
+
MIT – see [LICENCE](LICENCE).
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
**Happy note-wrangling!** 🗒️✨
|
|
175
|
+
```
|
|
18
176
|
|
|
19
|
-
-
|
|
20
|
-
- [ ] Publish to npm (run with bunx, similar to mcp-inspector)
|
|
177
|
+
*Tip:* If your project has its own name (e.g. **`mcp-obsidian-ts`**) just swap it in wherever you see a placeholder.
|
package/dist/index.js
CHANGED
|
@@ -7169,10 +7169,17 @@ class StdioServerTransport {
|
|
|
7169
7169
|
|
|
7170
7170
|
// package.json
|
|
7171
7171
|
var name = "@fazer-ai/mcp-obsidian";
|
|
7172
|
-
var version = "1.0.
|
|
7172
|
+
var version = "1.0.11";
|
|
7173
7173
|
|
|
7174
7174
|
// src/index.ts
|
|
7175
|
-
var server = new McpServer({ name, version }
|
|
7175
|
+
var server = new McpServer({ name, version }, {
|
|
7176
|
+
instructions: "This is a MCP server for Obsidian. It is a simple server that can be used to run commands and get responses from the client running Local REST API community plugin.",
|
|
7177
|
+
capabilities: {
|
|
7178
|
+
resources: {},
|
|
7179
|
+
prompts: {},
|
|
7180
|
+
tools: {}
|
|
7181
|
+
}
|
|
7182
|
+
});
|
|
7176
7183
|
registerTools(server);
|
|
7177
7184
|
async function main() {
|
|
7178
7185
|
const transport = new StdioServerTransport;
|