agent-discover 1.0.12 → 1.0.14

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.
@@ -2,7 +2,7 @@
2
2
  "id": "agent-discover",
3
3
  "name": "Discover",
4
4
  "icon": "explore",
5
- "version": "1.0.9",
5
+ "version": "1.0.14",
6
6
  "description": "MCP server registry — browse, install, configure, monitor",
7
7
  "ui": "./dist/ui/app.js",
8
8
  "css": "./dist/ui/styles.css",
package/dist/ui/app.js CHANGED
@@ -236,24 +236,24 @@
236
236
  : '';
237
237
 
238
238
  var actionBtn = s.active
239
- ? '<button class="btn-deactivate" onclick="window.__deactivateServer(' +
239
+ ? '<button class="btn-deactivate" data-action="deactivate" data-id="' +
240
240
  s.id +
241
- ')"><span class="material-symbols-outlined" style="font-size:14px">stop_circle</span>Deactivate</button>'
242
- : '<button class="btn-activate" onclick="window.__activateServer(' +
241
+ '"><span class="material-symbols-outlined" style="font-size:14px">stop_circle</span>Deactivate</button>'
242
+ : '<button class="btn-activate" data-action="activate" data-id="' +
243
243
  s.id +
244
- ')"><span class="material-symbols-outlined" style="font-size:14px">play_circle</span>Activate</button>';
244
+ '"><span class="material-symbols-outlined" style="font-size:14px">play_circle</span>Activate</button>';
245
245
 
246
246
  var healthBtn =
247
- '<button class="btn-health" onclick="window.__checkHealth(' +
247
+ '<button class="btn-health" data-action="health" data-id="' +
248
248
  s.id +
249
- ')"><span class="material-symbols-outlined" style="font-size:14px">favorite</span>Check Health</button>';
249
+ '"><span class="material-symbols-outlined" style="font-size:14px">favorite</span>Check Health</button>';
250
250
 
251
251
  var deleteBtn =
252
- '<button class="btn-delete" onclick="window.__deleteServer(' +
252
+ '<button class="btn-delete" data-action="delete" data-id="' +
253
253
  s.id +
254
- ", '" +
255
- esc(s.name).replace(/'/g, "\\'") +
256
- '\')"><span class="material-symbols-outlined" style="font-size:14px">delete</span>Delete</button>';
254
+ '" data-name="' +
255
+ escAttr(s.name) +
256
+ '"><span class="material-symbols-outlined" style="font-size:14px">delete</span>Delete</button>';
257
257
 
258
258
  var actionsSection =
259
259
  '<div class="server-actions">' + actionBtn + healthBtn + deleteBtn + '</div>';
@@ -310,7 +310,7 @@
310
310
  })
311
311
  .join('');
312
312
 
313
- morphdom(el, '<div id="installed-list" class="server-grid">' + html + '</div>');
313
+ morph(el, html);
314
314
  }
315
315
 
316
316
  // -------------------------------------------------------------------------
@@ -324,11 +324,11 @@
324
324
  '<div class="server-section">' +
325
325
  '<button class="section-toggle' +
326
326
  (isOpen ? ' open' : '') +
327
- '" onclick="window.__toggleSection(' +
327
+ '" data-action="toggle-section" data-id="' +
328
328
  serverId +
329
- ", '" +
329
+ '" data-section="' +
330
330
  name +
331
- '\')">' +
331
+ '">' +
332
332
  '<span class="material-symbols-outlined">chevron_right</span>' +
333
333
  esc(label) +
334
334
  '</button>' +
@@ -362,11 +362,11 @@
362
362
  '<span class="secret-value">' +
363
363
  esc(s.masked_value || '********') +
364
364
  '</span>' +
365
- '<button class="secret-delete" onclick="window.__deleteSecret(' +
365
+ '<button class="secret-delete" data-action="delete-secret" data-id="' +
366
366
  server.id +
367
- ", '" +
368
- esc(s.key).replace(/'/g, "\\'") +
369
- '\')" title="Delete secret">' +
367
+ '" data-key="' +
368
+ escAttr(s.key) +
369
+ '" title="Delete secret">' +
370
370
  '<span class="material-symbols-outlined" style="font-size:14px">close</span>' +
371
371
  '</button>' +
372
372
  '</div>'
@@ -382,9 +382,9 @@
382
382
  '<input type="password" placeholder="Value" id="secret-val-' +
383
383
  server.id +
384
384
  '" />' +
385
- '<button onclick="window.__addSecret(' +
385
+ '<button data-action="add-secret" data-id="' +
386
386
  server.id +
387
- ')">Save</button>' +
387
+ '">Save</button>' +
388
388
  '</div>';
389
389
 
390
390
  return items + addForm;
@@ -445,19 +445,19 @@
445
445
  '<input type="text" id="cfg-desc-' +
446
446
  server.id +
447
447
  '" value="' +
448
- esc(server.description || '').replace(/"/g, '&quot;') +
448
+ escAttr(server.description || '') +
449
449
  '" /></div>' +
450
450
  '<div class="config-field"><label>Command</label>' +
451
451
  '<input type="text" id="cfg-cmd-' +
452
452
  server.id +
453
453
  '" value="' +
454
- esc(server.command || '').replace(/"/g, '&quot;') +
454
+ escAttr(server.command || '') +
455
455
  '" /></div>' +
456
456
  '<div class="config-field"><label>Args (comma-separated)</label>' +
457
457
  '<input type="text" id="cfg-args-' +
458
458
  server.id +
459
459
  '" value="' +
460
- esc((server.args || []).join(', ')).replace(/"/g, '&quot;') +
460
+ escAttr((server.args || []).join(', ')) +
461
461
  '" /></div>' +
462
462
  '<div class="config-field"><label>Env vars (KEY=VALUE per line)</label>' +
463
463
  '<textarea id="cfg-env-' +
@@ -471,9 +471,9 @@
471
471
  .join('\n'),
472
472
  ) +
473
473
  '</textarea></div>' +
474
- '<button class="config-save" onclick="window.__saveConfig(' +
474
+ '<button class="config-save" data-action="save-config" data-id="' +
475
475
  server.id +
476
- ')">Save Config</button>' +
476
+ '">Save Config</button>' +
477
477
  '</div>'
478
478
  );
479
479
  }
@@ -488,10 +488,10 @@
488
488
  } else {
489
489
  el.innerHTML =
490
490
  '<div class="empty-state"><span class="material-symbols-outlined empty-icon">search_off</span><p>No results in MCP registry</p>' +
491
- "<a class=\"hint-link\" onclick=\"this.nextElementSibling.style.display='flex';this.style.display='none'\">Can't find it? Install from npm</a>" +
491
+ '<a class="hint-link" data-action="show-npm-form">Can\'t find it? Install from npm</a>' +
492
492
  '<div class="npm-install-form" style="display:none">' +
493
493
  '<input type="text" id="npm-package-input" placeholder="npm package name (e.g. @modelcontextprotocol/server-everything)" />' +
494
- '<button class="btn-install" onclick="window.__installFromNpm()"><span class="material-symbols-outlined" style="font-size:14px">download</span> Install</button>' +
494
+ '<button class="btn-install" data-action="install-npm"><span class="material-symbols-outlined" style="font-size:14px">download</span> Install</button>' +
495
495
  '</div></div>';
496
496
  }
497
497
  return;
@@ -542,11 +542,9 @@
542
542
  '<button class="btn-install" disabled title="Remote server — not supported for local activation"><span class="material-symbols-outlined" style="font-size:14px">cloud_off</span>Remote only</button>';
543
543
  } else {
544
544
  installBtn =
545
- '<button class="btn-install" data-browse-idx="' +
546
- idx +
547
- '" onclick="window.__installFromBrowse(' +
545
+ '<button class="btn-install" data-action="install-browse" data-browse-idx="' +
548
546
  idx +
549
- ', this)"><span class="material-symbols-outlined" style="font-size:14px">download</span>Install</button>';
547
+ '"><span class="material-symbols-outlined" style="font-size:14px">download</span>Install</button>';
550
548
  }
551
549
 
552
550
  return (
@@ -576,15 +574,26 @@
576
574
  })
577
575
  .join('');
578
576
 
579
- morphdom(el, '<div id="browse-list" class="server-grid">' + html + '</div>');
577
+ morph(el, html);
580
578
  }
581
579
 
582
580
  function esc(str) {
581
+ if (str === null || str === undefined) return '';
583
582
  var div = document.createElement('div');
584
- div.appendChild(document.createTextNode(str));
583
+ div.textContent = String(str);
585
584
  return div.innerHTML;
586
585
  }
587
586
 
587
+ function escAttr(str) {
588
+ return esc(str).replace(/"/g, '&quot;');
589
+ }
590
+
591
+ function morph(el, newInnerHTML) {
592
+ var wrap = document.createElement(el.tagName);
593
+ wrap.innerHTML = newInnerHTML;
594
+ morphdom(el, wrap, { childrenOnly: true });
595
+ }
596
+
588
597
  // -------------------------------------------------------------------------
589
598
  // Server actions
590
599
  // -------------------------------------------------------------------------
@@ -961,10 +970,68 @@
961
970
  // Init
962
971
  // -------------------------------------------------------------------------
963
972
 
973
+ function _initDelegatedClicks() {
974
+ var root =
975
+ AD._root.getElementById('server-list') ||
976
+ AD._root.getElementById('tab-installed') ||
977
+ AD._root.body ||
978
+ AD._root;
979
+ // Use a broad container — the main content area
980
+ var container =
981
+ AD._root.querySelector('.main-content') || AD._root.querySelector('.ad-wrapper') || AD._root;
982
+ container.addEventListener('click', function (e) {
983
+ var btn = e.target.closest('[data-action]');
984
+ if (!btn) return;
985
+ var action = btn.dataset.action;
986
+ var id = parseInt(btn.dataset.id, 10);
987
+
988
+ switch (action) {
989
+ case 'activate':
990
+ window.__activateServer(id);
991
+ break;
992
+ case 'deactivate':
993
+ window.__deactivateServer(id);
994
+ break;
995
+ case 'health':
996
+ window.__checkHealth(id);
997
+ break;
998
+ case 'delete':
999
+ window.__deleteServer(id, btn.dataset.name);
1000
+ break;
1001
+ case 'toggle-section':
1002
+ window.__toggleSection(id, btn.dataset.section);
1003
+ break;
1004
+ case 'delete-secret':
1005
+ window.__deleteSecret(id, btn.dataset.key);
1006
+ break;
1007
+ case 'add-secret':
1008
+ window.__addSecret(id);
1009
+ break;
1010
+ case 'save-config':
1011
+ window.__saveConfig(id);
1012
+ break;
1013
+ case 'install-npm':
1014
+ window.__installFromNpm();
1015
+ break;
1016
+ case 'install-browse':
1017
+ window.__installFromBrowse(parseInt(btn.dataset.browseIdx, 10), btn);
1018
+ break;
1019
+ case 'show-npm-form':
1020
+ var form = btn.nextElementSibling;
1021
+ if (form) {
1022
+ form.style.display = 'flex';
1023
+ btn.style.display = 'none';
1024
+ }
1025
+ break;
1026
+ }
1027
+ });
1028
+ }
1029
+
964
1030
  function _init() {
965
1031
  initTabs();
966
1032
  initTheme();
967
1033
  initSearch();
1034
+ _initDelegatedClicks();
968
1035
  connect();
969
1036
  initThemeSync();
970
1037
  }
@@ -1132,6 +1199,8 @@
1132
1199
 
1133
1200
  AD._root = shadow;
1134
1201
  _init();
1202
+ var themeBtn = shadow.getElementById('theme-toggle');
1203
+ if (themeBtn) themeBtn.style.display = 'none';
1135
1204
  };
1136
1205
 
1137
1206
  AD.unmount = function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-discover",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "mcpName": "io.github.keshrath/agent-discover",
5
5
  "description": "MCP server registry and marketplace — discover, install, activate, and manage MCP tools on demand",
6
6
  "type": "module",