@usefillo/mcp 0.10.0 → 0.11.0

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 (3) hide show
  1. package/README.md +13 -4
  2. package/dist/index.js +212 -9
  3. package/package.json +3 -2
package/README.md CHANGED
@@ -25,18 +25,27 @@ human CLI user.
25
25
 
26
26
  One click, if your editor supports it:
27
27
 
28
- [![Add to Cursor](https://img.shields.io/badge/Add_to_Cursor-black?style=for-the-badge&logo=cursor&logoColor=white)](cursor://anysphere.cursor-deeplink/mcp/install?name=fillo&config=eyJ0eXBlIjoic3RkaW8iLCJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkB1c2VmaWxsby9tY3AiXX0=)
29
- [![Add to VS Code](https://img.shields.io/badge/Add_to_VS_Code-007ACC?style=for-the-badge&logo=visual-studio-code&logoColor=white)](vscode:mcp/install?name=fillo&config=%7B%22type%22%3A%22stdio%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40usefillo%2Fmcp%22%5D%7D)
28
+ [![Add to Cursor](https://img.shields.io/badge/Add_to_Cursor-black?style=for-the-badge&logo=cursor&logoColor=white)](cursor://anysphere.cursor-deeplink/mcp/install?name=fillo&config=eyJ0eXBlIjoic3RkaW8iLCJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkB1c2VmaWxsby9tY3BAbGF0ZXN0Il19)
29
+ [![Add to VS Code](https://img.shields.io/badge/Add_to_VS_Code-007ACC?style=for-the-badge&logo=visual-studio-code&logoColor=white)](vscode:mcp/install?name=fillo&config=%7B%22type%22%3A%22stdio%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40usefillo%2Fmcp%40latest%22%5D%7D)
30
30
 
31
31
  Claude Code:
32
32
 
33
33
  ```sh
34
- claude mcp add fillo -- npx -y @usefillo/mcp
34
+ claude mcp add fillo -- npx -y @usefillo/mcp@latest
35
35
  ```
36
36
 
37
- Any other MCP client: run `npx -y @usefillo/mcp` over stdio. Set `FILLO_API` to
37
+ Any other MCP client: run `npx -y @usefillo/mcp@latest` over stdio. Set `FILLO_API` to
38
38
  point at a non-production deployment.
39
39
 
40
+ The local server checks for a newer stable release at startup, at most once an
41
+ hour, and runs it from `~/.fillo/runtime`. Reconnect to acquire updates; a running
42
+ connection keeps its version until it ends. Failed or offline downloads keep the
43
+ installed server available. Update diagnostics go to stderr, preserving the
44
+ JSON-RPC channel. Set `FILLO_AUTO_UPDATE=0` to pin your installed version; CI and
45
+ development checkouts skip updates. Existing installations acquire this behavior
46
+ by reconnecting with the `@latest` command above. The hosted MCP server uses the
47
+ deployed server version directly.
48
+
40
49
  ### Choose a focused toolset
41
50
 
42
51
  The default server loads the complete catalogue. Set `FILLO_MCP_TOOLSET` in the server's environment to choose a task area:
package/dist/index.js CHANGED
@@ -3,16 +3,218 @@
3
3
  // src/index.ts
4
4
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
5
5
 
6
+ // ../agent-runtime/index.mjs
7
+ import { spawn } from "child_process";
8
+ import {
9
+ existsSync,
10
+ mkdirSync,
11
+ mkdtempSync,
12
+ readFileSync,
13
+ realpathSync,
14
+ renameSync,
15
+ rmSync,
16
+ writeFileSync
17
+ } from "fs";
18
+ import { constants, homedir } from "os";
19
+ import { delimiter, dirname, join } from "path";
20
+ import { fileURLToPath } from "url";
21
+ var REGISTRY = "https://registry.npmjs.org";
22
+ var PACKAGES = /* @__PURE__ */ new Set(["@usefillo/cli", "@usefillo/mcp"]);
23
+ var CHECK_INTERVAL = 60 * 60 * 1e3;
24
+ var stableVersion = (value) => typeof value === "string" && /^\d+\.\d+\.\d+$/.test(value);
25
+ var readJson = (path) => {
26
+ try {
27
+ return JSON.parse(readFileSync(path, "utf8"));
28
+ } catch {
29
+ return null;
30
+ }
31
+ };
32
+ function newer(candidate, current) {
33
+ const next = candidate.split(".").map(Number);
34
+ const before = current.split(".").map(Number);
35
+ for (let i = 0; i < 3; i++) {
36
+ if (next[i] !== before[i]) return next[i] > before[i];
37
+ }
38
+ return false;
39
+ }
40
+ function npmEntry() {
41
+ const nodeDir = dirname(realpathSync(process.execPath));
42
+ const candidates = [
43
+ process.env.npm_execpath,
44
+ join(nodeDir, "node_modules/npm/bin/npm-cli.js"),
45
+ join(nodeDir, "../lib/node_modules/npm/bin/npm-cli.js"),
46
+ ...(process.env.PATH ?? "").split(delimiter).map((dir) => join(dir, "npm"))
47
+ ];
48
+ for (const candidate of candidates) {
49
+ if (!candidate) continue;
50
+ try {
51
+ const path = realpathSync(candidate);
52
+ if (path.endsWith("npm-cli.js")) return path;
53
+ } catch {
54
+ }
55
+ }
56
+ return null;
57
+ }
58
+ async function installPackage(packageName, version, prefix) {
59
+ const npm = npmEntry();
60
+ if (!npm) return false;
61
+ return new Promise((resolve) => {
62
+ const child = spawn(
63
+ process.execPath,
64
+ [
65
+ npm,
66
+ "install",
67
+ `${packageName}@${version}`,
68
+ "--prefix",
69
+ prefix,
70
+ "--ignore-scripts",
71
+ "--engine-strict",
72
+ "--no-save",
73
+ "--package-lock=false",
74
+ "--audit=false",
75
+ "--fund=false",
76
+ `--registry=${REGISTRY}`,
77
+ `--@usefillo:registry=${REGISTRY}`,
78
+ "--fetch-timeout=10000",
79
+ "--fetch-retries=0",
80
+ "--loglevel=error"
81
+ ],
82
+ {
83
+ // npm diagnostics, including its ordinary install summary, must never
84
+ // appear on the CLI's JSON/MCP's JSON-RPC stdout channel.
85
+ stdio: ["ignore", "ignore", "inherit"],
86
+ timeout: 3e4,
87
+ killSignal: "SIGKILL",
88
+ windowsHide: true
89
+ }
90
+ );
91
+ child.once("error", () => resolve(false));
92
+ child.once("exit", (code) => resolve(code === 0));
93
+ });
94
+ }
95
+ function installedEntry(prefix, packageName, version) {
96
+ const root = join(prefix, "node_modules", packageName);
97
+ const pkg = readJson(join(root, "package.json"));
98
+ const entry = join(root, "dist/index.js");
99
+ return pkg?.name === packageName && pkg.version === version && existsSync(entry) ? entry : null;
100
+ }
101
+ async function resolveLatestRuntime(packageName, packageRoot, {
102
+ cacheRoot = join(homedir(), ".fillo/runtime"),
103
+ env = process.env,
104
+ fetchVersion = async () => {
105
+ const response = await fetch(`${REGISTRY}/${encodeURIComponent(packageName)}/latest`, {
106
+ signal: AbortSignal.timeout(2e3),
107
+ redirect: "error"
108
+ });
109
+ if (!response.ok) throw new Error("Version check unavailable");
110
+ return (await response.json()).version;
111
+ },
112
+ install = installPackage,
113
+ now = Date.now()
114
+ } = {}) {
115
+ if (!PACKAGES.has(packageName)) return null;
116
+ if (env.FILLO_AUTO_UPDATE === "0" || env.FILLO_RUNTIME_UPDATED === "1" || env.CI) return null;
117
+ if (existsSync(join(packageRoot, "src/index.ts"))) return null;
118
+ const current = readJson(join(packageRoot, "package.json"))?.version;
119
+ if (!stableVersion(current)) return null;
120
+ const name = packageName.split("/")[1];
121
+ const metadataPath = join(cacheRoot, `${name}-latest.json`);
122
+ const cached = readJson(metadataPath);
123
+ let version = stableVersion(cached?.version) ? cached.version : null;
124
+ let online = false;
125
+ const age = now - cached?.checkedAt;
126
+ if (!version || !Number.isFinite(age) || age < 0 || age >= CHECK_INTERVAL) {
127
+ try {
128
+ const latest = await fetchVersion();
129
+ if (!stableVersion(latest)) return null;
130
+ version = latest;
131
+ online = true;
132
+ try {
133
+ mkdirSync(cacheRoot, { recursive: true, mode: 448 });
134
+ writeFileSync(metadataPath, JSON.stringify({ version, checkedAt: now }), { mode: 384 });
135
+ } catch {
136
+ }
137
+ } catch {
138
+ }
139
+ } else {
140
+ online = true;
141
+ }
142
+ if (!version || !newer(version, current)) return null;
143
+ const destination = join(cacheRoot, `${name}-${version}-node${process.versions.node}`);
144
+ const existing = installedEntry(destination, packageName, version);
145
+ if (existing) return existing;
146
+ if (!online) return null;
147
+ const failureAge = now - cached?.failedAt;
148
+ if (Number.isFinite(failureAge) && failureAge >= 0 && failureAge < CHECK_INTERVAL) return null;
149
+ let staging;
150
+ try {
151
+ mkdirSync(cacheRoot, { recursive: true, mode: 448 });
152
+ staging = mkdtempSync(join(cacheRoot, `${name}-${version}.install-`));
153
+ if (!await install(packageName, version, staging) || !installedEntry(staging, packageName, version)) {
154
+ writeFileSync(metadataPath, JSON.stringify({ version, checkedAt: now, failedAt: now }), {
155
+ mode: 384
156
+ });
157
+ return null;
158
+ }
159
+ try {
160
+ renameSync(staging, destination);
161
+ } catch {
162
+ if (!installedEntry(destination, packageName, version)) return null;
163
+ }
164
+ return installedEntry(destination, packageName, version);
165
+ } catch {
166
+ return null;
167
+ } finally {
168
+ if (staging) {
169
+ try {
170
+ rmSync(staging, { recursive: true, force: true });
171
+ } catch {
172
+ }
173
+ }
174
+ }
175
+ }
176
+ async function runLatest(packageName, entryUrl) {
177
+ const root = fileURLToPath(new URL("../", entryUrl));
178
+ const entry = await resolveLatestRuntime(packageName, root);
179
+ if (!entry) return false;
180
+ process.stderr.write(`Fillo: using the latest downloaded ${packageName}.
181
+ `);
182
+ const child = spawn(process.execPath, [entry, ...process.argv.slice(2)], {
183
+ stdio: "inherit",
184
+ env: { ...process.env, FILLO_RUNTIME_UPDATED: "1" }
185
+ });
186
+ const forwardInt = () => child.kill("SIGINT");
187
+ const forwardTerm = () => child.kill("SIGTERM");
188
+ process.on("SIGINT", forwardInt);
189
+ process.on("SIGTERM", forwardTerm);
190
+ let started = false;
191
+ child.once("spawn", () => {
192
+ started = true;
193
+ });
194
+ try {
195
+ const result = await new Promise((resolve) => {
196
+ child.once("error", () => resolve(started ? 1 : null));
197
+ child.once("exit", (code, signal) => resolve(code ?? 128 + (constants.signals[signal] ?? 1)));
198
+ });
199
+ if (result === null) return false;
200
+ process.exitCode = result;
201
+ return true;
202
+ } finally {
203
+ process.removeListener("SIGINT", forwardInt);
204
+ process.removeListener("SIGTERM", forwardTerm);
205
+ }
206
+ }
207
+
6
208
  // src/config.ts
7
- import { chmodSync, mkdirSync, readFileSync, writeFileSync } from "fs";
8
- import { homedir } from "os";
9
- import { join } from "path";
209
+ import { chmodSync, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
210
+ import { homedir as homedir2 } from "os";
211
+ import { join as join2 } from "path";
10
212
  var DEFAULT_API = "https://fillo.so";
11
213
  var REQUEST_TIMEOUT_MS = 3e4;
12
214
  var CLIENT_VERSION = `@usefillo/mcp@${packageVersion()}`;
13
215
  function packageVersion() {
14
216
  try {
15
- const pkg = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
217
+ const pkg = JSON.parse(readFileSync2(new URL("../package.json", import.meta.url), "utf8"));
16
218
  return typeof pkg.version === "string" ? pkg.version : "0.0.0";
17
219
  } catch {
18
220
  return "0.0.0";
@@ -22,14 +224,14 @@ function apiOrigin() {
22
224
  return (process.env.FILLO_API ?? DEFAULT_API).replace(/\/$/, "");
23
225
  }
24
226
  function configDir() {
25
- return process.env.FILLO_CONFIG_DIR?.trim() || join(homedir(), ".fillo");
227
+ return process.env.FILLO_CONFIG_DIR?.trim() || join2(homedir2(), ".fillo");
26
228
  }
27
229
  function configPath() {
28
- return join(configDir(), "config.json");
230
+ return join2(configDir(), "config.json");
29
231
  }
30
232
  function readConfig() {
31
233
  try {
32
- const parsed = JSON.parse(readFileSync(configPath(), "utf8"));
234
+ const parsed = JSON.parse(readFileSync2(configPath(), "utf8"));
33
235
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
34
236
  const record = parsed;
35
237
  const provision = record.provision && typeof record.provision === "object" && !Array.isArray(record.provision) ? record.provision : void 0;
@@ -48,12 +250,12 @@ function readConfig() {
48
250
  }
49
251
  function writeConfig(next) {
50
252
  const dir = configDir();
51
- mkdirSync(dir, { recursive: true, mode: 448 });
253
+ mkdirSync2(dir, { recursive: true, mode: 448 });
52
254
  try {
53
255
  chmodSync(dir, 448);
54
256
  } catch {
55
257
  }
56
- writeFileSync(configPath(), JSON.stringify(next, null, 2), { mode: 384 });
258
+ writeFileSync2(configPath(), JSON.stringify(next, null, 2), { mode: 384 });
57
259
  try {
58
260
  chmodSync(configPath(), 384);
59
261
  } catch {
@@ -8216,6 +8418,7 @@ function registerDiscovery(server) {
8216
8418
 
8217
8419
  // src/index.ts
8218
8420
  async function main() {
8421
+ if (await runLatest("@usefillo/mcp", import.meta.url)) return;
8219
8422
  const version = CLIENT_VERSION.split("@").pop() ?? "0.0.0";
8220
8423
  const server = new ObservedMcpServer({ name: "fillo", version });
8221
8424
  const toolset = parseToolset(process.env.FILLO_MCP_TOOLSET);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usefillo/mcp",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "mcpName": "io.github.jacobfunch/usefillo",
5
5
  "description": "Fillo MCP server — provision, scaffold, publish, and query forms from your coding agent.",
6
6
  "license": "MIT",
@@ -41,7 +41,8 @@
41
41
  "devDependencies": {
42
42
  "@types/node": "^22.10.0",
43
43
  "tsup": "^8.4.0",
44
- "typescript": "^5.8.3"
44
+ "typescript": "^5.8.3",
45
+ "@usefillo/agent-runtime": "0.0.0"
45
46
  },
46
47
  "scripts": {
47
48
  "build": "tsup",