TL;DR: Timeouts against Atlas almost always mean your IP is not on the Atlas access list. Atlas drops the packets silently, so the driver just times out. Go to Network Access in the Atlas dashboard and add your current IP.

```text
MongoServerSelectionError: connection timed out
```

## Fix it

1. In the Atlas dashboard, open Network Access for your project and check the IP access list.

2. Add your current public IP. Find it with:

```bash
curl -s https://api.ipify.org
```

   Add it as a single IP entry. For a quick test you can use `the all-interfaces address/0` (allow from anywhere), but replace it with your real IP afterward.

3. Wait a minute for the change to propagate, then restart the MCP client or retry the tool call.

   Expected: the server connects within seconds and tools respond.

## When to use this

- Local MongoDB (`mongodb://YOUR_HOST:27017`) works, but the Atlas `mongodb+srv://` URL times out.
- The timeout happens consistently, not intermittently.

## When NOT to use this

- The error is `bad auth` or `authentication failed`. Your IP is fine; the credentials are wrong.
- The error mentions DNS or SRV lookup failures. That is a DNS problem, not the access list.

## Compatibility

- mongodb-mcp-server against MongoDB Atlas (any tier).
- Any MongoDB driver, the failure mode is identical.

## Why it happens

Atlas defaults to deny-all networking. Unlike a wrong password, which gets an explicit rejection, a non-allowlisted IP gets its packets dropped with no response. The driver's server-selection loop waits for a response that never comes and eventually reports a timeout, which misleads people into debugging DNS or drivers.

## Edge cases

- Home IPs change. If it worked yesterday and times out today, your ISP rotated your IP. Re-add it.
- VPNs change your egress IP. Add the VPN exit IP, or disconnect the VPN for testing.
- `the all-interfaces address/0` is fine for a five-minute test, not for production. Narrow it as soon as it works.