Skip to content

Commit be58caa

Browse files
committed
fix: prevent config mutation in MCP client URL retry logic
Fixed an issue where the MCP client was mutating the shared configuration object's URL during retry attempts. This could cause configuration corruption if the same config object was reused elsewhere.
1 parent a766e01 commit be58caa

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

apps/sim/lib/mcp/client.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,14 +344,16 @@ export class McpClient {
344344
]
345345

346346
let lastError: Error | null = null
347+
const originalUrl = this.config.url
347348

348349
for (const [index, url] of urlsToTry.entries()) {
349350
try {
350351
await this.attemptHttpRequest(request, url, index === 0)
351352

352353
if (index > 0) {
353-
logger.info(`[${this.config.name}] Updated URL from ${this.config.url} to ${url}`)
354-
this.config.url = url
354+
logger.info(
355+
`[${this.config.name}] Successfully used alternative URL format: ${url} (original: ${originalUrl})`
356+
)
355357
}
356358
return
357359
} catch (error) {

0 commit comments

Comments
 (0)