Skip to content

Commit 265063a

Browse files
committed
update miku mcp tools
1 parent 52a5354 commit 265063a

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

src/mcp_server/core/live_streaming/live_streaming.py

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,21 @@
1616
class LiveStreamingService:
1717
def __init__(self, cfg: config.Config = None):
1818
self.config = cfg
19-
self.api_key = cfg.live_api_key if cfg else None
19+
self.live_api_key = cfg.live_api_key if cfg else None
2020
self.live_endpoint = cfg.live_endpoint if cfg else "mls.cn-east-1.qiniumiku.com"
2121
self.access_key = cfg.access_key if cfg else None
2222
self.secret_key = cfg.secret_key if cfg else None
2323

2424

2525
def _get_auth_header(self, method: str, url: str, content_type: Optional[str] = None, body: Optional[str] = None) -> Dict[str, str]:
26-
"""
27-
Generate authorization header
28-
Priority: QINIU_ACCESS_KEY/QINIU_SECRET_KEY > API KEY
29-
"""
30-
# Priority 1: Use QINIU_ACCESS_KEY/QINIU_SECRET_KEY if configured
26+
27+
# Priority 1: Fall back to API KEY if ACCESS_KEY/SECRET_KEY not configured
28+
if self.live_api_key and self.live_api_key != "YOUR_QINIU_LIVE_API_KEY":
29+
return {
30+
"Authorization": f"Bearer {self.live_api_key}"
31+
}
32+
33+
# Priority 2: Use QINIU_ACCESS_KEY/QINIU_SECRET_KEY if configured
3134
if self.access_key and self.secret_key and \
3235
self.access_key != "YOUR_QINIU_ACCESS_KEY" and \
3336
self.secret_key != "YOUR_QINIU_SECRET_KEY":
@@ -38,14 +41,6 @@ def _get_auth_header(self, method: str, url: str, content_type: Optional[str] =
3841
"Authorization": f"Qiniu {token}"
3942
}
4043

41-
# Priority 2: Fall back to API KEY if ACCESS_KEY/SECRET_KEY not configured
42-
if not self.api_key or self.api_key == "YOUR_QINIU_API_KEY":
43-
raise ValueError("Neither QINIU_ACCESS_KEY/QINIU_SECRET_KEY nor QINIU_API_KEY is configured")
44-
45-
return {
46-
"Authorization": f"Bearer {self.api_key}"
47-
}
48-
4944
def _build_bucket_url(self, bucket: str) -> str:
5045
"""Build S3-style bucket URL"""
5146
if not self.live_endpoint:
@@ -468,7 +463,7 @@ def _generate_qiniu_token(self, method: str, url: str, content_type: Optional[st
468463
parsed = urlparse(url)
469464

470465
# 1. Add Method and Path
471-
data = f"{method} {parsed.path or '/'}"
466+
data = f"{method} {parsed.path}"
472467

473468
# 2. Add Query if exists
474469
if parsed.query:

0 commit comments

Comments
 (0)