Skip to content

Commit 1b2ee26

Browse files
authored
chore(mcp): remove temporary HTTP diagnostics (#5795)
Reverts the temporary McpHttpDiag instrumentation from #5782 now that it has served its purpose: it confirmed the OAuth fetch fix (#5789) makes the flow reach and complete the token exchange, and it isolated a separate, pre-existing transport-initialize stall (Gauge returns 200 + session then no body for 30s, reproducible only from the staging egress — not from a fresh IP, and not with the SDK/h2/pinning/tee in isolation). - Delete apps/sim/lib/mcp/http-diagnostics.ts. - Restore client.ts transport fetch to `...(pinned ? { fetch: pinned.fetch } : {})`. - Restore oauth/auth.ts fetchFn to the plain SSRF-guarded default. - Drop the diagnostic-specific test assertion. Removes the body tee() from the transport hot path so the streamable-HTTP connection runs clean while the transport stall is investigated separately.
1 parent dd0e736 commit 1b2ee26

4 files changed

Lines changed: 2 additions & 185 deletions

File tree

apps/sim/lib/mcp/client.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,6 @@ describe('McpClient notification handler', () => {
381381
{
382382
authProvider,
383383
requestInit: { headers: { 'X-Sim-Via': 'workflow' } },
384-
// The transport fetch is always wrapped for diagnostics (a no-op passthrough
385-
// under test); it defaults to globalThis.fetch when the server isn't pinned.
386-
fetch: expect.any(Function),
387384
}
388385
)
389386
})

apps/sim/lib/mcp/client.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import { createLogger } from '@sim/logger'
1212
import { getErrorMessage } from '@sim/utils/errors'
1313
import { getMaxExecutionTimeout } from '@/lib/core/execution-limits'
1414
import { getMcpSafeErrorDiagnostics } from '@/lib/mcp/error-diagnostics'
15-
import { withMcpHttpDiagnostics } from '@/lib/mcp/http-diagnostics'
1615
import { McpOauthRedirectRequired } from '@/lib/mcp/oauth'
1716
import { createPinnedMcpFetch } from '@/lib/mcp/pinned-fetch'
1817
import {
@@ -102,9 +101,7 @@ export class McpClient {
102101
this.transport = new StreamableHTTPClientTransport(new URL(this.config.url), {
103102
authProvider: useOauth ? this.authProvider : undefined,
104103
requestInit: { headers: this.config.headers },
105-
// Wrap whether pinned or not (SDK's default is globalThis.fetch, so passing it is
106-
// behavior-neutral) so the diagnostic also covers unpinned/allowlisted servers.
107-
fetch: withMcpHttpDiagnostics(pinned?.fetch ?? globalThis.fetch, 'transport'),
104+
...(pinned ? { fetch: pinned.fetch } : {}),
108105
})
109106

110107
this.client = new Client(

apps/sim/lib/mcp/http-diagnostics.ts

Lines changed: 0 additions & 176 deletions
This file was deleted.

apps/sim/lib/mcp/oauth/auth.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { auth, type OAuthClientProvider } from '@modelcontextprotocol/sdk/client/auth.js'
2-
import { withMcpHttpDiagnostics } from '@/lib/mcp/http-diagnostics'
32
import { createSsrfGuardedMcpFetch } from '@/lib/mcp/pinned-fetch'
43

54
type McpAuthOptions = Parameters<typeof auth>[1]
@@ -18,6 +17,6 @@ export function mcpAuthGuarded(
1817
): ReturnType<typeof auth> {
1918
return auth(provider, {
2019
...options,
21-
fetchFn: withMcpHttpDiagnostics(options.fetchFn ?? createSsrfGuardedMcpFetch(), 'oauth'),
20+
fetchFn: options.fetchFn ?? createSsrfGuardedMcpFetch(),
2221
})
2322
}

0 commit comments

Comments
 (0)