René's URL Explorer Experiment


Title: fix(mcp): pin outbound connections to IPv4 to avoid unreachable-IPv6 hangs by waleedlatif1 · Pull Request #5798 · simstudioai/sim · GitHub

Open Graph Title: fix(mcp): pin outbound connections to IPv4 to avoid unreachable-IPv6 hangs by waleedlatif1 · Pull Request #5798 · simstudioai/sim

X Title: fix(mcp): pin outbound connections to IPv4 to avoid unreachable-IPv6 hangs by waleedlatif1 · Pull Request #5798 · simstudioai/sim

Description: The real root cause (empirically confirmed) The MCP "connecting forever" / tool-discovery 30s timeouts in production — affecting Gauge, Exa, and PlanetScale alike — were caused by IP-family pinning, not OAuth or HTTP/2 (which the earlier PRs fixed but were different layers). The chain, every link verified against production: SSRF protection pins each outbound connection to a single resolved IP (createPinnedLookup), which strips Happy Eyeballs' IPv4 fallback. dns.lookup(host, { verbatim: true }) returns the IPv6 address first for Cloudflare-fronted dual-stack hosts — verified: app.withgauge.com → 2606:4700:…, api.exa.ai → 2606:4700:…. Production's app subnets have zero IPv6 egress — no IPv6 CIDR, IPv4-only via NAT Gateway (AWS NAT Gateways are IPv4-only). Verified on both subnets + route tables. So the connection pinned to IPv6 connects into a void and hangs → the SDK's 30s timeout fires (AbortError, durationMs=30002). Intermittent because the resolver rotates A/AAAA order (works on retry when it picks IPv4). This explains everything that didn't add up: why #5797 (h1.1) didn't fix it (protocol-independent), and why it never reproduced locally (dev machines have IPv6 egress). Empirical proof (undici, pinned lookup): pin IPv6-blackhole ONLY (current behavior) → FAIL after 8001ms (TimeoutError) ← the prod hang prefer IPv4 / include IPv4 in the set → status 200 in ~600ms ← reachable Fix At both pinned-resolution sites — validateMcpServerSsrf (MCP) and validateUrlWithDNS (providers / A2A / SMTP, same latent bug) — resolve all addresses ({ all: true, verbatim: true }) and prefer an IPv4 address; IPv6-only hosts still pin their sole address. This keeps the single-IP pinning API and threading untouched (near-zero blast radius) and SSRF validation of the pinned IP is unchanged. Verified end-to-end: app.withgauge.com and api.exa.ai now pin their IPv4 address instead of the unreachable IPv6. Type of Change Bug fix Testing Full lib/mcp suite green (374); lib/core/security green; tsc + biome clean. Added tests: dual-stack host prefers IPv4; IPv6-only host pins its sole address. The definitive confirmation is re-testing on staging/prod once deployed. Note A fuller fix (pin the validated set of all resolved IPs and let undici do Happy Eyeballs, so it's egress-agnostic) is a good follow-up, but it threads string → string[] through ~10 security-critical sites; preferring IPv4 fixes the confirmed bug now with minimal risk. Checklist Code follows project style guidelines Self-reviewed my changes Tests added/updated and passing No new warnings introduced I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Open Graph Description: The real root cause (empirically confirmed) The MCP "connecting forever" / tool-discovery 30s timeouts in production — affecting Gauge, Exa, and PlanetScale alike — were caused by IP-fami...

X Description: The real root cause (empirically confirmed) The MCP "connecting forever" / tool-discovery 30s timeouts in production — affecting Gauge, Exa, and PlanetScale alike — were caused by...

Opengraph URL: https://github.com/simstudioai/sim/pull/5798

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:83550284-cf3b-a863-9ed5-7ae422523861
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idD78C:C1BD7:FA3CD7:169333C:6A632D74
html-safe-nonce84c626c666f083321551138a0674713764493bf0f176bb7e6300f126b69fa161
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENzhDOkMxQkQ3OkZBM0NENzoxNjkzMzNDOjZBNjMyRDc0IiwidmlzaXRvcl9pZCI6IjE5ODQxNTAxNzA5ODE1NzYwNTIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac0bafe3c2119577e8adabe4d4483c554d800cc7f25e3a5fe403f59812b3d03fcc
hovercard-subject-tagpull_request:4096742160
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/5798/files
twitter:imagehttps://avatars.githubusercontent.com/u/40672544?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/40672544?s=400&v=4
og:image:altThe real root cause (empirically confirmed) The MCP "connecting forever" / tool-discovery 30s timeouts in production — affecting Gauge, Exa, and PlanetScale alike — were caused by IP-fami...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None30c644d502bce6cd2e59f9000b4744f2b64819abea8e8f959b18e3ad793125aa
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/simstudioai/sim git https://github.com/simstudioai/sim.git
octolytics-dimension-user_id199344406
octolytics-dimension-user_loginsimstudioai
octolytics-dimension-repository_id912559512
octolytics-dimension-repository_nwosimstudioai/sim
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id912559512
octolytics-dimension-repository_network_root_nwosimstudioai/sim
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release331492a48ebd91d66ef2de38e1901bb911c9fe9b
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/5798/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F5798%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
Code QualityEnforce quality at mergehttps://github.com/features/code-quality
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F5798%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=simstudioai%2Fsim
Reloadhttps://github.com/simstudioai/sim/pull/5798/files
Reloadhttps://github.com/simstudioai/sim/pull/5798/files
Reloadhttps://github.com/simstudioai/sim/pull/5798/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5798/files
simstudioai https://github.com/simstudioai
simhttps://github.com/simstudioai/sim
Notifications https://github.com/login?return_to=%2Fsimstudioai%2Fsim
Fork 3.7k https://github.com/login?return_to=%2Fsimstudioai%2Fsim
Star 29.2k https://github.com/login?return_to=%2Fsimstudioai%2Fsim
Code https://github.com/simstudioai/sim
Issues 111 https://github.com/simstudioai/sim/issues
Pull requests 120 https://github.com/simstudioai/sim/pulls
Actions https://github.com/simstudioai/sim/actions
Projects https://github.com/simstudioai/sim/projects
Security and quality 0 https://github.com/simstudioai/sim/security
Insights https://github.com/simstudioai/sim/pulse
Code https://github.com/simstudioai/sim
Issues https://github.com/simstudioai/sim/issues
Pull requests https://github.com/simstudioai/sim/pulls
Actions https://github.com/simstudioai/sim/actions
Projects https://github.com/simstudioai/sim/projects
Security and quality https://github.com/simstudioai/sim/security
Insights https://github.com/simstudioai/sim/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
waleedlatif1https://github.com/waleedlatif1
staginghttps://github.com/simstudioai/sim/tree/staging
fix/mcp-pin-ipv4-egresshttps://github.com/simstudioai/sim/tree/fix/mcp-pin-ipv4-egress
Conversation 6 https://github.com/simstudioai/sim/pull/5798
Commits 2 https://github.com/simstudioai/sim/pull/5798/commits
Checks 19 https://github.com/simstudioai/sim/pull/5798/checks
Files changed https://github.com/simstudioai/sim/pull/5798/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5798/files
fix(mcp): pin outbound connections to IPv4 to avoid unreachable-IPv6 hangs https://github.com/simstudioai/sim/pull/5798/files#top
Show all changes 2 commits https://github.com/simstudioai/sim/pull/5798/files
b249ea0 fix(mcp): pin outbound connections to IPv4 to avoid unreachable-IPv6 … waleedlatif1 Jul 21, 2026 https://github.com/simstudioai/sim/pull/5798/commits/b249ea0c0451d6d79109f79d939a532917587e02
a866409 chore(mcp): trim inline comments on the IPv4-preference fix waleedlatif1 Jul 21, 2026 https://github.com/simstudioai/sim/pull/5798/commits/a8664099cf6480cf279334c004695d2f9bee699d
Clear filters https://github.com/simstudioai/sim/pull/5798/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5798/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5798/files
input-validation.server.ts https://github.com/simstudioai/sim/pull/5798/files#diff-6aff011dd9656fc3e2283ce7a33580a51622749a977dcacb0b75050284426798
domain-check.test.ts https://github.com/simstudioai/sim/pull/5798/files#diff-c3b6f6da4482a0e907673b6a0ad0d3eeab10c842e166a4c8181abee0f29198c0
domain-check.ts https://github.com/simstudioai/sim/pull/5798/files#diff-58bd7213609870689904920cd34776c761a43f28c35b7672a1925630fcb8676b
apps/sim/lib/core/security/input-validation.server.tshttps://github.com/simstudioai/sim/pull/5798/files#diff-6aff011dd9656fc3e2283ce7a33580a51622749a977dcacb0b75050284426798
View file https://github.com/simstudioai/sim/blob/a8664099cf6480cf279334c004695d2f9bee699d/apps/sim/lib/core/security/input-validation.server.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/5798/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/5798/files#diff-6aff011dd9656fc3e2283ce7a33580a51622749a977dcacb0b75050284426798
Please reload this pagehttps://github.com/simstudioai/sim/pull/5798/files
https://github.com/simstudioai/sim/pull/5798/files#diff-6aff011dd9656fc3e2283ce7a33580a51622749a977dcacb0b75050284426798
apps/sim/lib/mcp/domain-check.test.tshttps://github.com/simstudioai/sim/pull/5798/files#diff-c3b6f6da4482a0e907673b6a0ad0d3eeab10c842e166a4c8181abee0f29198c0
View file https://github.com/simstudioai/sim/blob/a8664099cf6480cf279334c004695d2f9bee699d/apps/sim/lib/mcp/domain-check.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/5798/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/5798/files#diff-c3b6f6da4482a0e907673b6a0ad0d3eeab10c842e166a4c8181abee0f29198c0
https://github.com/simstudioai/sim/pull/5798/files#diff-c3b6f6da4482a0e907673b6a0ad0d3eeab10c842e166a4c8181abee0f29198c0
https://github.com/simstudioai/sim/pull/5798/files#diff-c3b6f6da4482a0e907673b6a0ad0d3eeab10c842e166a4c8181abee0f29198c0
https://github.com/simstudioai/sim/pull/5798/files#diff-c3b6f6da4482a0e907673b6a0ad0d3eeab10c842e166a4c8181abee0f29198c0
https://github.com/simstudioai/sim/pull/5798/files#diff-c3b6f6da4482a0e907673b6a0ad0d3eeab10c842e166a4c8181abee0f29198c0
https://github.com/simstudioai/sim/pull/5798/files#diff-c3b6f6da4482a0e907673b6a0ad0d3eeab10c842e166a4c8181abee0f29198c0
https://github.com/simstudioai/sim/pull/5798/files#diff-c3b6f6da4482a0e907673b6a0ad0d3eeab10c842e166a4c8181abee0f29198c0
https://github.com/simstudioai/sim/pull/5798/files#diff-c3b6f6da4482a0e907673b6a0ad0d3eeab10c842e166a4c8181abee0f29198c0
apps/sim/lib/mcp/domain-check.tshttps://github.com/simstudioai/sim/pull/5798/files#diff-58bd7213609870689904920cd34776c761a43f28c35b7672a1925630fcb8676b
View file https://github.com/simstudioai/sim/blob/a8664099cf6480cf279334c004695d2f9bee699d/apps/sim/lib/mcp/domain-check.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/5798/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/5798/files#diff-58bd7213609870689904920cd34776c761a43f28c35b7672a1925630fcb8676b
https://github.com/simstudioai/sim/pull/5798/files#diff-58bd7213609870689904920cd34776c761a43f28c35b7672a1925630fcb8676b
Please reload this pagehttps://github.com/simstudioai/sim/pull/5798/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.