@nanocollective/roster 0.1.0-beta.25 → 0.1.0-beta.27
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/worker/assets/assets/css/connectors.css +8 -0
- package/dist/worker/assets/assets/js/dom.js +1 -1
- package/dist/worker/assets/assets/js/views/connectors.js +39 -1
- package/dist/worker/index.js +108 -1
- package/docs/hosting.md +13 -0
- package/package.json +1 -1
- package/templates/portal/css/connectors.css +8 -0
- package/templates/portal/js/dom.js +1 -1
- package/templates/portal/js/views/connectors.js +39 -1
|
@@ -17,6 +17,14 @@ h1 + div > .connhead:first-child,h1 + .connerr + div > .connhead:first-child{mar
|
|
|
17
17
|
.connacts{margin:0;flex-wrap:nowrap}
|
|
18
18
|
.connacts .ghbtn.danger{color:var(--err);border-color:color-mix(in srgb,var(--err) 40%,transparent)}
|
|
19
19
|
|
|
20
|
+
/* This portal's MCP server, one row per agent: the line to paste and a Copy button. */
|
|
21
|
+
.connmcp{display:flex;flex-direction:column;align-items:stretch;gap:7px}
|
|
22
|
+
.connmcp b{font:600 14px var(--sans);letter-spacing:-.01em}
|
|
23
|
+
.connline{display:flex;align-items:center;gap:10px}
|
|
24
|
+
.connline code{flex:1;min-width:0;font:12.5px/1.5 var(--mono);color:var(--ink);background:var(--bg);border:1px solid var(--line);
|
|
25
|
+
border-radius:var(--r);padding:6px 9px;overflow-wrap:anywhere;user-select:all}
|
|
26
|
+
.connmcp small{font-size:12px;color:var(--ink-dim)}
|
|
27
|
+
|
|
20
28
|
.connicon{display:grid;place-items:center;width:32px;height:32px;border-radius:9px;flex:none;
|
|
21
29
|
background:var(--accent-soft);color:var(--accent);--ic:16px}
|
|
22
30
|
|
|
@@ -108,7 +108,7 @@ export async function toClipboard(text, btn, label) {
|
|
|
108
108
|
};
|
|
109
109
|
try {
|
|
110
110
|
await navigator.clipboard.writeText(text);
|
|
111
|
-
said("copied · " + Math.round(text.length / 1000) + "k");
|
|
111
|
+
said(text.length < 1000 ? "copied" : "copied · " + Math.round(text.length / 1000) + "k");
|
|
112
112
|
return true;
|
|
113
113
|
} catch {
|
|
114
114
|
/* fall through */
|
|
@@ -8,9 +8,10 @@
|
|
|
8
8
|
|
|
9
9
|
import { getConnectors, post } from "../api.js";
|
|
10
10
|
import { sheet } from "../dialog.js";
|
|
11
|
-
import { el } from "../dom.js";
|
|
11
|
+
import { el, toClipboard } from "../dom.js";
|
|
12
12
|
import { icon } from "../icons.js";
|
|
13
13
|
import { render } from "../router.js";
|
|
14
|
+
import { S } from "../state.js";
|
|
14
15
|
|
|
15
16
|
/* The last answer, so a repaint after Save does not flash an empty screen. */
|
|
16
17
|
let last = null;
|
|
@@ -71,6 +72,43 @@ function draw(body, d) {
|
|
|
71
72
|
own.onclick = () => openCustom(d);
|
|
72
73
|
grid.append(own);
|
|
73
74
|
body.append(el("h2", { className: "connhead", textContent: d.connectors.length ? "Add another" : "Add a service" }), grid);
|
|
75
|
+
body.append(...ownAgent());
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* --------------------- this portal as an MCP server, elsewhere --------------------- */
|
|
79
|
+
|
|
80
|
+
/** How to add this portal's MCP server to Claude Code, Codex, Claude or anything else. */
|
|
81
|
+
function ownAgent() {
|
|
82
|
+
const head = el("h2", { className: "connhead", textContent: "Connect your own agent" });
|
|
83
|
+
if (!S.hosted) {
|
|
84
|
+
return [head, el("p", { className: "sub", textContent: "Needs the hosted portal: roster portal deploy." })];
|
|
85
|
+
}
|
|
86
|
+
const url = location.origin + "/mcp";
|
|
87
|
+
// Named after the org, so a second Roster in the same agent gets tools of its own.
|
|
88
|
+
const slug = String(S.data?.name ?? S.data?.org ?? "")
|
|
89
|
+
.toLowerCase()
|
|
90
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
91
|
+
.replace(/^-|-$/g, "");
|
|
92
|
+
const name = slug ? "roster-" + slug : "roster";
|
|
93
|
+
const rows = [
|
|
94
|
+
["Claude Code", `claude mcp add --transport http ${name} ${url}`, "Then run /mcp and sign in."],
|
|
95
|
+
["Codex", `codex mcp add ${name} --url ${url} && codex mcp login ${name}`, ""],
|
|
96
|
+
["Claude", url, "Settings → Connectors → Add custom connector."],
|
|
97
|
+
["Anything else", url, ""],
|
|
98
|
+
];
|
|
99
|
+
const list = el("div", { className: "connlist" });
|
|
100
|
+
for (const [label, text, then] of rows) {
|
|
101
|
+
const copy = el("button", { className: "ghbtn", textContent: "Copy" });
|
|
102
|
+
copy.onclick = () => toClipboard(text, copy, "Copy");
|
|
103
|
+
list.append(
|
|
104
|
+
el("div", { className: "connrow connmcp" }, [
|
|
105
|
+
el("b", { textContent: label }),
|
|
106
|
+
el("div", { className: "connline" }, [el("code", { textContent: text }), copy]),
|
|
107
|
+
then ? el("small", { textContent: then }) : null,
|
|
108
|
+
].filter(Boolean)),
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
return [head, el("p", { className: "sub", textContent: "Sign in with GitHub when it asks." }), list];
|
|
74
112
|
}
|
|
75
113
|
|
|
76
114
|
/** "Notion (integration key)" is only Notion where it is the one Notion on offer. */
|