fast-agent-mcp 0.2.41__py3-none-any.whl → 0.2.42__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of fast-agent-mcp might be problematic. Click here for more details.

@@ -84,7 +84,9 @@ class OpenAIAugmentedLLM(AugmentedLLM[ChatCompletionMessageParam, ChatCompletion
84
84
  # TODO -- move this to model capabilities, add o4.
85
85
  chosen_model = self.default_request_params.model if self.default_request_params else None
86
86
  self._reasoning = chosen_model and (
87
- chosen_model.startswith("o3") or chosen_model.startswith("o1")
87
+ chosen_model.startswith("o3")
88
+ or chosen_model.startswith("o1")
89
+ or chosen_model.startswith("o4")
88
90
  )
89
91
  if self._reasoning:
90
92
  self.logger.info(
@@ -8,6 +8,7 @@ Logger module for the MCP Agent, which provides:
8
8
  """
9
9
 
10
10
  import asyncio
11
+ import logging
11
12
  import threading
12
13
  import time
13
14
  from contextlib import asynccontextmanager, contextmanager
@@ -206,6 +207,12 @@ class LoggingConfig:
206
207
  if cls._initialized:
207
208
  return
208
209
 
210
+ # Suppress boto3/botocore logging to prevent flooding
211
+ logging.getLogger('boto3').setLevel(logging.WARNING)
212
+ logging.getLogger('botocore').setLevel(logging.WARNING)
213
+ logging.getLogger('urllib3').setLevel(logging.WARNING)
214
+ logging.getLogger('s3transfer').setLevel(logging.WARNING)
215
+
209
216
  bus = AsyncEventBus.get(transport=transport)
210
217
 
211
218
  # Add standard listeners
mcp_agent/mcp/hf_auth.py CHANGED
@@ -69,14 +69,29 @@ def should_add_hf_auth(url: str, existing_headers: Optional[Dict[str, str]]) ->
69
69
  """
70
70
  # Only add HF auth if:
71
71
  # 1. URL is a HuggingFace URL
72
- # 2. No existing Authorization header is set
72
+ # 2. No existing Authorization/X-HF-Authorization header is set
73
73
  # 3. HF_TOKEN environment variable is available
74
74
 
75
75
  if not is_huggingface_url(url):
76
76
  return False
77
77
 
78
- if existing_headers and "Authorization" in existing_headers:
79
- return False
78
+ if existing_headers:
79
+ # Check if this is a .hf.space domain
80
+ try:
81
+ parsed = urlparse(url)
82
+ hostname = parsed.hostname
83
+ if hostname and hostname.endswith(".hf.space"):
84
+ # For .hf.space, check for X-HF-Authorization header
85
+ if "X-HF-Authorization" in existing_headers:
86
+ return False
87
+ else:
88
+ # For other HF domains, check for Authorization header
89
+ if "Authorization" in existing_headers:
90
+ return False
91
+ except Exception:
92
+ # Fallback to checking Authorization header
93
+ if "Authorization" in existing_headers:
94
+ return False
80
95
 
81
96
  return get_hf_token_from_env() is not None
82
97
 
@@ -101,6 +116,19 @@ def add_hf_auth_header(url: str, headers: Optional[Dict[str, str]]) -> Optional[
101
116
 
102
117
  # Create new headers dict or copy existing one
103
118
  result_headers = dict(headers) if headers else {}
104
- result_headers["Authorization"] = f"Bearer {hf_token}"
119
+
120
+ # Check if this is a .hf.space domain
121
+ try:
122
+ parsed = urlparse(url)
123
+ hostname = parsed.hostname
124
+ if hostname and hostname.endswith(".hf.space"):
125
+ # Use X-HF-Authorization for .hf.space domains
126
+ result_headers["X-HF-Authorization"] = f"Bearer {hf_token}"
127
+ else:
128
+ # Use standard Authorization header for other HF domains
129
+ result_headers["Authorization"] = f"Bearer {hf_token}"
130
+ except Exception:
131
+ # Fallback to standard Authorization header
132
+ result_headers["Authorization"] = f"Bearer {hf_token}"
105
133
 
106
134
  return result_headers