@fazer-ai/mcp-obsidian 1.0.13 → 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.
Files changed (2) hide show
  1. package/dist/index.js +29 -36
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,6 +1,3 @@
1
- // src/index.ts
2
- import { writeFileSync } from "node:fs";
3
-
4
1
  // src/config.ts
5
2
  var {
6
3
  PORT,
@@ -126,7 +123,10 @@ class Obsidian {
126
123
  method: "POST"
127
124
  });
128
125
  }
129
- openFile({ filename, newLeaf }) {
126
+ openFile({
127
+ filename,
128
+ newLeaf
129
+ }) {
130
130
  const qs = newLeaf ? "?newLeaf=true" : "";
131
131
  return this.fetch(`/open/${sanitizeAndEncodePath(filename)}${qs}`, {
132
132
  method: "POST"
@@ -4270,7 +4270,7 @@ var z = /* @__PURE__ */ Object.freeze({
4270
4270
  // src/tools.ts
4271
4271
  var obsidian = new Obsidian(config_default.obsidian);
4272
4272
  function registerTools(server) {
4273
- server.tool("status", "Returns basic details about the server.", async () => {
4273
+ server.tool("obsidian_status", "Returns basic details about the server.", async () => {
4274
4274
  const status = await obsidian.status();
4275
4275
  return {
4276
4276
  content: [
@@ -4281,19 +4281,19 @@ function registerTools(server) {
4281
4281
  ]
4282
4282
  };
4283
4283
  });
4284
- server.tool("delete_active", "Deletes the currently-active file.", async () => {
4284
+ server.tool("obsidian_delete_active", "Deletes the currently-active file.", async () => {
4285
4285
  await obsidian.deleteActive();
4286
4286
  return {
4287
4287
  content: [{ type: "text", text: "OK" }]
4288
4288
  };
4289
4289
  });
4290
- server.tool("get_active", "Returns the content of the currently-active file.", async () => {
4290
+ server.tool("obsidian_get_active", "Returns the content of the currently-active file.", async () => {
4291
4291
  const note = await obsidian.getActive();
4292
4292
  return {
4293
4293
  content: [{ type: "text", text: JSON.stringify(note) }]
4294
4294
  };
4295
4295
  });
4296
- server.tool("patch_active", "Inserts content into the active file relative to a target.", {
4296
+ server.tool("obsidian_patch_active", "Inserts content into the active file relative to a target.", {
4297
4297
  operation: z.enum(["append", "prepend", "replace"]),
4298
4298
  targetType: z.enum(["heading", "block", "frontmatter"]),
4299
4299
  target: z.string(),
@@ -4307,19 +4307,19 @@ function registerTools(server) {
4307
4307
  content: [{ type: "text", text: JSON.stringify(res) }]
4308
4308
  };
4309
4309
  });
4310
- server.tool("post_active", "Appends content to the active file.", { content: z.string() }, async (args) => {
4310
+ server.tool("obsidian_post_active", "Appends content to the active file.", { content: z.string() }, async (args) => {
4311
4311
  await obsidian.postActive(args);
4312
4312
  return {
4313
4313
  content: [{ type: "text", text: "OK" }]
4314
4314
  };
4315
4315
  });
4316
- server.tool("put_active", "Replaces content of the active file.", { content: z.string() }, async (args) => {
4316
+ server.tool("obsidian_put_active", "Replaces content of the active file.", { content: z.string() }, async (args) => {
4317
4317
  await obsidian.putActive(args);
4318
4318
  return {
4319
4319
  content: [{ type: "text", text: "OK" }]
4320
4320
  };
4321
4321
  });
4322
- server.tool("get_commands", "Returns a list of available commands.", async () => {
4322
+ server.tool("obsidian_get_commands", "Returns a list of available commands.", async () => {
4323
4323
  const commands = await obsidian.getCommands();
4324
4324
  return {
4325
4325
  content: [
@@ -4330,19 +4330,19 @@ function registerTools(server) {
4330
4330
  ]
4331
4331
  };
4332
4332
  });
4333
- server.tool("execute_command", "Executes a specified command.", { commandId: z.string() }, async (args) => {
4333
+ server.tool("obsidian_execute_command", "Executes a specified command.", { commandId: z.string() }, async (args) => {
4334
4334
  await obsidian.executeCommand(args);
4335
4335
  return {
4336
4336
  content: [{ type: "text", text: "OK" }]
4337
4337
  };
4338
4338
  });
4339
- server.tool("open_file", "Opens a file, optionally in a new leaf.", { filename: z.string(), newLeaf: z.boolean() }, async (args) => {
4339
+ server.tool("obsidian_open_file", "Opens a file, optionally in a new leaf.", { filename: z.string(), newLeaf: z.boolean().nullish() }, async (args) => {
4340
4340
  await obsidian.openFile(args);
4341
4341
  return {
4342
4342
  content: [{ type: "text", text: "OK" }]
4343
4343
  };
4344
4344
  });
4345
- server.tool("delete_periodic", "Deletes the periodic note for a given period.", {
4345
+ server.tool("obsidian_delete_periodic", "Deletes the periodic note for a given period.", {
4346
4346
  period: z.enum(["daily", "weekly", "monthly", "quarterly", "yearly"])
4347
4347
  }, async (args) => {
4348
4348
  await obsidian.deletePeriodic(args);
@@ -4350,7 +4350,7 @@ function registerTools(server) {
4350
4350
  content: [{ type: "text", text: "OK" }]
4351
4351
  };
4352
4352
  });
4353
- server.tool("get_periodic", "Returns the periodic note for a given period.", {
4353
+ server.tool("obsidian_get_periodic", "Returns the periodic note for a given period.", {
4354
4354
  period: z.enum(["daily", "weekly", "monthly", "quarterly", "yearly"])
4355
4355
  }, async (args) => {
4356
4356
  const note = await obsidian.getPeriodic(args);
@@ -4358,7 +4358,7 @@ function registerTools(server) {
4358
4358
  content: [{ type: "text", text: JSON.stringify(note) }]
4359
4359
  };
4360
4360
  });
4361
- server.tool("patch_periodic", "Inserts content into a periodic note relative to a target.", {
4361
+ server.tool("obsidian_patch_periodic", "Inserts content into a periodic note relative to a target.", {
4362
4362
  period: z.enum(["daily", "weekly", "monthly", "quarterly", "yearly"]),
4363
4363
  operation: z.enum(["append", "prepend", "replace"]),
4364
4364
  targetType: z.enum(["heading", "block", "frontmatter"]),
@@ -4373,7 +4373,7 @@ function registerTools(server) {
4373
4373
  content: [{ type: "text", text: "OK" }]
4374
4374
  };
4375
4375
  });
4376
- server.tool("post_periodic", "Appends content to the periodic note.", {
4376
+ server.tool("obsidian_post_periodic", "Appends content to the periodic note.", {
4377
4377
  period: z.enum(["daily", "weekly", "monthly", "quarterly", "yearly"]),
4378
4378
  content: z.string()
4379
4379
  }, async (args) => {
@@ -4382,7 +4382,7 @@ function registerTools(server) {
4382
4382
  content: [{ type: "text", text: "OK" }]
4383
4383
  };
4384
4384
  });
4385
- server.tool("put_periodic", "Replaces content of the periodic note.", {
4385
+ server.tool("obsidian_put_periodic", "Replaces content of the periodic note.", {
4386
4386
  period: z.enum(["daily", "weekly", "monthly", "quarterly", "yearly"]),
4387
4387
  content: z.string()
4388
4388
  }, async (args) => {
@@ -4391,49 +4391,49 @@ function registerTools(server) {
4391
4391
  content: [{ type: "text", text: "OK" }]
4392
4392
  };
4393
4393
  });
4394
- server.tool("search_dataview", "Searches using a Dataview query.", { query: z.string() }, async (args) => {
4394
+ server.tool("obsidian_search_dataview", "Searches using a Dataview query.", { query: z.string() }, async (args) => {
4395
4395
  const results = await obsidian.searchDataview(args);
4396
4396
  return {
4397
4397
  content: [{ type: "text", text: JSON.stringify(results) }]
4398
4398
  };
4399
4399
  });
4400
- server.tool("search_json_logic", "Searches using a JsonLogic query.", { logic: z.unknown() }, async ({ logic }) => {
4400
+ server.tool("obsidian_search_json_logic", "Searches using a JsonLogic query.", { logic: z.unknown() }, async ({ logic }) => {
4401
4401
  const results = await obsidian.searchJsonLogic(logic);
4402
4402
  return {
4403
4403
  content: [{ type: "text", text: JSON.stringify(results) }]
4404
4404
  };
4405
4405
  });
4406
- server.tool("simple_search", "Searches for text in vault with optional context.", { query: z.string(), contextLength: z.number().optional() }, async (args) => {
4406
+ server.tool("obsidian_simple_search", "Searches for text in vault with optional context.", { query: z.string(), contextLength: z.number().optional() }, async (args) => {
4407
4407
  const results = await obsidian.simpleSearch(args);
4408
4408
  return {
4409
4409
  content: [{ type: "text", text: JSON.stringify(results) }]
4410
4410
  };
4411
4411
  });
4412
- server.tool("list_vault_root", "Lists files in the root of the vault.", async () => {
4412
+ server.tool("obsidian_list_vault_root", "Lists files in the root of the vault.", async () => {
4413
4413
  const files = await obsidian.listVaultRoot();
4414
4414
  return {
4415
4415
  content: [{ type: "text", text: JSON.stringify(files) }]
4416
4416
  };
4417
4417
  });
4418
- server.tool("list_vault_directory", "Lists files in a specified directory.", { pathToDirectory: z.string() }, async (args) => {
4418
+ server.tool("obsidian_list_vault_directory", "Lists files in a specified directory.", { pathToDirectory: z.string() }, async (args) => {
4419
4419
  const files = await obsidian.listVaultDirectory(args);
4420
4420
  return {
4421
4421
  content: [{ type: "text", text: JSON.stringify(files) }]
4422
4422
  };
4423
4423
  });
4424
- server.tool("delete_file", "Deletes a file in the vault.", { filename: z.string() }, async (args) => {
4424
+ server.tool("obsidian_delete_file", "Deletes a file in the vault.", { filename: z.string() }, async (args) => {
4425
4425
  await obsidian.deleteFile(args);
4426
4426
  return {
4427
4427
  content: [{ type: "text", text: "OK" }]
4428
4428
  };
4429
4429
  });
4430
- server.tool("get_file", "Returns content of a vault file.", { filename: z.string() }, async (args) => {
4430
+ server.tool("obsidian_get_file", "Returns content of a vault file.", { filename: z.string() }, async (args) => {
4431
4431
  const file = await obsidian.getFile(args);
4432
4432
  return {
4433
4433
  content: [{ type: "text", text: JSON.stringify(file) }]
4434
4434
  };
4435
4435
  });
4436
- server.tool("patch_file", "Inserts content into a vault file relative to a target.", {
4436
+ server.tool("obsidian_patch_file", "Inserts content into a vault file relative to a target.", {
4437
4437
  filename: z.string(),
4438
4438
  operation: z.enum(["append", "prepend", "replace"]),
4439
4439
  targetType: z.enum(["heading", "block", "frontmatter"]),
@@ -4448,13 +4448,13 @@ function registerTools(server) {
4448
4448
  content: [{ type: "text", text: "OK" }]
4449
4449
  };
4450
4450
  });
4451
- server.tool("post_file", "Appends content to a vault file.", { filename: z.string(), content: z.string() }, async (args) => {
4451
+ server.tool("obsidian_post_file", "Appends content to a vault file.", { filename: z.string(), content: z.string() }, async (args) => {
4452
4452
  await obsidian.postFile(args);
4453
4453
  return {
4454
4454
  content: [{ type: "text", text: "OK" }]
4455
4455
  };
4456
4456
  });
4457
- server.tool("put_file", "Creates or replaces a vault file.", { filename: z.string(), content: z.string() }, async (args) => {
4457
+ server.tool("obsidian_put_file", "Creates or replaces a vault file.", { filename: z.string(), content: z.string() }, async (args) => {
4458
4458
  await obsidian.putFile(args);
4459
4459
  return {
4460
4460
  content: [{ type: "text", text: "OK" }]
@@ -7172,7 +7172,7 @@ class StdioServerTransport {
7172
7172
 
7173
7173
  // package.json
7174
7174
  var name = "@fazer-ai/mcp-obsidian";
7175
- var version = "1.0.13";
7175
+ var version = "1.0.15";
7176
7176
 
7177
7177
  // src/index.ts
7178
7178
  var server = new McpServer({ name, version }, {
@@ -7182,13 +7182,6 @@ registerTools(server);
7182
7182
  async function main() {
7183
7183
  const transport = new StdioServerTransport;
7184
7184
  await server.connect(transport);
7185
- transport.onmessage = (message) => {
7186
- server.server.sendLoggingMessage({
7187
- level: "error",
7188
- data: `transport.onmessage=${message}`
7189
- });
7190
- writeFileSync("transport.log", JSON.stringify(message, null, 2));
7191
- };
7192
7185
  console.error(`Running ${name}@${version} MCP Server on stdio`);
7193
7186
  }
7194
7187
  main().catch((error) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fazer-ai/mcp-obsidian",
3
- "version": "1.0.13",
3
+ "version": "1.0.15",
4
4
  "module": "src/index.ts",
5
5
  "main": "dist/index.js",
6
6
  "bin": "dist/index.js",