Skip to content

perf: may be open api swagger require auth #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion mcp_openapi_proxy/openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ def fetch_openapi_spec(url: str, retries: int = 3) -> Optional[Dict]:
# Check IGNORE_SSL_SPEC env var
ignore_ssl_spec = os.getenv("IGNORE_SSL_SPEC", "false").lower() in ("true", "1", "yes")
verify_ssl_spec = not ignore_ssl_spec
headers = handle_auth({"method": "GET"})
logger.debug(f"Fetching spec with SSL verification: {verify_ssl_spec} (IGNORE_SSL_SPEC={ignore_ssl_spec})")
response = requests.get(url, timeout=10, verify=verify_ssl_spec)
response = requests.get(url, headers=headers, timeout=10, verify=verify_ssl_spec)
response.raise_for_status()
content = response.text
logger.debug(f"Fetched content length: {len(content)} bytes")
Expand Down
3 changes: 2 additions & 1 deletion mcp_openapi_proxy/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ def fetch_openapi_spec(url: str, retries: int = 3) -> Optional[Dict]:
ignore_ssl_spec = os.getenv("IGNORE_SSL_SPEC", "false").lower() in ("true", "1", "yes")
verify_ssl_spec = not ignore_ssl_spec
logger.debug(f"Fetching spec with SSL verification: {verify_ssl_spec} (IGNORE_SSL_SPEC={ignore_ssl_spec})")
response = requests.get(url, timeout=10, verify=verify_ssl_spec)
headers = handle_auth({"method": "GET"})
response = requests.get(url, headers=headers, timeout=10, verify=verify_ssl_spec)
response.raise_for_status()
content = response.text
logger.debug(f"Fetched content length: {len(content)} bytes")
Expand Down