@viren/claude-code-dashboard 0.0.6 → 0.0.8

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/src/sections.mjs CHANGED
@@ -21,8 +21,15 @@ export function renderSkillsCard(globalSkills) {
21
21
  </div>`;
22
22
  }
23
23
 
24
- export function renderMcpCard(mcpSummary, mcpPromotions, formerMcpServers) {
25
- if (!mcpSummary.length) return "";
24
+ export function renderMcpCard(
25
+ mcpSummary,
26
+ mcpPromotions,
27
+ formerMcpServers,
28
+ recommendedMcpServers,
29
+ availableMcpServers,
30
+ registryTotal,
31
+ ) {
32
+ if (!mcpSummary.length && !recommendedMcpServers.length && !availableMcpServers.length) return "";
26
33
  const rows = mcpSummary
27
34
  .map((s) => {
28
35
  const disabledClass = s.disabledIn > 0 ? " mcp-disabled" : "";
@@ -62,11 +69,52 @@ export function renderMcpCard(mcpSummary, mcpPromotions, formerMcpServers) {
62
69
  })
63
70
  .join("\n ")}`
64
71
  : "";
72
+ const recommendedHtml = recommendedMcpServers.length
73
+ ? `<details class="mcp-section"${recommendedMcpServers.length <= 5 ? " open" : ""}>
74
+ <summary class="label" style="cursor:pointer;margin-top:.75rem">Recommended <span class="cat-n">${recommendedMcpServers.length}</span></summary>
75
+ ${recommendedMcpServers
76
+ .map(
77
+ (s) =>
78
+ `<div class="mcp-recommended"><span class="mcp-name">${esc(s.name)}</span> <span class="mcp-rec-badge">recommended</span>` +
79
+ (s.description ? `<div class="mcp-desc">${esc(s.description)}</div>` : "") +
80
+ (s.reasons && s.reasons.length
81
+ ? `<div class="mcp-reason">${s.reasons.map((r) => esc(r)).join(", ")}</div>`
82
+ : "") +
83
+ (s.installCommand ? `<code class="mcp-install">${esc(s.installCommand)}</code>` : "") +
84
+ `</div>`,
85
+ )
86
+ .join("\n ")}
87
+ </details>`
88
+ : "";
89
+
90
+ const availableHtml = availableMcpServers.length
91
+ ? `<details class="mcp-section">
92
+ <summary class="label" style="cursor:pointer;margin-top:.75rem">Available <span class="cat-n">${availableMcpServers.length}</span></summary>
93
+ ${availableMcpServers
94
+ .map(
95
+ (s) =>
96
+ `<div class="mcp-available"><span class="mcp-name">${esc(s.name)}</span>` +
97
+ (s.description ? `<div class="mcp-desc">${esc(s.description)}</div>` : "") +
98
+ (s.installCommand ? `<code class="mcp-install">${esc(s.installCommand)}</code>` : "") +
99
+ `</div>`,
100
+ )
101
+ .join("\n ")}
102
+ </details>`
103
+ : "";
104
+
105
+ const registryNote =
106
+ registryTotal > 0
107
+ ? `<div class="mcp-registry-note">${registryTotal} servers in registry</div>`
108
+ : "";
109
+
65
110
  return `<div class="card" id="section-mcp">
66
111
  <h2>MCP Servers <span class="n">${mcpSummary.length}</span></h2>
67
112
  ${rows}
68
113
  ${promoteHtml}
69
114
  ${formerHtml}
115
+ ${recommendedHtml}
116
+ ${availableHtml}
117
+ ${registryNote}
70
118
  </div>`;
71
119
  }
72
120
 
@@ -805,6 +805,84 @@ details.cmd-detail > summary::-webkit-details-marker {
805
805
  .mcp-former {
806
806
  opacity: 0.4;
807
807
  }
808
+
809
+ /* ── MCP Registry Sections ──────────────────────────────── */
810
+ .mcp-section {
811
+ margin-top: 0.75rem;
812
+ }
813
+ .mcp-section > summary {
814
+ list-style: none;
815
+ }
816
+ .mcp-section > summary::-webkit-details-marker {
817
+ display: none;
818
+ }
819
+ .mcp-section > summary:hover {
820
+ color: var(--accent);
821
+ }
822
+ .mcp-recommended {
823
+ border-left: 2px solid var(--accent);
824
+ padding: 0.4rem 0.6rem;
825
+ margin-top: 0.35rem;
826
+ border-radius: 0 4px 4px 0;
827
+ background: var(--surface2);
828
+ }
829
+ .mcp-rec-badge {
830
+ font-size: 0.55rem;
831
+ font-weight: 600;
832
+ text-transform: uppercase;
833
+ letter-spacing: 0.04em;
834
+ padding: 0.1rem 0.35rem;
835
+ border-radius: 3px;
836
+ background: rgba(196, 149, 106, 0.15);
837
+ color: var(--accent);
838
+ border: 1px solid rgba(196, 149, 106, 0.3);
839
+ vertical-align: middle;
840
+ margin-left: 0.3rem;
841
+ }
842
+ .mcp-desc {
843
+ font-size: 0.7rem;
844
+ color: var(--text-dim);
845
+ margin-top: 0.15rem;
846
+ }
847
+ .mcp-reason {
848
+ font-size: 0.65rem;
849
+ color: var(--accent);
850
+ margin-top: 0.1rem;
851
+ font-style: italic;
852
+ }
853
+ .mcp-install {
854
+ display: block;
855
+ font-family: "SF Mono", "Fira Code", "JetBrains Mono", monospace;
856
+ font-size: 0.68rem;
857
+ color: var(--green);
858
+ background: var(--bg);
859
+ border: 1px solid var(--border);
860
+ border-radius: 4px;
861
+ padding: 0.3rem 0.5rem;
862
+ margin-top: 0.25rem;
863
+ cursor: pointer;
864
+ transition:
865
+ background 0.15s,
866
+ border-color 0.15s;
867
+ word-break: break-all;
868
+ }
869
+ .mcp-install:hover {
870
+ background: var(--surface2);
871
+ border-color: var(--accent-dim);
872
+ }
873
+ .mcp-available {
874
+ padding: 0.35rem 0.5rem;
875
+ margin-top: 0.3rem;
876
+ border-radius: 4px;
877
+ background: var(--surface2);
878
+ opacity: 0.85;
879
+ }
880
+ .mcp-registry-note {
881
+ font-size: 0.6rem;
882
+ color: var(--text-dim);
883
+ text-align: right;
884
+ margin-top: 0.75rem;
885
+ }
808
886
  .badge.mcp-former-badge {
809
887
  color: var(--text-dim);
810
888
  border-color: var(--border);
@@ -165,6 +165,24 @@ if (refreshBtn) {
165
165
  });
166
166
  }
167
167
 
168
+ // ── Click-to-copy MCP install commands ───────────────────
169
+ document.addEventListener("click", function (e) {
170
+ var install = e.target.closest(".mcp-install");
171
+ if (!install) return;
172
+ navigator.clipboard
173
+ .writeText(install.textContent)
174
+ .then(function () {
175
+ var orig = install.textContent;
176
+ install.textContent = "copied!";
177
+ setTimeout(function () {
178
+ install.textContent = orig;
179
+ }, 1500);
180
+ })
181
+ .catch(function () {
182
+ /* clipboard unavailable (file:// protocol, permissions) */
183
+ });
184
+ });
185
+
168
186
  // Custom tooltip for heatmap cells and peak bars
169
187
  var tip = document.getElementById("chart-tooltip");
170
188
  document.addEventListener("mouseover", function (e) {