fa-mcp-sdk 0.12.6 → 0.12.10

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.
@@ -58,7 +58,7 @@
58
58
  "dependencies": {
59
59
  "@modelcontextprotocol/sdk": "^1.29.0",
60
60
  "dotenv": "^17.4.1",
61
- "fa-mcp-sdk": "^0.12.6"
61
+ "fa-mcp-sdk": "^0.12.10"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@types/express": "^5.0.6",
@@ -1,5 +1,6 @@
1
1
  # Copy this file to local.yaml and update with your database credentials
2
2
  # local.yaml is gitignored and won't be committed
3
+ # ^ *#>[^\n]+\n
3
4
  ---
4
5
 
5
6
  #> ========================================================================
@@ -133,6 +133,15 @@
133
133
  </button>
134
134
  </div>
135
135
 
136
+ <!-- MCP Apps mode toggle — placed before the mode (tab) switcher -->
137
+ <label id="appModeToggleLabel" class="app-mode-toggle" title="MCP Apps mode: advertises UI capability and renders widgets" data-testid="at-app-mode-toggle-label">
138
+ <input type="checkbox" id="appModeToggle" data-testid="at-app-mode-toggle">
139
+ <span class="app-mode-toggle-text">
140
+ <span class="material-icons-round app-mode-icon">grid_view</span>
141
+ <span class="app-mode-label">Apps</span>
142
+ </span>
143
+ </label>
144
+
136
145
  <!-- Tabs moved into header -->
137
146
  <div class="tabs-bar header-tabs" data-testid="at-tabs-bar">
138
147
  <button type="button" class="tab-btn active" data-tab="chat" data-testid="at-tab-chat">
@@ -177,17 +186,6 @@
177
186
  </form>
178
187
 
179
188
  <div class="chat-actions">
180
- <label id="appModeToggleLabel" class="app-mode-toggle" title="MCP Apps mode: advertises UI capability and renders widgets" data-testid="at-app-mode-toggle-label">
181
- <input type="checkbox" id="appModeToggle" data-testid="at-app-mode-toggle">
182
- <span class="app-mode-toggle-text">
183
- <span class="material-icons-round app-mode-icon">grid_view</span>
184
- <span class="app-mode-label">Apps</span>
185
- </span>
186
- </label>
187
- <select id="defaultDisplayFormat" class="header-format-select chat-only" title="Default display format" data-testid="at-default-format">
188
- <option value="HTML">HTML</option>
189
- <option value="MD">MD</option>
190
- </select>
191
189
  <button id="clearChat" class="btn-icon chat-only" title="Clear Chat" data-testid="at-clear-chat">
192
190
  <span class="material-icons-round">delete_outline</span>
193
191
  </button>
@@ -204,6 +202,11 @@
204
202
  <div class="tab-pane active" id="tabPaneChat" data-testid="at-tab-pane-chat">
205
203
  <!-- Chat Messages -->
206
204
  <div class="chat-container">
205
+ <!-- Floating HTML/MD display format toggle — applies to chat only -->
206
+ <select id="defaultDisplayFormat" class="chat-format-float" title="Default display format" data-testid="at-default-format">
207
+ <option value="HTML">HTML</option>
208
+ <option value="MD">MD</option>
209
+ </select>
207
210
  <div id="chatMessages" class="chat-messages" data-testid="at-chat-messages">
208
211
  <div class="message assistant welcome" data-testid="at-welcome-message">
209
212
  <div class="message-avatar">
@@ -586,6 +586,7 @@ class McpAgentTester {
586
586
  this.usedHeaders = [];
587
587
  this.pendingConnectionData = null;
588
588
  this._headersUpdateTimer = null;
589
+ this._headersApplyPromise = null;
589
590
  this.defaultMcpUrl = null;
590
591
  this.authEnabled = false;
591
592
  this.configHttpHeaders = {};
@@ -1075,6 +1076,8 @@ class McpAgentTester {
1075
1076
  return;
1076
1077
  }
1077
1078
 
1079
+ await this.flushPendingHeaders();
1080
+
1078
1081
  try {
1079
1082
  const resp = await apiFetch(`${API_BASE}/api/mcp/call-tool`, {
1080
1083
  method: 'POST',
@@ -2016,10 +2019,36 @@ class McpAgentTester {
2016
2019
  clearTimeout(this._headersUpdateTimer);
2017
2020
  }
2018
2021
  this._headersUpdateTimer = setTimeout(() => {
2019
- this.applyHeadersUpdate().catch((err) => console.warn('Apply headers failed:', err));
2022
+ this._headersUpdateTimer = null;
2023
+ this._runHeadersUpdate();
2020
2024
  }, 600);
2021
2025
  }
2022
2026
 
2027
+ _runHeadersUpdate() {
2028
+ this._headersApplyPromise = this.applyHeadersUpdate()
2029
+ .catch((err) => console.warn('Apply headers failed:', err))
2030
+ .finally(() => {
2031
+ this._headersApplyPromise = null;
2032
+ });
2033
+ return this._headersApplyPromise;
2034
+ }
2035
+
2036
+ // Flush any pending (debounced or in-flight) header update so a direct tool
2037
+ // call sees the latest header values on the server. Without this, a fast
2038
+ // "Send Request" click races the 600 ms debounce and the call goes out with
2039
+ // the previously applied (or empty) headers — e.g. a missing
2040
+ // x-on-behalf-of-user yields MISSING_USER_IDENTITY.
2041
+ async flushPendingHeaders() {
2042
+ if (this._headersUpdateTimer) {
2043
+ clearTimeout(this._headersUpdateTimer);
2044
+ this._headersUpdateTimer = null;
2045
+ this._runHeadersUpdate();
2046
+ }
2047
+ if (this._headersApplyPromise) {
2048
+ await this._headersApplyPromise;
2049
+ }
2050
+ }
2051
+
2023
2052
  async applyHeadersUpdate() {
2024
2053
  if (!this.currentServer || !this.currentServer.name) {
2025
2054
  return;
@@ -3596,6 +3625,9 @@ class McpAgentTester {
3596
3625
  this.ttResponseContent.innerHTML = '';
3597
3626
  this.ttResponseContent.textContent = '⏳ Waiting for response…';
3598
3627
 
3628
+ // Ensure debounced header edits reach the server before the direct call.
3629
+ await this.flushPendingHeaders();
3630
+
3599
3631
  const startedAt = performance.now();
3600
3632
  try {
3601
3633
  const response = await apiFetch(`${API_BASE}/api/mcp/call-tool`, {
@@ -887,7 +887,12 @@ body {
887
887
  display: none !important;
888
888
  }
889
889
 
890
- .header-format-select {
890
+ /* Floating HTML/MD display format toggle, pinned to the chat window's top-right */
891
+ .chat-format-float {
892
+ position: absolute;
893
+ top: 8px;
894
+ left: 8px;
895
+ z-index: 5;
891
896
  font-size: 12px;
892
897
  padding: 4px 6px;
893
898
  border: 1px solid var(--border);
@@ -895,6 +900,13 @@ body {
895
900
  background: var(--bg-surface);
896
901
  color: var(--text-primary);
897
902
  cursor: pointer;
903
+ opacity: 0.85;
904
+ box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.15));
905
+ transition: opacity 0.15s;
906
+ }
907
+
908
+ .chat-format-float:hover {
909
+ opacity: 1;
898
910
  }
899
911
 
900
912
  /* MCP Apps toggle — global, visible on every tab */
@@ -1290,12 +1302,14 @@ body {
1290
1302
  overflow: auto;
1291
1303
  }
1292
1304
 
1293
- /* Inspector tab visibility tied to MCP Apps mode */
1294
- .app-only-tab {
1305
+ /* Inspector tab visibility tied to MCP Apps mode.
1306
+ Specificity must beat the base `.tab-btn { display: inline-flex }` rule, so the
1307
+ hide selector is scoped under `.tabs-bar`. */
1308
+ .tabs-bar .app-only-tab {
1295
1309
  display: none;
1296
1310
  }
1297
1311
 
1298
- .app.apps-mode-on .app-only-tab {
1312
+ .app.apps-mode-on .tabs-bar .app-only-tab {
1299
1313
  display: inline-flex;
1300
1314
  }
1301
1315
 
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.12.6",
4
+ "version": "0.12.10",
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",