@actioneer/ads-mcp 0.1.0 → 0.2.1

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
@@ -39,8 +39,11 @@ All five tools read the L1 catalog (`ads-manifest.json`).
39
39
  }
40
40
  ```
41
41
 
42
- `ads-mcp` resolves the catalog from the installed `@actioneer/ads/manifest.json`
43
- automatically. Override with `ADS_MANIFEST`:
42
+ `ads-mcp` is **self-contained**: it ships a bundled catalog snapshot, so
43
+ `npx -y @actioneer/ads-mcp` works standalone with nothing else installed. When
44
+ `@actioneer/ads` *is* installed alongside it, the server prefers that package's
45
+ `manifest.json` so the catalog matches the exact version you import. Override
46
+ either with `ADS_MANIFEST`:
44
47
 
45
48
  ```json
46
49
  {
@@ -65,8 +68,9 @@ generated repo-root `ads-manifest.json`). A ready-to-copy example lives at
65
68
  ## Manifest resolution order
66
69
 
67
70
  1. `$ADS_MANIFEST` (explicit path)
68
- 2. `@actioneer/ads/manifest.json` (the installed package's catalog)
69
- 3. `<repo>/ads-manifest.json` (local devgenerated by `npm run build:lib` / `prebuild`)
71
+ 2. `@actioneer/ads/manifest.json` (the consumer's installed ADS version — exact match)
72
+ 3. `<this package>/manifest.json` (the snapshot bundled at publish the self-contained fallback that makes `npx` work with no ADS installed)
73
+ 4. `<repo>/ads-manifest.json` (local dev — generated by `npm run manifest` / `prebuild`)
70
74
 
71
75
  ## Development
72
76
 
package/bin/ads-mcp.mjs CHANGED
@@ -2,9 +2,14 @@
2
2
  // ADS MCP server entry — loads the ADS manifest and starts the stdio server.
3
3
  //
4
4
  // Manifest resolution order (first hit wins):
5
- // 1. $ADS_MANIFEST (explicit path override)
6
- // 2. @actioneer/ads/manifest.json (the installed package's catalog)
7
- // 3. <repo>/ads-manifest.json (local dev, generated by build)
5
+ // 1. $ADS_MANIFEST (explicit path override)
6
+ // 2. @actioneer/ads/manifest.json (the consumer's installed ADS version —
7
+ // preferred, so the catalog matches what
8
+ // they actually import)
9
+ // 3. <this package>/manifest.json (the snapshot BUNDLED at publish time —
10
+ // makes `npx @actioneer/ads-mcp` work
11
+ // standalone, with no ADS installed)
12
+ // 4. <repo>/ads-manifest.json (monorepo dev, generated by the build)
8
13
  //
9
14
  // Wire it into Claude Code / Cursor via .mcp.json (see tools/ads-mcp/README.md).
10
15
 
@@ -18,12 +23,19 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
18
23
  const require = createRequire(import.meta.url);
19
24
 
20
25
  function resolveManifestPath() {
26
+ // 1. Explicit override.
21
27
  if (process.env.ADS_MANIFEST && existsSync(process.env.ADS_MANIFEST)) return process.env.ADS_MANIFEST;
28
+ // 2. The consumer's installed @actioneer/ads (best-effort; it's an optional peer).
22
29
  try {
23
30
  return require.resolve("@actioneer/ads/manifest.json");
24
31
  } catch {
25
- /* not installed as a package — fall through to repo dev copy */
32
+ /* not resolvable from here — fall through */
26
33
  }
34
+ // 3. The snapshot bundled INTO this package by `prepack` — the self-contained
35
+ // fallback that guarantees a published install always has a catalog.
36
+ const bundled = resolve(__dirname, "../manifest.json");
37
+ if (existsSync(bundled)) return bundled;
38
+ // 4. Monorepo dev copy (generated at the repo root by `npm run manifest`).
27
39
  const repoCopy = resolve(__dirname, "../../../ads-manifest.json");
28
40
  if (existsSync(repoCopy)) return repoCopy;
29
41
  return null;
@@ -32,8 +44,8 @@ function resolveManifestPath() {
32
44
  const manifestPath = resolveManifestPath();
33
45
  if (!manifestPath) {
34
46
  console.error(
35
- "ads-mcp: could not find ads-manifest.json. Set $ADS_MANIFEST, install @actioneer/ads, " +
36
- "or run the build so ads-manifest.json exists at the repo root."
47
+ "ads-mcp: could not find a manifest. This should not happen in a published install " +
48
+ "(one ships bundled). For local dev, set $ADS_MANIFEST or run `npm run manifest` at the repo root."
37
49
  );
38
50
  process.exit(1);
39
51
  }