@allourthings/mcp-server 0.1.0 → 0.2.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 +5 -5
  2. package/dist/index.js +33 -151
  3. package/package.json +7 -1
package/README.md CHANGED
@@ -76,11 +76,11 @@ Attachments (manuals, receipts, photos) sit alongside the item JSON. The vault i
76
76
 
77
77
  ## Configuration
78
78
 
79
- | Method | Example |
80
- |---|---|
81
- | `--data-dir` arg *(recommended)* | `--data-dir ~/Documents/AllOurThings` |
82
- | `ALLOURTHINGS_DATA_DIR` env var | `ALLOURTHINGS_DATA_DIR=~/Documents/AllOurThings` |
83
- | Default (no config needed) | `~/Documents/AllOurThings` |
79
+ The `--data-dir` arg controls where your inventory is stored. It defaults to `~/Documents/AllOurThings` if omitted. To use a different location, update the path in your MCP client config:
80
+
81
+ ```json
82
+ "args": ["-y", "@allourthings/mcp-server", "--data-dir", "/path/to/your/vault"]
83
+ ```
84
84
 
85
85
  ## Item schema
86
86
 
package/dist/index.js CHANGED
@@ -11140,10 +11140,35 @@ class StdioServerTransport {
11140
11140
  }
11141
11141
  }
11142
11142
 
11143
- // src/backends/filesystem.ts
11144
- import { readFile, writeFile, mkdir, readdir, rename, rm } from "fs/promises";
11145
- import { existsSync } from "fs";
11146
- import { join } from "path";
11143
+ // src/backends/native.ts
11144
+ import { createRequire } from "module";
11145
+ var require2 = createRequire(import.meta.url);
11146
+ var { JsCatalogStore } = require2("@allourthings/core");
11147
+
11148
+ class NativeBackend {
11149
+ store;
11150
+ constructor(dataDir) {
11151
+ this.store = new JsCatalogStore(dataDir);
11152
+ }
11153
+ async addItem(newItem) {
11154
+ return this.store.addItem(newItem);
11155
+ }
11156
+ async getItem(idOrName) {
11157
+ return this.store.getItem(idOrName);
11158
+ }
11159
+ async listItems(filter) {
11160
+ return this.store.listItems(filter ?? null);
11161
+ }
11162
+ async updateItem(id, updates) {
11163
+ return this.store.updateItem(id, updates);
11164
+ }
11165
+ async deleteItem(id) {
11166
+ return this.store.deleteItem(id);
11167
+ }
11168
+ async searchItems(query) {
11169
+ return this.store.searchItems(query);
11170
+ }
11171
+ }
11147
11172
 
11148
11173
  // ../../node_modules/zod/v3/external.js
11149
11174
  var exports_external = {};
@@ -15118,148 +15143,6 @@ var coerce = {
15118
15143
  date: (arg) => ZodDate.create({ ...arg, coerce: true })
15119
15144
  };
15120
15145
  var NEVER2 = INVALID;
15121
- // src/schema.ts
15122
- var AttachmentSchema = exports_external.object({
15123
- filename: exports_external.string(),
15124
- type: exports_external.enum(["manual", "receipt", "photo", "warranty", "other"]),
15125
- label: exports_external.string().optional()
15126
- });
15127
- var ItemSchema = exports_external.object({
15128
- id: exports_external.string(),
15129
- name: exports_external.string(),
15130
- created_at: exports_external.string().datetime(),
15131
- updated_at: exports_external.string().datetime(),
15132
- category: exports_external.string().optional(),
15133
- brand: exports_external.string().optional(),
15134
- model: exports_external.string().optional(),
15135
- purchase_date: exports_external.string().optional(),
15136
- purchase_price: exports_external.number().optional(),
15137
- currency: exports_external.string().optional(),
15138
- warranty_expires: exports_external.string().optional(),
15139
- retailer: exports_external.string().optional(),
15140
- location: exports_external.string().optional(),
15141
- features: exports_external.array(exports_external.string()).optional(),
15142
- notes: exports_external.string().optional(),
15143
- tags: exports_external.array(exports_external.string()).optional(),
15144
- attachments: exports_external.array(AttachmentSchema).optional()
15145
- }).passthrough();
15146
- var NewItemSchema = ItemSchema.omit({
15147
- id: true,
15148
- created_at: true,
15149
- updated_at: true
15150
- }).passthrough();
15151
-
15152
- // src/utils.ts
15153
- import { randomBytes } from "crypto";
15154
- function generateId() {
15155
- return randomBytes(4).toString("hex");
15156
- }
15157
- function toSlug(name) {
15158
- return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 50).replace(/-+$/, "");
15159
- }
15160
-
15161
- // src/backends/filesystem.ts
15162
- class FilesystemBackend {
15163
- dataDir;
15164
- constructor(dataDir) {
15165
- this.dataDir = dataDir;
15166
- }
15167
- get itemsDir() {
15168
- return join(this.dataDir, "items");
15169
- }
15170
- itemDirPath(name, id) {
15171
- return join(this.itemsDir, `${toSlug(name)}-${id}`);
15172
- }
15173
- async findDirById(id) {
15174
- if (!existsSync(this.itemsDir))
15175
- return null;
15176
- const entries = await readdir(this.itemsDir);
15177
- const match = entries.find((e) => e.slice(-8) === id);
15178
- return match ? join(this.itemsDir, match) : null;
15179
- }
15180
- async readItemFromDir(dir) {
15181
- const raw = await readFile(join(dir, "item.json"), "utf-8");
15182
- return ItemSchema.parse(JSON.parse(raw));
15183
- }
15184
- async writeItemToDir(dir, item) {
15185
- await mkdir(dir, { recursive: true });
15186
- await writeFile(join(dir, "item.json"), JSON.stringify(item, null, 2));
15187
- }
15188
- async loadAll() {
15189
- if (!existsSync(this.itemsDir))
15190
- return [];
15191
- const entries = await readdir(this.itemsDir);
15192
- const items = [];
15193
- for (const entry of entries) {
15194
- const itemPath = join(this.itemsDir, entry, "item.json");
15195
- if (!existsSync(itemPath))
15196
- continue;
15197
- try {
15198
- const raw = await readFile(itemPath, "utf-8");
15199
- items.push(ItemSchema.parse(JSON.parse(raw)));
15200
- } catch {}
15201
- }
15202
- return items;
15203
- }
15204
- async addItem(newItem) {
15205
- const id = generateId();
15206
- const now = new Date().toISOString();
15207
- const item = { ...newItem, id, created_at: now, updated_at: now };
15208
- await this.writeItemToDir(this.itemDirPath(item.name, id), item);
15209
- return item;
15210
- }
15211
- async getItem(idOrName) {
15212
- const dirById = await this.findDirById(idOrName);
15213
- if (dirById)
15214
- return this.readItemFromDir(dirById);
15215
- const items = await this.loadAll();
15216
- const lower = idOrName.toLowerCase();
15217
- return items.find((i) => i.name.toLowerCase() === lower) ?? items.find((i) => i.name.toLowerCase().includes(lower)) ?? null;
15218
- }
15219
- async listItems(filter) {
15220
- let items = await this.loadAll();
15221
- if (filter?.category) {
15222
- items = items.filter((i) => i.category === filter.category);
15223
- }
15224
- if (filter?.location) {
15225
- items = items.filter((i) => i.location?.toLowerCase() === filter.location.toLowerCase());
15226
- }
15227
- if (filter?.tags?.length) {
15228
- items = items.filter((i) => filter.tags.every((tag) => i.tags?.includes(tag)));
15229
- }
15230
- return items;
15231
- }
15232
- async updateItem(id, updates) {
15233
- const oldDir = await this.findDirById(id);
15234
- if (!oldDir)
15235
- return null;
15236
- const existing = await this.readItemFromDir(oldDir);
15237
- const updated = {
15238
- ...existing,
15239
- ...updates,
15240
- id,
15241
- updated_at: new Date().toISOString()
15242
- };
15243
- const newDir = this.itemDirPath(updated.name, id);
15244
- if (oldDir !== newDir) {
15245
- await rename(oldDir, newDir);
15246
- }
15247
- await this.writeItemToDir(newDir, updated);
15248
- return updated;
15249
- }
15250
- async deleteItem(id) {
15251
- const dir = await this.findDirById(id);
15252
- if (!dir)
15253
- return false;
15254
- await rm(dir, { recursive: true });
15255
- return true;
15256
- }
15257
- async searchItems(query) {
15258
- const items = await this.loadAll();
15259
- const lower = query.toLowerCase();
15260
- return items.filter((i) => JSON.stringify(i).toLowerCase().includes(lower));
15261
- }
15262
- }
15263
15146
  // ../../node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
15264
15147
  function isZ4Schema(s) {
15265
15148
  const schema = s;
@@ -17905,7 +17788,6 @@ class Server extends Protocol {
17905
17788
  return this.notification({ method: "notifications/prompts/list_changed" });
17906
17789
  }
17907
17790
  }
17908
-
17909
17791
  // src/tools/add-item.ts
17910
17792
  var addItemInputSchema = exports_external.object({
17911
17793
  name: exports_external.string().describe("Name of the item"),
@@ -18092,10 +17974,10 @@ function createServer(backend) {
18092
17974
 
18093
17975
  // src/config.ts
18094
17976
  import { homedir } from "os";
18095
- import { join as join2 } from "path";
17977
+ import { join } from "path";
18096
17978
  function expandTilde(p) {
18097
17979
  if (p === "~" || p.startsWith("~/")) {
18098
- return join2(homedir(), p.slice(2));
17980
+ return join(homedir(), p.slice(2));
18099
17981
  }
18100
17982
  return p;
18101
17983
  }
@@ -18107,13 +17989,13 @@ function resolveDataDir(argv = process.argv, env = process.env) {
18107
17989
  if (env.ALLOURTHINGS_DATA_DIR) {
18108
17990
  return expandTilde(env.ALLOURTHINGS_DATA_DIR);
18109
17991
  }
18110
- return join2(homedir(), "Documents", "AllOurThings");
17992
+ return join(homedir(), "Documents", "AllOurThings");
18111
17993
  }
18112
17994
 
18113
17995
  // src/index.ts
18114
17996
  var dataDir = resolveDataDir();
18115
17997
  console.error(`[allourthings] data directory: ${dataDir}`);
18116
- var backend = new FilesystemBackend(dataDir);
17998
+ var backend = new NativeBackend(dataDir);
18117
17999
  var server = createServer(backend);
18118
18000
  var transport = new StdioServerTransport;
18119
18001
  await server.connect(transport);
package/package.json CHANGED
@@ -1,8 +1,13 @@
1
1
  {
2
2
  "name": "@allourthings/mcp-server",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
+ "mcpName": "io.allourthings/mcp-server",
4
5
  "description": "MCP server for All Our Things — AI-powered household inventory",
5
6
  "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/matt-harding/allourthings-mcp.git"
10
+ },
6
11
  "type": "module",
7
12
  "files": [
8
13
  "dist"
@@ -19,6 +24,7 @@
19
24
  },
20
25
  "dependencies": {
21
26
  "@modelcontextprotocol/sdk": "^1.27.1",
27
+ "@allourthings/core": "^0.1.0",
22
28
  "zod": "^3.24.0",
23
29
  "zod-to-json-schema": "^3.25.1"
24
30
  },