@fazer-ai/mcp-obsidian 1.0.14 → 1.0.15
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/dist/index.js +29 -26
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -123,7 +123,10 @@ class Obsidian {
|
|
|
123
123
|
method: "POST"
|
|
124
124
|
});
|
|
125
125
|
}
|
|
126
|
-
openFile({
|
|
126
|
+
openFile({
|
|
127
|
+
filename,
|
|
128
|
+
newLeaf
|
|
129
|
+
}) {
|
|
127
130
|
const qs = newLeaf ? "?newLeaf=true" : "";
|
|
128
131
|
return this.fetch(`/open/${sanitizeAndEncodePath(filename)}${qs}`, {
|
|
129
132
|
method: "POST"
|
|
@@ -4267,7 +4270,7 @@ var z = /* @__PURE__ */ Object.freeze({
|
|
|
4267
4270
|
// src/tools.ts
|
|
4268
4271
|
var obsidian = new Obsidian(config_default.obsidian);
|
|
4269
4272
|
function registerTools(server) {
|
|
4270
|
-
server.tool("
|
|
4273
|
+
server.tool("obsidian_status", "Returns basic details about the server.", async () => {
|
|
4271
4274
|
const status = await obsidian.status();
|
|
4272
4275
|
return {
|
|
4273
4276
|
content: [
|
|
@@ -4278,19 +4281,19 @@ function registerTools(server) {
|
|
|
4278
4281
|
]
|
|
4279
4282
|
};
|
|
4280
4283
|
});
|
|
4281
|
-
server.tool("
|
|
4284
|
+
server.tool("obsidian_delete_active", "Deletes the currently-active file.", async () => {
|
|
4282
4285
|
await obsidian.deleteActive();
|
|
4283
4286
|
return {
|
|
4284
4287
|
content: [{ type: "text", text: "OK" }]
|
|
4285
4288
|
};
|
|
4286
4289
|
});
|
|
4287
|
-
server.tool("
|
|
4290
|
+
server.tool("obsidian_get_active", "Returns the content of the currently-active file.", async () => {
|
|
4288
4291
|
const note = await obsidian.getActive();
|
|
4289
4292
|
return {
|
|
4290
4293
|
content: [{ type: "text", text: JSON.stringify(note) }]
|
|
4291
4294
|
};
|
|
4292
4295
|
});
|
|
4293
|
-
server.tool("
|
|
4296
|
+
server.tool("obsidian_patch_active", "Inserts content into the active file relative to a target.", {
|
|
4294
4297
|
operation: z.enum(["append", "prepend", "replace"]),
|
|
4295
4298
|
targetType: z.enum(["heading", "block", "frontmatter"]),
|
|
4296
4299
|
target: z.string(),
|
|
@@ -4304,19 +4307,19 @@ function registerTools(server) {
|
|
|
4304
4307
|
content: [{ type: "text", text: JSON.stringify(res) }]
|
|
4305
4308
|
};
|
|
4306
4309
|
});
|
|
4307
|
-
server.tool("
|
|
4310
|
+
server.tool("obsidian_post_active", "Appends content to the active file.", { content: z.string() }, async (args) => {
|
|
4308
4311
|
await obsidian.postActive(args);
|
|
4309
4312
|
return {
|
|
4310
4313
|
content: [{ type: "text", text: "OK" }]
|
|
4311
4314
|
};
|
|
4312
4315
|
});
|
|
4313
|
-
server.tool("
|
|
4316
|
+
server.tool("obsidian_put_active", "Replaces content of the active file.", { content: z.string() }, async (args) => {
|
|
4314
4317
|
await obsidian.putActive(args);
|
|
4315
4318
|
return {
|
|
4316
4319
|
content: [{ type: "text", text: "OK" }]
|
|
4317
4320
|
};
|
|
4318
4321
|
});
|
|
4319
|
-
server.tool("
|
|
4322
|
+
server.tool("obsidian_get_commands", "Returns a list of available commands.", async () => {
|
|
4320
4323
|
const commands = await obsidian.getCommands();
|
|
4321
4324
|
return {
|
|
4322
4325
|
content: [
|
|
@@ -4327,19 +4330,19 @@ function registerTools(server) {
|
|
|
4327
4330
|
]
|
|
4328
4331
|
};
|
|
4329
4332
|
});
|
|
4330
|
-
server.tool("
|
|
4333
|
+
server.tool("obsidian_execute_command", "Executes a specified command.", { commandId: z.string() }, async (args) => {
|
|
4331
4334
|
await obsidian.executeCommand(args);
|
|
4332
4335
|
return {
|
|
4333
4336
|
content: [{ type: "text", text: "OK" }]
|
|
4334
4337
|
};
|
|
4335
4338
|
});
|
|
4336
|
-
server.tool("
|
|
4339
|
+
server.tool("obsidian_open_file", "Opens a file, optionally in a new leaf.", { filename: z.string(), newLeaf: z.boolean().nullish() }, async (args) => {
|
|
4337
4340
|
await obsidian.openFile(args);
|
|
4338
4341
|
return {
|
|
4339
4342
|
content: [{ type: "text", text: "OK" }]
|
|
4340
4343
|
};
|
|
4341
4344
|
});
|
|
4342
|
-
server.tool("
|
|
4345
|
+
server.tool("obsidian_delete_periodic", "Deletes the periodic note for a given period.", {
|
|
4343
4346
|
period: z.enum(["daily", "weekly", "monthly", "quarterly", "yearly"])
|
|
4344
4347
|
}, async (args) => {
|
|
4345
4348
|
await obsidian.deletePeriodic(args);
|
|
@@ -4347,7 +4350,7 @@ function registerTools(server) {
|
|
|
4347
4350
|
content: [{ type: "text", text: "OK" }]
|
|
4348
4351
|
};
|
|
4349
4352
|
});
|
|
4350
|
-
server.tool("
|
|
4353
|
+
server.tool("obsidian_get_periodic", "Returns the periodic note for a given period.", {
|
|
4351
4354
|
period: z.enum(["daily", "weekly", "monthly", "quarterly", "yearly"])
|
|
4352
4355
|
}, async (args) => {
|
|
4353
4356
|
const note = await obsidian.getPeriodic(args);
|
|
@@ -4355,7 +4358,7 @@ function registerTools(server) {
|
|
|
4355
4358
|
content: [{ type: "text", text: JSON.stringify(note) }]
|
|
4356
4359
|
};
|
|
4357
4360
|
});
|
|
4358
|
-
server.tool("
|
|
4361
|
+
server.tool("obsidian_patch_periodic", "Inserts content into a periodic note relative to a target.", {
|
|
4359
4362
|
period: z.enum(["daily", "weekly", "monthly", "quarterly", "yearly"]),
|
|
4360
4363
|
operation: z.enum(["append", "prepend", "replace"]),
|
|
4361
4364
|
targetType: z.enum(["heading", "block", "frontmatter"]),
|
|
@@ -4370,7 +4373,7 @@ function registerTools(server) {
|
|
|
4370
4373
|
content: [{ type: "text", text: "OK" }]
|
|
4371
4374
|
};
|
|
4372
4375
|
});
|
|
4373
|
-
server.tool("
|
|
4376
|
+
server.tool("obsidian_post_periodic", "Appends content to the periodic note.", {
|
|
4374
4377
|
period: z.enum(["daily", "weekly", "monthly", "quarterly", "yearly"]),
|
|
4375
4378
|
content: z.string()
|
|
4376
4379
|
}, async (args) => {
|
|
@@ -4379,7 +4382,7 @@ function registerTools(server) {
|
|
|
4379
4382
|
content: [{ type: "text", text: "OK" }]
|
|
4380
4383
|
};
|
|
4381
4384
|
});
|
|
4382
|
-
server.tool("
|
|
4385
|
+
server.tool("obsidian_put_periodic", "Replaces content of the periodic note.", {
|
|
4383
4386
|
period: z.enum(["daily", "weekly", "monthly", "quarterly", "yearly"]),
|
|
4384
4387
|
content: z.string()
|
|
4385
4388
|
}, async (args) => {
|
|
@@ -4388,49 +4391,49 @@ function registerTools(server) {
|
|
|
4388
4391
|
content: [{ type: "text", text: "OK" }]
|
|
4389
4392
|
};
|
|
4390
4393
|
});
|
|
4391
|
-
server.tool("
|
|
4394
|
+
server.tool("obsidian_search_dataview", "Searches using a Dataview query.", { query: z.string() }, async (args) => {
|
|
4392
4395
|
const results = await obsidian.searchDataview(args);
|
|
4393
4396
|
return {
|
|
4394
4397
|
content: [{ type: "text", text: JSON.stringify(results) }]
|
|
4395
4398
|
};
|
|
4396
4399
|
});
|
|
4397
|
-
server.tool("
|
|
4400
|
+
server.tool("obsidian_search_json_logic", "Searches using a JsonLogic query.", { logic: z.unknown() }, async ({ logic }) => {
|
|
4398
4401
|
const results = await obsidian.searchJsonLogic(logic);
|
|
4399
4402
|
return {
|
|
4400
4403
|
content: [{ type: "text", text: JSON.stringify(results) }]
|
|
4401
4404
|
};
|
|
4402
4405
|
});
|
|
4403
|
-
server.tool("
|
|
4406
|
+
server.tool("obsidian_simple_search", "Searches for text in vault with optional context.", { query: z.string(), contextLength: z.number().optional() }, async (args) => {
|
|
4404
4407
|
const results = await obsidian.simpleSearch(args);
|
|
4405
4408
|
return {
|
|
4406
4409
|
content: [{ type: "text", text: JSON.stringify(results) }]
|
|
4407
4410
|
};
|
|
4408
4411
|
});
|
|
4409
|
-
server.tool("
|
|
4412
|
+
server.tool("obsidian_list_vault_root", "Lists files in the root of the vault.", async () => {
|
|
4410
4413
|
const files = await obsidian.listVaultRoot();
|
|
4411
4414
|
return {
|
|
4412
4415
|
content: [{ type: "text", text: JSON.stringify(files) }]
|
|
4413
4416
|
};
|
|
4414
4417
|
});
|
|
4415
|
-
server.tool("
|
|
4418
|
+
server.tool("obsidian_list_vault_directory", "Lists files in a specified directory.", { pathToDirectory: z.string() }, async (args) => {
|
|
4416
4419
|
const files = await obsidian.listVaultDirectory(args);
|
|
4417
4420
|
return {
|
|
4418
4421
|
content: [{ type: "text", text: JSON.stringify(files) }]
|
|
4419
4422
|
};
|
|
4420
4423
|
});
|
|
4421
|
-
server.tool("
|
|
4424
|
+
server.tool("obsidian_delete_file", "Deletes a file in the vault.", { filename: z.string() }, async (args) => {
|
|
4422
4425
|
await obsidian.deleteFile(args);
|
|
4423
4426
|
return {
|
|
4424
4427
|
content: [{ type: "text", text: "OK" }]
|
|
4425
4428
|
};
|
|
4426
4429
|
});
|
|
4427
|
-
server.tool("
|
|
4430
|
+
server.tool("obsidian_get_file", "Returns content of a vault file.", { filename: z.string() }, async (args) => {
|
|
4428
4431
|
const file = await obsidian.getFile(args);
|
|
4429
4432
|
return {
|
|
4430
4433
|
content: [{ type: "text", text: JSON.stringify(file) }]
|
|
4431
4434
|
};
|
|
4432
4435
|
});
|
|
4433
|
-
server.tool("
|
|
4436
|
+
server.tool("obsidian_patch_file", "Inserts content into a vault file relative to a target.", {
|
|
4434
4437
|
filename: z.string(),
|
|
4435
4438
|
operation: z.enum(["append", "prepend", "replace"]),
|
|
4436
4439
|
targetType: z.enum(["heading", "block", "frontmatter"]),
|
|
@@ -4445,13 +4448,13 @@ function registerTools(server) {
|
|
|
4445
4448
|
content: [{ type: "text", text: "OK" }]
|
|
4446
4449
|
};
|
|
4447
4450
|
});
|
|
4448
|
-
server.tool("
|
|
4451
|
+
server.tool("obsidian_post_file", "Appends content to a vault file.", { filename: z.string(), content: z.string() }, async (args) => {
|
|
4449
4452
|
await obsidian.postFile(args);
|
|
4450
4453
|
return {
|
|
4451
4454
|
content: [{ type: "text", text: "OK" }]
|
|
4452
4455
|
};
|
|
4453
4456
|
});
|
|
4454
|
-
server.tool("
|
|
4457
|
+
server.tool("obsidian_put_file", "Creates or replaces a vault file.", { filename: z.string(), content: z.string() }, async (args) => {
|
|
4455
4458
|
await obsidian.putFile(args);
|
|
4456
4459
|
return {
|
|
4457
4460
|
content: [{ type: "text", text: "OK" }]
|
|
@@ -7169,7 +7172,7 @@ class StdioServerTransport {
|
|
|
7169
7172
|
|
|
7170
7173
|
// package.json
|
|
7171
7174
|
var name = "@fazer-ai/mcp-obsidian";
|
|
7172
|
-
var version = "1.0.
|
|
7175
|
+
var version = "1.0.15";
|
|
7173
7176
|
|
|
7174
7177
|
// src/index.ts
|
|
7175
7178
|
var server = new McpServer({ name, version }, {
|