You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Naming Convention**: All event data fields use **snake_case** (e.g., `server_id`, `team_id`, `spawn_duration_ms`) to match the backend API convention.
66
66
</Note>
67
67
68
-
The satellite emits 12 event types across 4 categories:
68
+
The satellite emits 13 event types across 4 categories:
69
69
70
70
### MCP Server Lifecycle
71
71
@@ -226,21 +226,40 @@ Emitted when SSE connection closes (client disconnect, timeout, or error).
226
226
### Tool Discovery
227
227
228
228
#### `mcp.tools.discovered`
229
-
Emitted after successful tool discovery from HTTP or stdio MCP server.
229
+
Emitted after successful tool discovery from HTTP or stdio MCP server with complete tool metadata and token consumption.
230
230
231
231
**Data Structure:**
232
232
```typescript
233
233
{
234
-
server_id: string;
235
-
server_slug: string;
234
+
installation_id: string;
235
+
installation_name: string;
236
236
team_id: string;
237
-
tool_count: number;
238
-
tool_names: string[];
239
-
discovery_duration_ms: number;
240
-
previous_tool_count: number;
237
+
server_slug: string;
238
+
tool_count: number; // Total tools discovered
239
+
total_tokens: number; // Sum of all tool token counts
240
+
tools: Array<{
241
+
tool_name:string;
242
+
description:string;
243
+
input_schema:Record<string, unknown>;
244
+
token_count:number; // Tokens for this specific tool
245
+
}>;
246
+
discovered_at: string; // ISO 8601 timestamp
241
247
}
242
248
```
243
249
250
+
**Purpose:**
251
+
- Store tool metadata in backend database (`mcpToolMetadata` table)
252
+
- Calculate hierarchical router token savings (traditional vs 2-meta-tool approach)
253
+
- Enable frontend tool catalog display with token consumption metrics
254
+
- Provide analytics on MCP server complexity and context window usage
255
+
256
+
**Emission Timing:**
257
+
- stdio servers: After handshake completion and tool caching
258
+
- HTTP/SSE servers: After startup tool discovery and caching
259
+
260
+
**Token Calculation:**
261
+
Uses `token-counter.ts` utility to estimate tokens for each tool based on name, description, and input schema JSON.
262
+
244
263
#### `mcp.tools.updated`
245
264
Emitted when tool list changes during configuration refresh.
-**Use consistent naming**: camelCase and standard field names
325
325
326
+
## Secret Masking in Logs
327
+
328
+
The satellite automatically protects sensitive credentials in log output through selective secret masking. This prevents API keys, tokens, and passwords from appearing in plain text in log files or monitoring systems.
329
+
330
+
### How Secret Masking Works
331
+
332
+
**Automatic Detection:**
333
+
- Backend sends metadata with MCP server configurations identifying which fields are secrets
334
+
- Satellite receives `secret_metadata` with lists of secret query parameters, headers, and environment variables
335
+
- Masking utilities automatically apply to fields marked as secrets
336
+
337
+
**Masking Pattern:**
338
+
- First 3 characters remain visible followed by `*****` (e.g., `sk_abc123xyz789` becomes `sk_*****`)
339
+
- Values shorter than 3 characters are fully masked as `***`
340
+
- Non-secret values remain fully visible for debugging
341
+
342
+
### Using the Log Masker Utility
343
+
344
+
The log masking utilities are located in `src/utils/log-masker.ts` and provide three functions for masking different configuration types:
Copy file name to clipboardExpand all lines: development/satellite/tool-discovery.mdx
+52Lines changed: 52 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -231,6 +231,58 @@ stdio tools persist in cache for optimal performance:
231
231
**Idle Process Management**: stdio processes that remain inactive for the configured idle timeout (default: 3 minutes) are automatically terminated to save memory. However, **tools remain cached** so when a client requests them, the process respawns instantly without needing to rediscover tools. This reduces respawn time from 1-3 seconds to 1-2 seconds. See [Idle Process Management](/development/satellite/idle-process-management) for details.
232
232
</Info>
233
233
234
+
## Tool Metadata Collection
235
+
236
+
After tool discovery completes, the satellite emits tool metadata to the backend for storage and analysis.
237
+
238
+
### Event Emission (Post-Discovery)
239
+
240
+
Following successful tool discovery (both HTTP/SSE and stdio), the satellite:
241
+
242
+
1.**Calculates token consumption** using the `token-counter.ts` utility
243
+
2.**Builds event payload** with tool metadata including per-tool token counts
244
+
3.**Emits `mcp.tools.discovered` event** to backend via EventBus
245
+
4.**Backend stores metadata** in `mcpToolMetadata` table for team visibility
246
+
247
+
**Event Payload Structure:**
248
+
```typescript
249
+
{
250
+
installation_id: string;
251
+
installation_name: string;
252
+
team_id: string;
253
+
server_slug: string;
254
+
tool_count: number; // Total tools discovered
255
+
total_tokens: number; // Sum of all tool token counts
256
+
tools: Array<{
257
+
tool_name:string;
258
+
description:string;
259
+
input_schema:Record<string, unknown>;
260
+
token_count:number; // Tokens for this specific tool
261
+
}>;
262
+
discovered_at: string; // ISO 8601 timestamp
263
+
}
264
+
```
265
+
266
+
**Integration Points:**
267
+
-`StdioToolDiscoveryManager`: Emits after stdio tool discovery completes
268
+
-`RemoteToolDiscoveryManager`: Emits after HTTP/SSE tool discovery completes
269
+
-`EventBus`: Batches events every 3 seconds for efficient transmission
270
+
- Backend handler: Stores tools with delete-then-insert strategy
271
+
272
+
**Token Calculation:**
273
+
The satellite uses `estimateMcpServerTokens()` from `token-counter.ts` to calculate:
Copy file name to clipboardExpand all lines: general/mcp-configuration.mdx
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -221,7 +221,9 @@ Servers synced from the official MCP Registry can use different transport mechan
221
221
Servers that run as local processes using standard input/output. Arguments are configured in the template level (locked), with runtime arguments at team/user levels.
222
222
223
223
**HTTP/SSE Transport (via remotes):**
224
-
Servers accessed via HTTP endpoints. Headers are mapped to appropriate tiers - authentication headers at team level, optional headers at user level.
224
+
Servers accessed via HTTP endpoints. Both headers and URL query parameters are mapped to appropriate tiers:
225
+
-**HTTP Headers** - Authentication headers at team level, optional headers at user level
226
+
-**URL Query Parameters** - API keys and tokens at team level, personal preferences at user level
225
227
226
228
The three-tier system adapts automatically based on the transport type detected from the official registry.
0 commit comments