-
Notifications
You must be signed in to change notification settings - Fork 1
debugging #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
debugging #30
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -883,15 +883,21 @@ export class MCPService implements Resource { | |
| // Get server's declared secret names from metadata | ||
| const serverSecretNames = server.secretNames ?? (server.secretName ? [server.secretName] : []) | ||
|
|
||
| // Extract secrets belonging to this server: keys stored as "${serverName}.${secretName}" | ||
| const prefix = `${serverName}.` | ||
| const serverSecrets: Record<string, string> = {} | ||
| for (const [key, value] of Object.entries(allSecrets)) { | ||
| if (key.startsWith(prefix)) { | ||
| serverSecrets[key.slice(prefix.length)] = value | ||
| } | ||
| } | ||
|
|
||
| if (serverSecretNames.length > 0) { | ||
| // Inject ONLY secrets declared by this server | ||
| // Inject only the declared secret names | ||
| const scopedSecrets: Record<string, string> = {} | ||
| for (const name of serverSecretNames) { | ||
| const prefixedName = `${serverName}.${name}` | ||
| if (allSecrets[name] !== undefined) { | ||
| scopedSecrets[name] = allSecrets[name] | ||
| } else if (allSecrets[prefixedName] !== undefined) { | ||
| scopedSecrets[name] = allSecrets[prefixedName] | ||
| if (serverSecrets[name] !== undefined) { | ||
| scopedSecrets[name] = serverSecrets[name] | ||
| } | ||
| } | ||
| args = { ...args, ...scopedSecrets } | ||
|
|
@@ -900,17 +906,16 @@ export class MCPService implements Resource { | |
| msg: `Scoped secrets applied to tool call - ${serverName}:${methodName} - ${Object.keys(scopedSecrets).join(', ')}` | ||
| }) | ||
| } else { | ||
| // Backward compatibility: if server has no declared secretNames, | ||
| // fall back to injecting all secrets (preserves existing behavior | ||
| // for servers not yet migrated to secretNames metadata). | ||
| args = { ...args, ...allSecrets } | ||
| // No declared secretNames — inject all secrets belonging to this server | ||
| args = { ...args, ...serverSecrets } | ||
| log({ | ||
| level: 'warn', | ||
| msg: `Server ${serverName} has no declared secretNames — injecting all secrets (legacy behavior)` | ||
| level: 'info', | ||
| msg: `Server secrets applied to tool call - ${serverName}:${methodName} - ${Object.keys(serverSecrets).join(', ')}` | ||
| }) | ||
| } | ||
| } | ||
| log({ level: 'info', msg: `Calling tool - ${serverName}:${methodName}` }) | ||
| log({ level: 'debug', msg: `callTool arguments keys: ${Object.keys(args).join(', ')}` }) | ||
| const requestOptions: RequestOptions = {} | ||
|
Comment on lines
917
to
919
|
||
| if (server.startupTimeout) { | ||
| requestOptions.timeout = server.startupTimeout | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This DEBUG log prints all argument keys after secrets are injected, which can reveal secret names (and in the legacy path, potentially the full set of stored secret keys). Consider filtering/removing known secret-related keys (or logging only non-secret keys / a count) to avoid leaking sensitive metadata when DEBUG is enabled.