fa-mcp-sdk 0.4.26 → 0.4.29

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/bin/fa-mcp.js CHANGED
@@ -360,7 +360,7 @@ certificate's public and private keys`,
360
360
  // Regular assignment behavior first
361
361
  const result = Reflect.set(target, prop, value, receiver);
362
362
  // Save to file asynchronously without blocking — only if project path is known
363
- const lastConfigPath = self.lastConfigPath;
363
+ const { lastConfigPath } = self;
364
364
  if (lastConfigPath) {
365
365
  fs.writeFile(lastConfigPath, JSON.stringify(target, null, 2), 'utf8')
366
366
  .catch(error => console.warn(`⚠️ Warning: Could not save config to file ${lastConfigPath}:`, error.message));
@@ -50,7 +50,7 @@
50
50
  "dependencies": {
51
51
  "@modelcontextprotocol/sdk": "^1.29.0",
52
52
  "dotenv": "^17.4.1",
53
- "fa-mcp-sdk": "^0.4.26"
53
+ "fa-mcp-sdk": "^0.4.29"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@types/express": "^5.0.6",
@@ -120,9 +120,14 @@
120
120
  <div class="form-group">
121
121
  <div class="prompt-label-row">
122
122
  <label for="systemPrompt">Agent Prompt</label>
123
- <button type="button" class="btn-enlarge" data-target="systemPrompt" title="Enlarge" data-testid="at-system-prompt-enlarge">
124
- <span class="material-icons-round">open_in_full</span>
125
- </button>
123
+ <div class="prompt-actions">
124
+ <button type="button" class="btn-reset-prompt" id="btnResetAgentPrompt" title="Reset to original agent prompt" data-testid="at-system-prompt-reset" style="display:none">
125
+ <span class="material-icons-round">restart_alt</span>
126
+ </button>
127
+ <button type="button" class="btn-enlarge" data-target="systemPrompt" title="Enlarge" data-testid="at-system-prompt-enlarge">
128
+ <span class="material-icons-round">open_in_full</span>
129
+ </button>
130
+ </div>
126
131
  </div>
127
132
  <textarea id="systemPrompt" placeholder="Enter system prompt..." rows="3" data-testid="at-system-prompt">You are a helpful AI assistant that can use MCP tools to help users. Be concise and accurate in your responses.</textarea>
128
133
  </div>
@@ -397,6 +397,8 @@ class McpAgentTester {
397
397
 
398
398
  this.systemPromptTextarea = document.getElementById('systemPrompt');
399
399
  this.customPromptTextarea = document.getElementById('customPrompt');
400
+ this.btnResetAgentPrompt = document.getElementById('btnResetAgentPrompt');
401
+ this.originalAgentPrompt = null;
400
402
 
401
403
  this.connectedServersContainer = document.getElementById('connectedServers');
402
404
 
@@ -442,6 +444,7 @@ class McpAgentTester {
442
444
 
443
445
  this.systemPromptTextarea.addEventListener('input', () => this.saveFormValuesToStorage());
444
446
  this.customPromptTextarea.addEventListener('input', () => this.saveFormValuesToStorage());
447
+ this.btnResetAgentPrompt.addEventListener('click', () => this.resetAgentPrompt());
445
448
 
446
449
  // LLM settings modal
447
450
  this.llmSettingsBtn.addEventListener('click', () => this.openLlmModal());
@@ -619,6 +622,8 @@ class McpAgentTester {
619
622
  if (result.config && result.config.agentPrompt) {
620
623
  this.systemPromptTextarea.value = result.config.agentPrompt;
621
624
  this.currentSystemPrompt = result.config.agentPrompt;
625
+ this.originalAgentPrompt = result.config.agentPrompt;
626
+ this.updateResetPromptButton();
622
627
  }
623
628
 
624
629
  this.addUrlToSaved(serverUrl);
@@ -704,6 +709,8 @@ class McpAgentTester {
704
709
  if (result.config && result.config.agentPrompt) {
705
710
  this.systemPromptTextarea.value = result.config.agentPrompt;
706
711
  this.currentSystemPrompt = result.config.agentPrompt;
712
+ this.originalAgentPrompt = result.config.agentPrompt;
713
+ this.updateResetPromptButton();
707
714
  }
708
715
 
709
716
  this.showToast('Successfully connected to ' + serverName, 'success');
@@ -826,11 +833,25 @@ class McpAgentTester {
826
833
  this.dynamicHeaders.appendChild(headerGroup);
827
834
 
828
835
  const nameEl = headerGroup.querySelector('.header-name');
829
- if (nameEl && hasDesc) {
836
+ if (nameEl) {
830
837
  nameEl.style.cursor = 'pointer';
838
+ let hoverTimer = null;
839
+ if (hasDesc) {
840
+ nameEl.addEventListener('mouseenter', (e) => {
841
+ hoverTimer = setTimeout(() => this.showHeaderTooltip(e, header.description), 1000);
842
+ });
843
+ nameEl.addEventListener('mouseleave', () => {
844
+ clearTimeout(hoverTimer);
845
+ this.hideHeaderTooltip();
846
+ });
847
+ }
831
848
  nameEl.addEventListener('click', (e) => {
832
849
  e.stopPropagation();
833
- this.toggleHeaderTooltip(e, header.description);
850
+ clearTimeout(hoverTimer);
851
+ this.hideHeaderTooltip();
852
+ this.copyToClipboard(header.name).then(() => {
853
+ this.showToast(`Copied: ${header.name}`, 'success');
854
+ });
834
855
  });
835
856
  }
836
857
 
@@ -848,12 +869,8 @@ class McpAgentTester {
848
869
  this.mcpConfig.headers = this.getHeadersFromForm();
849
870
  }
850
871
 
851
- toggleHeaderTooltip (e, text) {
872
+ showHeaderTooltip (e, text) {
852
873
  const tip = document.getElementById('headerTooltip');
853
- if (tip.classList.contains('visible') && tip._sourceEl === e.target) {
854
- this.hideHeaderTooltip();
855
- return;
856
- }
857
874
  tip._sourceEl = e.target;
858
875
  tip.textContent = text;
859
876
  const rect = e.target.getBoundingClientRect();
@@ -861,14 +878,6 @@ class McpAgentTester {
861
878
  tip.style.top = (rect.top - 4) + 'px';
862
879
  tip.style.transform = 'translateY(-100%)';
863
880
  tip.classList.add('visible');
864
-
865
- const dismissOnClick = (ev) => {
866
- if (ev.target !== e.target && !tip.contains(ev.target)) {
867
- this.hideHeaderTooltip();
868
- document.removeEventListener('click', dismissOnClick);
869
- }
870
- };
871
- setTimeout(() => document.addEventListener('click', dismissOnClick), 0);
872
881
  }
873
882
 
874
883
  hideHeaderTooltip () {
@@ -877,6 +886,25 @@ class McpAgentTester {
877
886
  tip._sourceEl = null;
878
887
  }
879
888
 
889
+ copyToClipboard (text) {
890
+ if (navigator.clipboard && navigator.clipboard.writeText) {
891
+ return navigator.clipboard.writeText(text).catch(() => this._fallbackCopy(text));
892
+ }
893
+ return this._fallbackCopy(text);
894
+ }
895
+
896
+ _fallbackCopy (text) {
897
+ const ta = document.createElement('textarea');
898
+ ta.value = text;
899
+ ta.style.position = 'fixed';
900
+ ta.style.opacity = '0';
901
+ document.body.appendChild(ta);
902
+ ta.select();
903
+ document.execCommand('copy');
904
+ document.body.removeChild(ta);
905
+ return Promise.resolve();
906
+ }
907
+
880
908
  updateHeaderBorder (inputEl) {
881
909
  if (inputEl.dataset.required === 'true') {
882
910
  if (inputEl.value.trim()) {
@@ -1047,6 +1075,8 @@ class McpAgentTester {
1047
1075
  headers: {},
1048
1076
  name: null,
1049
1077
  };
1078
+ this.originalAgentPrompt = null;
1079
+ this.updateResetPromptButton();
1050
1080
  window.history.replaceState({}, document.title, window.location.pathname);
1051
1081
  localStorage.removeItem('mcpAgentFormValues');
1052
1082
  }
@@ -1125,6 +1155,8 @@ class McpAgentTester {
1125
1155
  headers: {},
1126
1156
  name: null,
1127
1157
  };
1158
+ this.originalAgentPrompt = null;
1159
+ this.updateResetPromptButton();
1128
1160
  await this.loadCurrentServer();
1129
1161
  this.updateConnectionStatus();
1130
1162
  } else {
@@ -1656,6 +1688,18 @@ class McpAgentTester {
1656
1688
  this.saveFormValuesToStorage();
1657
1689
  }
1658
1690
 
1691
+ resetAgentPrompt () {
1692
+ if (this.originalAgentPrompt) {
1693
+ this.systemPromptTextarea.value = this.originalAgentPrompt;
1694
+ this.currentSystemPrompt = this.originalAgentPrompt;
1695
+ this.saveFormValuesToStorage();
1696
+ }
1697
+ }
1698
+
1699
+ updateResetPromptButton () {
1700
+ this.btnResetAgentPrompt.style.display = this.originalAgentPrompt ? '' : 'none';
1701
+ }
1702
+
1659
1703
  saveFormValuesToStorage () {
1660
1704
  const formData = {
1661
1705
  serverUrl: this.serverUrlInput.value,
@@ -514,7 +514,7 @@ body {
514
514
  text-decoration-style: dashed;
515
515
  text-underline-offset: 3px;
516
516
  text-decoration-color: var(--text-muted);
517
- cursor: help;
517
+ cursor: pointer;
518
518
  }
519
519
 
520
520
  .header-tooltip {
@@ -1385,6 +1385,32 @@ body {
1385
1385
  justify-content: space-between;
1386
1386
  }
1387
1387
 
1388
+ .prompt-actions {
1389
+ display: flex;
1390
+ align-items: center;
1391
+ gap: 2px;
1392
+ }
1393
+
1394
+ .btn-reset-prompt {
1395
+ background: none;
1396
+ border: none;
1397
+ color: var(--text-muted);
1398
+ cursor: pointer;
1399
+ padding: 2px;
1400
+ border-radius: var(--radius-sm);
1401
+ display: flex;
1402
+ align-items: center;
1403
+ transition: color 0.15s;
1404
+ }
1405
+
1406
+ .btn-reset-prompt:hover {
1407
+ color: var(--primary);
1408
+ }
1409
+
1410
+ .btn-reset-prompt .material-icons-round {
1411
+ font-size: 16px;
1412
+ }
1413
+
1388
1414
  .btn-enlarge {
1389
1415
  background: none;
1390
1416
  border: none;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "fa-mcp-sdk",
3
3
  "productName": "FA MCP SDK",
4
- "version": "0.4.26",
4
+ "version": "0.4.29",
5
5
  "description": "Core infrastructure and templates for building Model Context Protocol (MCP) servers with TypeScript",
6
6
  "type": "module",
7
7
  "main": "dist/core/index.js",