@nanocollective/roster 0.1.0-beta.25 → 0.1.0-beta.26

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.
@@ -17,6 +17,12 @@ 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{grid-template-columns:minmax(0,1fr) auto}
22
+ .connmcp code{font:12.5px/1.5 var(--mono);color:var(--ink);background:var(--bg);border:1px solid var(--line);
23
+ border-radius:var(--r);padding:6px 9px;overflow-wrap:anywhere;user-select:all}
24
+ .connmcp small{font-size:12px;color:var(--ink-dim)}
25
+
20
26
  .connicon{display:grid;place-items:center;width:32px;height:32px;border-radius:9px;flex:none;
21
27
  background:var(--accent-soft);color:var(--accent);--ic:16px}
22
28
 
@@ -47,4 +53,6 @@ h1 + div > .connhead:first-child,h1 + .connerr + div > .connhead:first-child{mar
47
53
  .connrow{grid-template-columns:32px minmax(0,1fr);row-gap:10px}
48
54
  .connrow > .chip{grid-column:2;justify-self:start}
49
55
  .connacts{grid-column:2}
56
+ .connmcp{grid-template-columns:minmax(0,1fr)}
57
+ .connmcp > .ghbtn{justify-self:start}
50
58
  }
@@ -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,46 @@ 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("div", { className: "conntext" }, [
106
+ el("b", { textContent: label }),
107
+ el("code", { textContent: text }),
108
+ then ? el("small", { textContent: then }) : null,
109
+ ].filter(Boolean)),
110
+ copy,
111
+ ]),
112
+ );
113
+ }
114
+ return [head, el("p", { className: "sub", textContent: "Sign in with GitHub when it asks." }), list];
74
115
  }
75
116
 
76
117
  /** "Notion (integration key)" is only Notion where it is the one Notion on offer. */