Description
The Bronto MCP server fails to connect to the Bronto API when running on Windows. All API requests fail with a DNS resolution error (getaddrinfo failed), making the server unusable on Windows.
Root Cause
clients.py uses os.path.join() to construct API URLs (6 occurrences). On Windows, os.path.join uses backslashes (\) as the path separator, producing invalid URLs:
# On Windows:
os.path.join('https://api.eu.bronto.io', 'logs')
# => 'https://api.eu.bronto.io\logs'
# On Linux/macOS:
os.path.join('https://api.eu.bronto.io', 'logs')
# => 'https://api.eu.bronto.io/logs'
When urllib parses the malformed URL, the backslash gets included in the hostname:
from urllib.parse import urlparse
urlparse('https://api.eu.bronto.io\logs')
# => ParseResult(scheme='https', netloc='api.eu.bronto.io\logs', path='', ...)
This causes DNS to try to resolve api.eu.bronto.io\logs as a hostname, which fails with:
socket.gaierror: [Errno 11001] getaddrinfo failed
The generic exception handler in clients.py then surfaces this as:
Cannot interact with Bronto. Please check endpoint configuration.
Affected Lines
All 6 uses of os.path.join in clients.py:
- Line 38:
get_datasets()
- Line 90:
search()
- Line 146:
search_post()
- Line 181:
get_top_keys()
- Line 223:
get_all_datasets_top_keys()
- Line 263:
get_all_datasets_top_keys_and_values()
Suggested Fix
Replace os.path.join with a URL-safe join, for example a simple helper:
@staticmethod
def _url_join(base, path):
"""Join URL parts using forward slashes (os.path.join uses backslashes on Windows)."""
return base.rstrip('/') + '/' + path.lstrip('/')
Alternatively, posixpath.join could also be used.
The import os can also be removed from clients.py as it is only used for os.path.join.
Environment
- OS: Windows 10/11
- Python: 3.11.9
- bronto-mcp-server: latest main branch
- MCP client: Cursor IDE
Description
The Bronto MCP server fails to connect to the Bronto API when running on Windows. All API requests fail with a DNS resolution error (
getaddrinfo failed), making the server unusable on Windows.Root Cause
clients.pyusesos.path.join()to construct API URLs (6 occurrences). On Windows,os.path.joinuses backslashes (\) as the path separator, producing invalid URLs:When
urllibparses the malformed URL, the backslash gets included in the hostname:This causes DNS to try to resolve
api.eu.bronto.io\logsas a hostname, which fails with:The generic exception handler in
clients.pythen surfaces this as:Affected Lines
All 6 uses of
os.path.joininclients.py:get_datasets()search()search_post()get_top_keys()get_all_datasets_top_keys()get_all_datasets_top_keys_and_values()Suggested Fix
Replace
os.path.joinwith a URL-safe join, for example a simple helper:Alternatively,
posixpath.joincould also be used.The
import oscan also be removed fromclients.pyas it is only used foros.path.join.Environment