@productbrain/mcp 0.0.1-beta.185 → 0.0.1-beta.187
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/dist/http.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
hashKey,
|
|
8
8
|
initFeatureFlags,
|
|
9
9
|
runWithAuth
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-OOAGD3TL.js";
|
|
11
11
|
import {
|
|
12
12
|
getPostHogClient,
|
|
13
13
|
initAnalytics,
|
|
@@ -20,6 +20,41 @@ import express from "express";
|
|
|
20
20
|
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
21
21
|
import { isInitializeRequest } from "@modelcontextprotocol/sdk/types.js";
|
|
22
22
|
import rateLimit from "express-rate-limit";
|
|
23
|
+
|
|
24
|
+
// src/brand/logo-markup.ts
|
|
25
|
+
var SIZE_CLASSES = {
|
|
26
|
+
sm: "pb-logo--sm",
|
|
27
|
+
md: "pb-logo--md"
|
|
28
|
+
};
|
|
29
|
+
var appLogoStyles = `
|
|
30
|
+
.pb-logo{display:inline-flex;align-items:center;gap:8px;color:inherit}
|
|
31
|
+
.pb-logo__mark{
|
|
32
|
+
border-radius:4px;background:#1c1e24;
|
|
33
|
+
border:1px solid rgba(255,255,255,0.06);
|
|
34
|
+
display:inline-grid;place-items:center;flex-shrink:0;
|
|
35
|
+
}
|
|
36
|
+
.pb-logo__core{border-radius:50%;background:var(--accent,#c9b99a)}
|
|
37
|
+
.pb-logo__name{
|
|
38
|
+
font-family:var(--font-mono,"IBM Plex Mono",ui-monospace,monospace);
|
|
39
|
+
font-weight:500;text-transform:uppercase;
|
|
40
|
+
letter-spacing:0.22em;color:var(--fg4,#6a6560);
|
|
41
|
+
}
|
|
42
|
+
.pb-logo--sm .pb-logo__mark{width:16px;height:16px}
|
|
43
|
+
.pb-logo--sm .pb-logo__core{width:5px;height:5px}
|
|
44
|
+
.pb-logo--sm .pb-logo__name{font-size:10.5px}
|
|
45
|
+
.pb-logo--md .pb-logo__mark{width:24px;height:24px;border-radius:6px}
|
|
46
|
+
.pb-logo--md .pb-logo__core{width:8px;height:8px}
|
|
47
|
+
.pb-logo--md .pb-logo__name{font-size:13px}
|
|
48
|
+
`;
|
|
49
|
+
function appLogoMarkup(opts = {}) {
|
|
50
|
+
const size = opts.size ?? "sm";
|
|
51
|
+
const showWordmark = opts.showWordmark ?? true;
|
|
52
|
+
const cls = ["pb-logo", SIZE_CLASSES[size], opts.className].filter(Boolean).join(" ");
|
|
53
|
+
const wordmark = showWordmark ? `<span class="pb-logo__name">Product Brain</span>` : "";
|
|
54
|
+
return `<span class="${cls}"><span class="pb-logo__mark"><span class="pb-logo__core"></span></span>${wordmark}</span>`;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// src/http.ts
|
|
23
58
|
bootstrapHttp();
|
|
24
59
|
initAnalytics();
|
|
25
60
|
initFeatureFlags(getPostHogClient());
|
|
@@ -203,19 +238,8 @@ body::before{
|
|
|
203
238
|
background:radial-gradient(900px 600px at 50% 50%,rgba(228,224,216,0.025),transparent 60%);
|
|
204
239
|
pointer-events:none;z-index:0;
|
|
205
240
|
}
|
|
206
|
-
.top-mark{
|
|
207
|
-
|
|
208
|
-
z-index:5;opacity:0.7;
|
|
209
|
-
}
|
|
210
|
-
.top-mark .m{
|
|
211
|
-
width:16px;height:16px;border-radius:4px;background:#1c1e24;
|
|
212
|
-
border:1px solid rgba(255,255,255,0.06);display:inline-grid;place-items:center;
|
|
213
|
-
}
|
|
214
|
-
.top-mark .m .core{width:5px;height:5px;border-radius:50%;background:var(--accent)}
|
|
215
|
-
.top-mark .name{
|
|
216
|
-
font-family:var(--font-mono);font-size:10.5px;letter-spacing:0.22em;
|
|
217
|
-
text-transform:uppercase;color:var(--fg4);font-weight:500;
|
|
218
|
-
}
|
|
241
|
+
.top-mark{position:fixed;top:22px;left:24px;z-index:5;opacity:0.7}
|
|
242
|
+
${appLogoStyles}
|
|
219
243
|
.stage{
|
|
220
244
|
width:100%;max-width:460px;text-align:center;
|
|
221
245
|
position:relative;z-index:1;
|
|
@@ -262,13 +286,9 @@ body::before{
|
|
|
262
286
|
10%,90%{transform:translateX(-1px)}20%,80%{transform:translateX(2px)}
|
|
263
287
|
30%,50%,70%{transform:translateX(-4px)}40%,60%{transform:translateX(4px)}
|
|
264
288
|
}
|
|
265
|
-
.input-prefix{
|
|
266
|
-
font-family:var(--font-mono);font-size:14px;color:var(--fg3);
|
|
267
|
-
padding-left:16px;user-select:none;
|
|
268
|
-
}
|
|
269
289
|
.input{
|
|
270
290
|
flex:1;min-width:0;background:transparent;border:0;outline:none;
|
|
271
|
-
padding:16px
|
|
291
|
+
padding:16px;
|
|
272
292
|
font-family:var(--font-mono);font-size:14px;color:var(--fg1);letter-spacing:0.02em;
|
|
273
293
|
}
|
|
274
294
|
.input::placeholder{color:var(--fg4)}
|
|
@@ -395,47 +415,41 @@ body::before{
|
|
|
395
415
|
color:var(--fg-bright);opacity:0;
|
|
396
416
|
}
|
|
397
417
|
.panel:not([hidden]) .ok-title{animation:rise 600ms ease-out 380ms forwards}
|
|
398
|
-
.ok-
|
|
399
|
-
margin-top:
|
|
400
|
-
opacity:0;display:flex;align-items:center;justify-content:center;gap:8px;flex-wrap:wrap;
|
|
401
|
-
}
|
|
402
|
-
.panel:not([hidden]) .ok-sub{animation:rise 600ms ease-out 520ms forwards}
|
|
403
|
-
.ok-actions{
|
|
404
|
-
margin-top:24px;display:flex;flex-direction:column;align-items:center;gap:14px;
|
|
418
|
+
.ok-sentence{
|
|
419
|
+
margin-top:20px;font-size:16px;line-height:1.6;color:var(--fg2);
|
|
405
420
|
opacity:0;
|
|
421
|
+
display:inline-flex;align-items:center;justify-content:center;gap:8px;flex-wrap:wrap;
|
|
406
422
|
}
|
|
407
|
-
.panel:not([hidden]) .ok-
|
|
408
|
-
.ok-foot{
|
|
409
|
-
margin-top:36px;font-family:var(--font-mono);font-size:10px;
|
|
410
|
-
letter-spacing:0.22em;text-transform:uppercase;color:var(--fg4);opacity:0;
|
|
411
|
-
}
|
|
412
|
-
.panel:not([hidden]) .ok-foot{animation:rise 600ms ease-out 820ms forwards}
|
|
413
|
-
.ws-name{font-size:13px;color:var(--accent);letter-spacing:0.04em;font-weight:500}
|
|
423
|
+
.panel:not([hidden]) .ok-sentence{animation:rise 600ms ease-out 520ms forwards}
|
|
414
424
|
|
|
415
425
|
.cmd{
|
|
416
|
-
display:inline-flex;align-items:center;gap:8px;
|
|
417
|
-
font-family:var(--font-mono);font-size:
|
|
418
|
-
background:rgba(
|
|
419
|
-
padding:
|
|
426
|
+
display:inline-flex;align-items:center;gap:8px;vertical-align:middle;
|
|
427
|
+
font-family:var(--font-mono);font-size:15px;font-weight:500;color:var(--accent);
|
|
428
|
+
background:rgba(201,185,154,0.08);border:1px solid rgba(201,185,154,0.30);
|
|
429
|
+
padding:5px 10px 5px 12px;border-radius:6px;letter-spacing:0.02em;
|
|
420
430
|
cursor:pointer;user-select:none;
|
|
421
431
|
transition:background 140ms ease-out,border-color 140ms ease-out,color 140ms ease-out;
|
|
422
432
|
}
|
|
423
|
-
.cmd:hover{background:rgba(
|
|
424
|
-
.cmd.is-copied{color:var(--green);border-color:rgba(74,222,128,0.
|
|
433
|
+
.cmd:hover{background:rgba(201,185,154,0.14);border-color:rgba(201,185,154,0.50);color:#dcc9a4}
|
|
434
|
+
.cmd.is-copied{color:var(--green);border-color:rgba(74,222,128,0.35);background:rgba(74,222,128,0.08)}
|
|
425
435
|
.cmd .cmd-icon{
|
|
426
|
-
width:12px;height:12px;color:
|
|
427
|
-
|
|
436
|
+
width:12px;height:12px;color:currentColor;opacity:0.75;
|
|
437
|
+
display:inline-grid;place-items:center;
|
|
438
|
+
transition:opacity 140ms;
|
|
428
439
|
}
|
|
429
|
-
.cmd
|
|
440
|
+
.cmd:hover .cmd-icon{opacity:1}
|
|
441
|
+
.cmd.is-copied .cmd-icon{color:var(--green);opacity:1}
|
|
430
442
|
.cmd .cmd-icon svg{width:12px;height:12px;stroke:currentColor;fill:none;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}
|
|
431
443
|
|
|
432
444
|
.return-link{
|
|
445
|
+
display:inline-block;margin-top:28px;
|
|
433
446
|
font-family:var(--font-mono);font-size:11px;letter-spacing:0.18em;
|
|
434
|
-
text-transform:uppercase;color:var(--
|
|
447
|
+
text-transform:uppercase;color:var(--fg4);text-decoration:none;
|
|
435
448
|
border-bottom:1px dotted currentColor;padding-bottom:1px;
|
|
436
|
-
transition:color 140ms;
|
|
449
|
+
opacity:0;transition:color 140ms;
|
|
437
450
|
}
|
|
438
|
-
.return-link
|
|
451
|
+
.panel:not([hidden]) .return-link{animation:rise 600ms ease-out 720ms forwards}
|
|
452
|
+
.return-link:hover{color:var(--fg2)}
|
|
439
453
|
|
|
440
454
|
/* error specifics */
|
|
441
455
|
.err-title{
|
|
@@ -494,10 +508,7 @@ body::before{
|
|
|
494
508
|
}
|
|
495
509
|
</style>
|
|
496
510
|
</head><body>
|
|
497
|
-
<div class="top-mark">
|
|
498
|
-
<span class="m"><span class="core"></span></span>
|
|
499
|
-
<span class="name">Product Brain</span>
|
|
500
|
-
</div>
|
|
511
|
+
<div class="top-mark">${appLogoMarkup({ size: "sm" })}</div>
|
|
501
512
|
<div class="stage">${bodyContent}</div>
|
|
502
513
|
</body></html>`;
|
|
503
514
|
}
|
|
@@ -526,19 +537,19 @@ function successPanelInner(workspaceName, redirectUrl, providerName) {
|
|
|
526
537
|
</div>
|
|
527
538
|
<div class="eyebrow success"><span class="dot"></span>Connected</div>
|
|
528
539
|
<h1 class="ok-title">Product Brain is live.</h1>
|
|
529
|
-
<p class="ok-
|
|
530
|
-
<span
|
|
531
|
-
</p>
|
|
532
|
-
<div class="ok-actions">
|
|
540
|
+
<p class="ok-sentence">
|
|
541
|
+
<span>Then say</span>
|
|
533
542
|
<button class="cmd" type="button" data-cmd-pill data-redirect="${esc(redirectUrl)}" aria-label="Copy 'Start PB' and return to ${esc(providerName)}">
|
|
534
543
|
<span data-cmd-text>Start PB</span>
|
|
535
544
|
<span class="cmd-icon" aria-hidden="true">
|
|
536
545
|
<svg data-cmd-svg viewBox="0 0 24 24"><rect x="9" y="9" width="11" height="11" rx="2"/><path d="M5 15V6a2 2 0 0 1 2-2h9"/></svg>
|
|
537
546
|
</span>
|
|
538
547
|
</button>
|
|
539
|
-
<
|
|
540
|
-
</
|
|
541
|
-
<
|
|
548
|
+
<span>in <span data-provider>${esc(providerName)}</span>.</span>
|
|
549
|
+
</p>
|
|
550
|
+
<a class="return-link" href="${esc(redirectUrl)}" data-return-link>Return to <span data-provider>${esc(providerName)}</span> →</a>
|
|
551
|
+
<!-- workspace name retained as data hook for tests, hidden from view -->
|
|
552
|
+
<span hidden data-field="ws-name">${esc(workspaceName)}</span>`;
|
|
542
553
|
}
|
|
543
554
|
function errorPanelInner(title, trustedDetailHtml, retryUrl) {
|
|
544
555
|
return `
|
|
@@ -596,10 +607,9 @@ function authorizeFormPage(params) {
|
|
|
596
607
|
<input type="hidden" name="state" value="${esc(state)}">
|
|
597
608
|
<input type="hidden" name="client_id" value="${esc(client_id)}">
|
|
598
609
|
<div class="input-wrap" id="iw">
|
|
599
|
-
<
|
|
600
|
-
<input type="password" id="k" name="api_key" class="input" placeholder="\u2026" required autofocus spellcheck="false">
|
|
610
|
+
<input type="password" id="k" name="api_key" class="input input-full" placeholder="pb_sk_\u2026" required autofocus spellcheck="false">
|
|
601
611
|
</div>
|
|
602
|
-
<div class="hint" id="hint">
|
|
612
|
+
<div class="hint" id="hint">Starts with pb_sk_</div>
|
|
603
613
|
<button type="submit" class="btn-primary" id="sb" disabled><span id="bt">Connect</span></button>
|
|
604
614
|
</form>
|
|
605
615
|
<div class="small-link"><a href="https://productbrain.io" target="_blank" rel="noopener noreferrer">No key? Generate one →</a></div>
|
|
@@ -641,15 +651,12 @@ ${cmdScript}
|
|
|
641
651
|
}
|
|
642
652
|
|
|
643
653
|
function syncInput(){
|
|
644
|
-
var v=k.value;
|
|
645
|
-
if(v.indexOf('pb_sk_')===0)k.value=v.slice(6);
|
|
646
654
|
sb.disabled=!k.value.trim();
|
|
647
655
|
iw.classList.remove('has-error');
|
|
648
656
|
hint.classList.remove('is-error');
|
|
649
|
-
hint.textContent='
|
|
657
|
+
hint.textContent='Starts with pb_sk_';
|
|
650
658
|
}
|
|
651
659
|
k.addEventListener('input',syncInput);
|
|
652
|
-
k.addEventListener('paste',function(){setTimeout(syncInput,0)});
|
|
653
660
|
k.addEventListener('keydown',function(e){
|
|
654
661
|
if(e.key==='Escape'){k.value='';syncInput()}
|
|
655
662
|
});
|
|
@@ -685,6 +692,7 @@ ${cmdScript}
|
|
|
685
692
|
e.preventDefault();
|
|
686
693
|
var v=k.value.trim();
|
|
687
694
|
if(!v){iw.classList.add('has-error');hint.classList.add('is-error');hint.textContent='Paste your key first';return}
|
|
695
|
+
if(v.indexOf('pb_sk_')!==0){iw.classList.add('has-error');hint.classList.add('is-error');hint.textContent='Key must start with pb_sk_';return}
|
|
688
696
|
sb.disabled=true;bt.textContent='Verifying';
|
|
689
697
|
show(pVerify);
|
|
690
698
|
|
|
@@ -844,7 +852,7 @@ app.post(
|
|
|
844
852
|
if (anyDefinitiveReject) {
|
|
845
853
|
sendError(
|
|
846
854
|
"Key not recognized",
|
|
847
|
-
"This API key wasn't found in Product Brain. Check your API Keys in
|
|
855
|
+
"This API key wasn't found in Product Brain. Check your API Keys in Cortex and try again.",
|
|
848
856
|
401
|
|
849
857
|
);
|
|
850
858
|
return;
|