@contenthero/mcp 0.4.12 → 0.4.14

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.
@@ -1 +1 @@
1
- {"version":3,"file":"generation.d.ts","sourceRoot":"","sources":["../../src/widget/generation.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,sBAAsB,4ijyBAA4ijyB,CAAA;AAC/kjyB,eAAO,MAAM,eAAe,WAAW,CAAA"}
1
+ {"version":3,"file":"generation.d.ts","sourceRoot":"","sources":["../../src/widget/generation.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,sBAAsB,gh4yBAAgh4yB,CAAA;AACnj4yB,eAAO,MAAM,eAAe,WAAW,CAAA"}
@@ -8,5 +8,24 @@
8
8
  * ⭐ It lives here rather than in `server.ts` because `format.ts` must not import the server (the server
9
9
  * imports the formatter, and the cycle would be real).
10
10
  */
11
- export declare const GENERATION_WIDGET_URI = "ui://contenthero/generation.html";
11
+ /**
12
+ * ⭐⭐⭐ **VERSION-STAMPED, BECAUSE A HOST CACHES THIS BY NAME AND A FIXED NAME NEVER INVALIDATES.**
13
+ *
14
+ * This was `ui://contenthero/generation.html`, one constant string for every build this server has ever
15
+ * shipped. A host that caches a resource by its uri, which is the obvious thing to do for an identifier, then
16
+ * serves the FIRST widget it ever loaded for the rest of time, and every fix after that is invisible no
17
+ * matter how many times the package is published.
18
+ *
19
+ * ⚠️ It also collided ACROSS SERVERS. A published ContentHero and a local build connected at once both
20
+ * advertised this exact string, so one cache entry stood for two different widgets and which one won was not
21
+ * something either server decided. That is the configuration a widget is actually developed in.
22
+ *
23
+ * ⭐ Deriving it from the package version costs nothing and makes every publish cache-safe by construction:
24
+ * new bytes always arrive under a new name. Both the resource registration and the `_meta` bindings import
25
+ * this one constant, so they cannot disagree about which name was advertised.
26
+ *
27
+ * ⚠️ WHAT THIS DOES NOT FIX: two builds of the SAME version still share a name, which is the local
28
+ * development case. Bump the version, or accept that a same-version rebuild may be served from cache.
29
+ */
30
+ export declare const GENERATION_WIDGET_URI = "ui://contenthero/generation-0.4.14.html";
12
31
  //# sourceMappingURL=widget-uri.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"widget-uri.d.ts","sourceRoot":"","sources":["../src/widget-uri.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB,qCAAqC,CAAA"}
1
+ {"version":3,"file":"widget-uri.d.ts","sourceRoot":"","sources":["../src/widget-uri.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,qBAAqB,4CAAwD,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contenthero/mcp",
3
- "version": "0.4.12",
3
+ "version": "0.4.14",
4
4
  "description": "Official ContentHero MCP server. Generate images, video, and audio from any MCP client (Claude Code, Claude Desktop, etc.) using your ContentHero API key.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -13,11 +13,12 @@
13
13
  "README.md"
14
14
  ],
15
15
  "scripts": {
16
- "build": "node widget/guard.mjs && tsc --noEmit -p widget/tsconfig.json && node widget/build.mjs && tsc",
16
+ "build": "node widget/guard.mjs && tsc --noEmit -p widget/tsconfig.json && node widget/build.mjs && tsc --emitDeclarationOnly && node build-server.mjs",
17
17
  "clean": "rm -rf dist",
18
18
  "test": "tsx --test \"src/**/*.test.ts\"",
19
19
  "prepublishOnly": "npm run clean && npm run build",
20
- "verify:inline": "node scripts/verify-inline-media.mjs"
20
+ "verify:inline": "node scripts/verify-inline-media.mjs",
21
+ "verify:tarball": "node scripts/verify-tarball.mjs"
21
22
  },
22
23
  "publishConfig": {
23
24
  "access": "public"
@@ -42,13 +43,13 @@
42
43
  "license": "MIT",
43
44
  "private": false,
44
45
  "dependencies": {
45
- "@contenthero/sdk": "^0.4.8",
46
+ "@contenthero/sdk": "^0.4.10",
46
47
  "@modelcontextprotocol/ext-apps": "2.0.0",
47
48
  "@modelcontextprotocol/sdk": "1.26.0",
48
49
  "zod": "^4.3.6"
49
50
  },
50
51
  "devDependencies": {
51
- "@contenthero-ai/brand-ui": "0.1.1",
52
+ "@contenthero-ai/brand-ui": "0.1.2",
52
53
  "@lobehub/icons": "5.10.0",
53
54
  "@types/node": "^22.19.19",
54
55
  "@types/react": "19.2.2",
package/dist/client.js DELETED
@@ -1,54 +0,0 @@
1
- /**
2
- * Lazy ContentHero SDK client, configured from the environment.
3
- *
4
- * Resolution goes through the SDK's shared auth ladder: an explicit value, then
5
- * CONTENTHERO_API_KEY, then the credential written by `contenthero login` at
6
- * ~/.contenthero/credentials. It is deferred to first use so the server can start
7
- * and advertise its tools even before a key is present; the missing-key error then
8
- * surfaces as a tool-call result rather than a crash.
9
- *
10
- * ## Why the ladder, and not just the env var
11
- *
12
- * Reading only the environment is what forced every ContentHero entry in `.mcp.json`
13
- * to carry a plaintext `ch_live_` key inline in its command string, and made pointing
14
- * the MCP at a different account a three-file edit. With the ladder, an account is a
15
- * profile directory: set CONTENTHERO_CONFIG_DIR and no secret needs to live in any
16
- * editor config at all.
17
- *
18
- * ⚠️ THE CLIENT IS CACHED FOR THE PROCESS LIFETIME, so switching accounts requires
19
- * restarting the MCP server. That is deliberate. A key that could change underneath a
20
- * running session would let a generation land in, and bill, an account nobody at the
21
- * keyboard chose, and generations are not refundable.
22
- */
23
- import { ContentHero } from '@contenthero/sdk';
24
- import { configDir, resolveAuth } from '@contenthero/sdk/credentials';
25
- let cached;
26
- export function getClient() {
27
- if (cached)
28
- return cached;
29
- const { apiKey, keySource, baseUrl } = resolveAuth();
30
- if (!apiKey) {
31
- throw new Error('No ContentHero API key found. Set CONTENTHERO_API_KEY in the MCP server env, ' +
32
- `or run \`contenthero login\` to store one (looked in ${configDir()}).`);
33
- }
34
- // Announced once, on stderr so it never corrupts the stdio protocol stream. Which ACCOUNT an MCP server is
35
- // acting as is the single most consequential thing about it and was previously invisible: the only way to
36
- // find out was to call get_balance and recognize the number.
37
- console.error(`[contenthero-mcp] authenticated from ${keySource} (config dir: ${configDir()})`);
38
- cached = new ContentHero({
39
- apiKey,
40
- baseUrl,
41
- // Tag spends from the stdio MCP as the 'mcp' transport channel, matching the
42
- // hosted OAuth MCP. The MCP spends through an api key, so this header is what
43
- // distinguishes it from a raw api-key or cli caller on credit_transactions.
44
- fetch: (input, init) => fetch(input, {
45
- ...init,
46
- headers: {
47
- ...init?.headers,
48
- 'X-ContentHero-Channel': 'mcp',
49
- },
50
- }),
51
- });
52
- return cached;
53
- }
54
- //# sourceMappingURL=client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAErE,IAAI,MAA+B,CAAA;AAEnC,MAAM,UAAU,SAAS;IACvB,IAAI,MAAM;QAAE,OAAO,MAAM,CAAA;IACzB,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,WAAW,EAAE,CAAA;IACpD,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CACb,+EAA+E;YAC7E,wDAAwD,SAAS,EAAE,IAAI,CAC1E,CAAA;IACH,CAAC;IACD,2GAA2G;IAC3G,0GAA0G;IAC1G,6DAA6D;IAC7D,OAAO,CAAC,KAAK,CAAC,wCAAwC,SAAS,iBAAiB,SAAS,EAAE,GAAG,CAAC,CAAA;IAC/F,MAAM,GAAG,IAAI,WAAW,CAAC;QACvB,MAAM;QACN,OAAO;QACP,6EAA6E;QAC7E,8EAA8E;QAC9E,4EAA4E;QAC5E,KAAK,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CACrB,KAAK,CAAC,KAAK,EAAE;YACX,GAAG,IAAI;YACP,OAAO,EAAE;gBACP,GAAI,IAAI,EAAE,OAA8C;gBACxD,uBAAuB,EAAE,KAAK;aAC/B;SACF,CAAC;KACL,CAAC,CAAA;IACF,OAAO,MAAM,CAAA;AACf,CAAC"}