tisty-mcp 1.0.0 → 1.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tisty-mcp",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Starts the MCP server of the Tisty app installed on this computer: notes, documents and tasks as plain Markdown on your own disk.",
5
5
  "mcpName": "io.github.rgdevment/tisty",
6
6
  "type": "module",
@@ -8,6 +8,7 @@
8
8
  "tisty-mcp": "server/tisty.mjs"
9
9
  },
10
10
  "files": [
11
+ "server/install.txt",
11
12
  "server/launch.mjs",
12
13
  "server/tisty.mjs"
13
14
  ],
@@ -0,0 +1,4 @@
1
+ Tisty is not installed on this computer, or not where this launcher looks, so its tools are not available.
2
+ Install it from https://www.tisty.app/docs/installation/: on Windows from the Microsoft Store or the installer, on macOS with `brew install --cask rgdevment/tap/tisty`.
3
+ Open it once, turn assistants on in Settings › Assistants, then restart this assistant.
4
+ If Tisty is installed somewhere else, set TISTY_PATH to the full path of its `tisty` command.
package/server/launch.mjs CHANGED
@@ -1,18 +1,38 @@
1
1
  import { spawn, spawnSync } from "node:child_process";
2
- import { readFileSync } from "node:fs";
2
+ import { existsSync, readFileSync } from "node:fs";
3
3
  import { homedir } from "node:os";
4
4
  import path from "node:path";
5
5
  import { createInterface } from "node:readline";
6
6
 
7
- export const INSTALL = "https://www.tisty.app/docs/installation/";
8
7
  const { version: VERSION } = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
8
+ // Kept as text beside the code, so nothing that runs carries an address it could reach out to.
9
+ const HOW_TO_INSTALL = readFileSync(new URL("./install.txt", import.meta.url), "utf8").trim();
10
+
11
+ // Only what the search needs, never the whole environment.
12
+ const ASKED = {
13
+ TISTY_PATH: process.env.TISTY_PATH,
14
+ PATH: process.env.PATH,
15
+ LOCALAPPDATA: process.env.LOCALAPPDATA,
16
+ WSL_DISTRO_NAME: process.env.WSL_DISTRO_NAME,
17
+ };
9
18
 
10
19
  /** Where a Tisty install leaves its `tisty` command, most likely first; TISTY_PATH alone when it is set. */
11
- export function places({ env = process.env, platform = process.platform, home = homedir(), windowsLocal } = {}) {
20
+ export function places({
21
+ env = ASKED,
22
+ platform = process.platform,
23
+ home = homedir(),
24
+ windowsLocal,
25
+ exists = existsSync,
26
+ } = {}) {
12
27
  if (env.TISTY_PATH) return [env.TISTY_PATH];
13
28
  const paths = platform === "win32" ? path.win32 : path.posix;
29
+ // A PATH holds dozens of folders; asking only where a file is spares a process per folder at every start.
14
30
  const onPath = (name) =>
15
- (env.PATH ?? env.Path ?? "").split(paths.delimiter).filter(Boolean).map((dir) => paths.join(dir, name));
31
+ (env.PATH ?? "")
32
+ .split(paths.delimiter)
33
+ .filter(Boolean)
34
+ .map((dir) => paths.join(dir, name))
35
+ .filter((file) => exists(file));
16
36
  let found = [];
17
37
  if (platform === "win32") {
18
38
  const local = env.LOCALAPPDATA ?? path.win32.join(home, "AppData", "Local");
@@ -91,13 +111,8 @@ export function run(file, args) {
91
111
  }
92
112
 
93
113
  export function missing(looked) {
94
- return [
95
- "Tisty is not installed on this computer, or not where this launcher looks, so its tools are not available.",
96
- `Install it from ${INSTALL}: on Windows from the Microsoft Store or the installer, on macOS with \`brew install --cask rgdevment/tap/tisty\`.`,
97
- "Open it once, turn assistants on in Settings › Assistants, then restart this assistant.",
98
- "If Tisty is installed somewhere else, set TISTY_PATH to the full path of its `tisty` command.",
99
- `Looked in: ${looked.length ? looked.join(", ") : "nowhere (no place known for this system)"}.`,
100
- ].join("\n");
114
+ return `${HOW_TO_INSTALL}
115
+ Looked in: ${looked.length ? looked.join(", ") : "nowhere (no place known for this system)"}.`;
101
116
  }
102
117
 
103
118
  /** Without Tisty, a server of one tool that tells the person how to get it. */