cookbook-co-mcp 0.4.0 → 0.5.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.
package/README.md CHANGED
@@ -127,9 +127,10 @@ over stdio the connection is pinned to the older protocol for its lifetime.
127
127
  | `COOKBOOK_READ_ONLY` | Set to `1` to register only the read tools. |
128
128
  | `COOKBOOK_PORT` | Port for `serve` (or pass it as `serve <port>`). |
129
129
  | `COOKBOOK_DEFAULT_SHOPPING_LIST` | Shopping list used when a tool is given none. Default `Shopping List`. |
130
- | `COOKBOOK_BACKUP_DIR` | Where recipe backups go. Default `~/.local/state/cookbook-mcp/backups`. |
130
+ | `COOKBOOK_STATE_DIR` | Base folder for backups and exports, used as given. Default `$XDG_STATE_HOME/cookbook-mcp`, else `~/.local/state/cookbook-mcp`, else `cookbook-mcp` under the system temp folder when that is not writable. Set it on a hosted server to a persistent volume. |
131
+ | `COOKBOOK_BACKUP_DIR` | Where recipe backups go. Default `<state dir>/backups`. |
131
132
  | `COOKBOOK_BACKUP_KEEP` | Edit backups kept per recipe. Default 20. |
132
- | `COOKBOOK_EXPORT_DIR` | Where exports go when no path is given. Default `~/Downloads`, else `~/.local/state/cookbook-mcp/exports`. |
133
+ | `COOKBOOK_EXPORT_DIR` | Where exports go when no path is given. Default `~/Downloads`, else `<state dir>/exports`. |
133
134
 
134
135
  ### Cache timings
135
136
 
@@ -103162,9 +103162,9 @@ var require_codegen = /* @__PURE__ */ __commonJSMin(((exports) => {
103162
103162
  const rhs = this.rhs === void 0 ? "" : ` = ${this.rhs}`;
103163
103163
  return `${varKind} ${this.name}${rhs};` + _n;
103164
103164
  }
103165
- optimizeNames(names, constants2) {
103165
+ optimizeNames(names, constants3) {
103166
103166
  if (!names[this.name.str]) return;
103167
- if (this.rhs) this.rhs = optimizeExpr(this.rhs, names, constants2);
103167
+ if (this.rhs) this.rhs = optimizeExpr(this.rhs, names, constants3);
103168
103168
  return this;
103169
103169
  }
103170
103170
  get names() {
@@ -103181,9 +103181,9 @@ var require_codegen = /* @__PURE__ */ __commonJSMin(((exports) => {
103181
103181
  render({ _n }) {
103182
103182
  return `${this.lhs} = ${this.rhs};` + _n;
103183
103183
  }
103184
- optimizeNames(names, constants2) {
103184
+ optimizeNames(names, constants3) {
103185
103185
  if (this.lhs instanceof code_1.Name && !names[this.lhs.str] && !this.sideEffects) return;
103186
- this.rhs = optimizeExpr(this.rhs, names, constants2);
103186
+ this.rhs = optimizeExpr(this.rhs, names, constants3);
103187
103187
  return this;
103188
103188
  }
103189
103189
  get names() {
@@ -103242,8 +103242,8 @@ var require_codegen = /* @__PURE__ */ __commonJSMin(((exports) => {
103242
103242
  optimizeNodes() {
103243
103243
  return `${this.code}` ? this : void 0;
103244
103244
  }
103245
- optimizeNames(names, constants2) {
103246
- this.code = optimizeExpr(this.code, names, constants2);
103245
+ optimizeNames(names, constants3) {
103246
+ this.code = optimizeExpr(this.code, names, constants3);
103247
103247
  return this;
103248
103248
  }
103249
103249
  get names() {
@@ -103269,12 +103269,12 @@ var require_codegen = /* @__PURE__ */ __commonJSMin(((exports) => {
103269
103269
  }
103270
103270
  return nodes.length > 0 ? this : void 0;
103271
103271
  }
103272
- optimizeNames(names, constants2) {
103272
+ optimizeNames(names, constants3) {
103273
103273
  const { nodes } = this;
103274
103274
  let i2 = nodes.length;
103275
103275
  while (i2--) {
103276
103276
  const n2 = nodes[i2];
103277
- if (n2.optimizeNames(names, constants2)) continue;
103277
+ if (n2.optimizeNames(names, constants3)) continue;
103278
103278
  subtractNames(names, n2.names);
103279
103279
  nodes.splice(i2, 1);
103280
103280
  }
@@ -103321,11 +103321,11 @@ var require_codegen = /* @__PURE__ */ __commonJSMin(((exports) => {
103321
103321
  if (cond === false || !this.nodes.length) return void 0;
103322
103322
  return this;
103323
103323
  }
103324
- optimizeNames(names, constants2) {
103324
+ optimizeNames(names, constants3) {
103325
103325
  var _a4;
103326
- this.else = (_a4 = this.else) === null || _a4 === void 0 ? void 0 : _a4.optimizeNames(names, constants2);
103327
- if (!(super.optimizeNames(names, constants2) || this.else)) return;
103328
- this.condition = optimizeExpr(this.condition, names, constants2);
103326
+ this.else = (_a4 = this.else) === null || _a4 === void 0 ? void 0 : _a4.optimizeNames(names, constants3);
103327
+ if (!(super.optimizeNames(names, constants3) || this.else)) return;
103328
+ this.condition = optimizeExpr(this.condition, names, constants3);
103329
103329
  return this;
103330
103330
  }
103331
103331
  get names() {
@@ -103347,9 +103347,9 @@ var require_codegen = /* @__PURE__ */ __commonJSMin(((exports) => {
103347
103347
  render(opts) {
103348
103348
  return `for(${this.iteration})` + super.render(opts);
103349
103349
  }
103350
- optimizeNames(names, constants2) {
103351
- if (!super.optimizeNames(names, constants2)) return;
103352
- this.iteration = optimizeExpr(this.iteration, names, constants2);
103350
+ optimizeNames(names, constants3) {
103351
+ if (!super.optimizeNames(names, constants3)) return;
103352
+ this.iteration = optimizeExpr(this.iteration, names, constants3);
103353
103353
  return this;
103354
103354
  }
103355
103355
  get names() {
@@ -103384,9 +103384,9 @@ var require_codegen = /* @__PURE__ */ __commonJSMin(((exports) => {
103384
103384
  render(opts) {
103385
103385
  return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts);
103386
103386
  }
103387
- optimizeNames(names, constants2) {
103388
- if (!super.optimizeNames(names, constants2)) return;
103389
- this.iterable = optimizeExpr(this.iterable, names, constants2);
103387
+ optimizeNames(names, constants3) {
103388
+ if (!super.optimizeNames(names, constants3)) return;
103389
+ this.iterable = optimizeExpr(this.iterable, names, constants3);
103390
103390
  return this;
103391
103391
  }
103392
103392
  get names() {
@@ -103425,11 +103425,11 @@ var require_codegen = /* @__PURE__ */ __commonJSMin(((exports) => {
103425
103425
  (_b = this.finally) === null || _b === void 0 || _b.optimizeNodes();
103426
103426
  return this;
103427
103427
  }
103428
- optimizeNames(names, constants2) {
103428
+ optimizeNames(names, constants3) {
103429
103429
  var _a4, _b;
103430
- super.optimizeNames(names, constants2);
103431
- (_a4 = this.catch) === null || _a4 === void 0 || _a4.optimizeNames(names, constants2);
103432
- (_b = this.finally) === null || _b === void 0 || _b.optimizeNames(names, constants2);
103430
+ super.optimizeNames(names, constants3);
103431
+ (_a4 = this.catch) === null || _a4 === void 0 || _a4.optimizeNames(names, constants3);
103432
+ (_b = this.finally) === null || _b === void 0 || _b.optimizeNames(names, constants3);
103433
103433
  return this;
103434
103434
  }
103435
103435
  get names() {
@@ -103678,7 +103678,7 @@ var require_codegen = /* @__PURE__ */ __commonJSMin(((exports) => {
103678
103678
  function addExprNames(names, from) {
103679
103679
  return from instanceof code_1._CodeOrName ? addNames(names, from.names) : names;
103680
103680
  }
103681
- function optimizeExpr(expr, names, constants2) {
103681
+ function optimizeExpr(expr, names, constants3) {
103682
103682
  if (expr instanceof code_1.Name) return replaceName(expr);
103683
103683
  if (!canOptimize(expr)) return expr;
103684
103684
  return new code_1._Code(expr._items.reduce((items, c3) => {
@@ -103688,13 +103688,13 @@ var require_codegen = /* @__PURE__ */ __commonJSMin(((exports) => {
103688
103688
  return items;
103689
103689
  }, []));
103690
103690
  function replaceName(n2) {
103691
- const c3 = constants2[n2.str];
103691
+ const c3 = constants3[n2.str];
103692
103692
  if (c3 === void 0 || names[n2.str] !== 1) return n2;
103693
103693
  delete names[n2.str];
103694
103694
  return c3;
103695
103695
  }
103696
103696
  function canOptimize(e) {
103697
- return e instanceof code_1._Code && e._items.some((c3) => c3 instanceof code_1.Name && names[c3.str] === 1 && constants2[c3.str] !== void 0);
103697
+ return e instanceof code_1._Code && e._items.some((c3) => c3 instanceof code_1.Name && names[c3.str] === 1 && constants3[c3.str] !== void 0);
103698
103698
  }
103699
103699
  }
103700
103700
  function subtractNames(names, from) {
@@ -167577,11 +167577,12 @@ var TOOLS = [...recipeTools, ...tagTools, ...mealPlanTools, ...shoppingTools];
167577
167577
 
167578
167578
  // src/server/config.ts
167579
167579
  var import_ms11 = __toESM(require_ms(), 1);
167580
- import { homedir } from "node:os";
167581
- import { join as join3 } from "node:path";
167580
+ import { accessSync, constants } from "node:fs";
167581
+ import { homedir, tmpdir } from "node:os";
167582
+ import { dirname as dirname2, join as join3 } from "node:path";
167582
167583
  function loadConfig(env = process.env, home = homedir()) {
167583
167584
  if (!env.COOKBOOK_TOKEN) throw new Error("COOKBOOK_TOKEN is not set");
167584
- const state = join3(home, ".local/state/cookbook-mcp");
167585
+ const state = stateDir(env, home);
167585
167586
  return {
167586
167587
  token: cleanToken(env.COOKBOOK_TOKEN),
167587
167588
  readOnly: env.COOKBOOK_READ_ONLY === "1",
@@ -167593,6 +167594,23 @@ function loadConfig(env = process.env, home = homedir()) {
167593
167594
  cache: loadCacheSettings(env)
167594
167595
  };
167595
167596
  }
167597
+ function stateDir(env, home) {
167598
+ if (env.COOKBOOK_STATE_DIR) return env.COOKBOOK_STATE_DIR;
167599
+ const base = env.XDG_STATE_HOME || join3(home, ".local/state");
167600
+ const preferred = join3(base, "cookbook-mcp");
167601
+ return canCreate(preferred) ? preferred : join3(tmpdir(), "cookbook-mcp");
167602
+ }
167603
+ function canCreate(path) {
167604
+ try {
167605
+ accessSync(path, constants.W_OK);
167606
+ return true;
167607
+ } catch (error62) {
167608
+ const { code } = error62;
167609
+ if (code !== "ENOENT") return false;
167610
+ const parent = dirname2(path);
167611
+ return parent !== path && canCreate(parent);
167612
+ }
167613
+ }
167596
167614
  var CACHE_VARIABLES = {
167597
167615
  recipes: "RECIPES",
167598
167616
  mealPlan: "MEAL_PLAN",
@@ -167661,7 +167679,7 @@ function createServerFactory(log) {
167661
167679
  };
167662
167680
  const create3 = () => {
167663
167681
  const server = new McpServer(
167664
- { name: "cookbook", version: "0.4.0" },
167682
+ { name: "cookbook", version: "0.5.0" },
167665
167683
  { instructions: serverInstructions(config2) }
167666
167684
  );
167667
167685
  registerTools(server, context);
@@ -167676,7 +167694,7 @@ function createServerFactory(log) {
167676
167694
  }
167677
167695
 
167678
167696
  // node_modules/.pnpm/@hono+node-server@2.1.6_hono@4.13.16/node_modules/@hono/node-server/dist/index.mjs
167679
- import { Http2ServerRequest, constants } from "node:http2";
167697
+ import { Http2ServerRequest, constants as constants2 } from "node:http2";
167680
167698
  import { Readable as Readable2 } from "node:stream";
167681
167699
 
167682
167700
  // node_modules/.pnpm/hono@4.13.16/node_modules/hono/dist/helper/websocket/index.js
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cookbook-co-mcp",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Unofficial MCP server for CookBook Co.: recipes, tags, meal planner and shopping lists",
5
5
  "keywords": [
6
6
  "mcp",