@ggui-ai/mcp-server 0.1.0-rc.3 → 0.2.0-alpha.3

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 (59) hide show
  1. package/README.md +1 -1
  2. package/dist/build-mcp.d.ts +8 -8
  3. package/dist/build-mcp.d.ts.map +1 -1
  4. package/dist/build-mcp.js +53 -12
  5. package/dist/console-auth.d.ts +7 -7
  6. package/dist/console-auth.d.ts.map +1 -1
  7. package/dist/console-auth.js +4 -4
  8. package/dist/console-cache.d.ts +2 -2
  9. package/dist/console-cache.d.ts.map +1 -1
  10. package/dist/console-cache.js +10 -10
  11. package/dist/console-headers.d.ts +2 -2
  12. package/dist/console-headers.js +2 -2
  13. package/dist/console-payloads.d.ts +3 -3
  14. package/dist/console-payloads.d.ts.map +1 -1
  15. package/dist/console-payloads.js +10 -10
  16. package/dist/console-timeline.d.ts +12 -30
  17. package/dist/console-timeline.d.ts.map +1 -1
  18. package/dist/console-timeline.js +44 -45
  19. package/dist/index.d.ts +7 -7
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +5 -5
  22. package/dist/instructions-presets.d.ts +1 -1
  23. package/dist/instructions-presets.d.ts.map +1 -1
  24. package/dist/instructions-presets.js +40 -22
  25. package/dist/llm-backed-negotiator.d.ts +6 -6
  26. package/dist/llm-backed-negotiator.d.ts.map +1 -1
  27. package/dist/llm-backed-negotiator.js +92 -91
  28. package/dist/mcp-apps-inbound.d.ts +3 -3
  29. package/dist/mcp-apps-inbound.d.ts.map +1 -1
  30. package/dist/mcp-apps-inbound.js +28 -23
  31. package/dist/mcp-apps-outbound.d.ts +136 -121
  32. package/dist/mcp-apps-outbound.d.ts.map +1 -1
  33. package/dist/mcp-apps-outbound.js +384 -414
  34. package/dist/mcp-mounts.d.ts +21 -20
  35. package/dist/mcp-mounts.d.ts.map +1 -1
  36. package/dist/mcp-mounts.js +25 -29
  37. package/dist/{session-channel.d.ts → render-channel.d.ts} +145 -102
  38. package/dist/render-channel.d.ts.map +1 -0
  39. package/dist/{session-channel.js → render-channel.js} +481 -462
  40. package/dist/schema-compat.d.ts +11 -11
  41. package/dist/schema-compat.d.ts.map +1 -1
  42. package/dist/schema-compat.js +6 -6
  43. package/dist/server.d.ts +224 -219
  44. package/dist/server.d.ts.map +1 -1
  45. package/dist/server.js +1498 -1963
  46. package/dist/storage.d.ts +7 -7
  47. package/dist/storage.d.ts.map +1 -1
  48. package/dist/storage.js +12 -12
  49. package/package.json +12 -11
  50. package/dist/render-gate.d.ts +0 -87
  51. package/dist/render-gate.d.ts.map +0 -1
  52. package/dist/render-gate.js +0 -77
  53. package/dist/render-rate-limit.d.ts +0 -59
  54. package/dist/render-rate-limit.d.ts.map +0 -1
  55. package/dist/render-rate-limit.js +0 -73
  56. package/dist/render-signing.d.ts +0 -98
  57. package/dist/render-signing.d.ts.map +0 -1
  58. package/dist/render-signing.js +0 -113
  59. package/dist/session-channel.d.ts.map +0 -1
@@ -1,113 +0,0 @@
1
- /**
2
- * HMAC-signed render URL helpers (capability-URL hardening).
3
- *
4
- * The shortCode IS the credential under the capability-URL model.
5
- * Signed render URLs add three properties on top of the base model
6
- * (entropy + revoke + parity gate):
7
- *
8
- * 1. **Time-bound.** Each minted URL carries `?exp=<unix>`. Past
9
- * that timestamp, the gate refuses even if the binding still
10
- * exists. A leaked URL stops working without operator action.
11
- * 2. **Tamper-evident.** Each minted URL carries `?sig=<hmac>` over
12
- * `(shortCode, exp)`. Changing either invalidates the sig.
13
- * Attackers who learn ONE valid shortCode can't generate URLs
14
- * for shortCodes they're guessing.
15
- * 3. **Nuclear revoke (operational).** Rotating the signing secret
16
- * invalidates every outstanding URL across the whole server in
17
- * one move. Useful for incident response.
18
- *
19
- * **Threat model — what this is NOT.** The signature does not bind
20
- * the URL to a user, IP, or session. Anyone with the URL still has
21
- * full access until it expires. That's the Google-Docs-share-link
22
- * model. It's the only viable model when the URL must be embeddable
23
- * in cross-origin iframes (claude.ai), which can't attach auth
24
- * headers — see plan audit dated 2026-05-15.
25
- *
26
- * **Key lifecycle.** Operators set `--render-signing-secret <hex>` to
27
- * pin a stable key (URLs survive restarts; rotation is opt-in). When
28
- * omitted, the secret is auto-generated at boot — restart = every
29
- * outstanding URL dies. Document both behaviors so operators choose
30
- * deliberately.
31
- *
32
- * **Opt-out.** `--no-render-signing` (operator boots without a signer)
33
- * disables the layer entirely. The gate skips the verify step and
34
- * behavior reverts to plain (unsigned) capability URLs. Useful for
35
- * legacy hosts that strip query strings or tooling that pre-records
36
- * URLs.
37
- */
38
- import { createHmac, randomBytes, timingSafeEqual } from 'node:crypto';
39
- /** Default TTL when the operator doesn't override. 24h matches the
40
- * cloud pod's ShortCode row TTL — long enough for a back-to-the-tab
41
- * user pattern, short enough that a leaked URL doesn't outlive a
42
- * reasonable incident-response window. */
43
- const DEFAULT_TTL_SECONDS = 24 * 60 * 60;
44
- /**
45
- * Build a {@link RenderSigner}. Memoize the result on the server-boot
46
- * scope; the secret rotates only when the operator restarts (or sets
47
- * a new explicit `--render-signing-secret`).
48
- */
49
- export function createRenderSigner(input = {}) {
50
- const secret = input.secret !== undefined && input.secret.length > 0
51
- ? input.secret
52
- : randomBytes(32).toString('hex');
53
- const ttl = input.ttlSeconds !== undefined && input.ttlSeconds > 0
54
- ? Math.floor(input.ttlSeconds)
55
- : DEFAULT_TTL_SECONDS;
56
- const now = input.now ?? (() => Date.now());
57
- const secretBuffer = Buffer.from(secret, 'utf8');
58
- function computeSig(shortCode, exp) {
59
- // HMAC-SHA256 over `<shortCode>.<exp>`. Fixed separator + numeric
60
- // exp keeps the input unambiguous (no length-extension or
61
- // collision risk via overloaded encoding). Hex output stays
62
- // URL-safe without percent-encoding.
63
- return createHmac('sha256', secretBuffer)
64
- .update(`${shortCode}.${exp}`)
65
- .digest('hex');
66
- }
67
- return {
68
- sign(shortCode, expSecondsOverride) {
69
- const ttlForCall = expSecondsOverride !== undefined && expSecondsOverride > 0
70
- ? Math.floor(expSecondsOverride)
71
- : ttl;
72
- const exp = Math.floor(now() / 1000) + ttlForCall;
73
- return { sig: computeSig(shortCode, exp), exp };
74
- },
75
- verify({ shortCode, sig, exp }) {
76
- if (typeof sig !== 'string' ||
77
- typeof exp !== 'string' ||
78
- sig.length === 0 ||
79
- exp.length === 0) {
80
- return { ok: false, code: 'malformed' };
81
- }
82
- const expNum = Number.parseInt(exp, 10);
83
- if (!Number.isFinite(expNum) || expNum <= 0) {
84
- return { ok: false, code: 'malformed' };
85
- }
86
- // Expired? Check BEFORE the HMAC compare. Expiry is a cheap
87
- // numeric compare; bailing here on stale URLs avoids the more
88
- // expensive constant-time sig compare on every drive-by stale
89
- // hit. Information-leak concern: an attacker can probe `exp`
90
- // independently of sig — but `exp` is already in the URL and
91
- // not secret.
92
- const nowSeconds = Math.floor(now() / 1000);
93
- if (expNum < nowSeconds) {
94
- return { ok: false, code: 'expired' };
95
- }
96
- const expected = computeSig(shortCode, expNum);
97
- // Constant-time compare. Buffer length mismatch → fail without
98
- // exposing length information via `timingSafeEqual` (which
99
- // throws on length mismatch).
100
- const a = Buffer.from(sig, 'hex');
101
- const b = Buffer.from(expected, 'hex');
102
- if (a.length !== b.length || a.length === 0) {
103
- return { ok: false, code: 'invalid_signature' };
104
- }
105
- return timingSafeEqual(a, b)
106
- ? { ok: true }
107
- : { ok: false, code: 'invalid_signature' };
108
- },
109
- toQuerySuffix({ sig, exp }) {
110
- return `sig=${sig}&exp=${exp}`;
111
- },
112
- };
113
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"session-channel.d.ts","sourceRoot":"","sources":["../src/session-channel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C,OAAO,KAAK,EAOV,UAAU,EAEV,wBAAwB,EACxB,gBAAgB,E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