Skip to content

Commit 7b665c3

Browse files
authored
Merge pull request #49 from callmefisher/miku_0625
update miku mcp tools
2 parents 2326c08 + 52a5354 commit 7b665c3

File tree

8 files changed

+183
-81
lines changed

8 files changed

+183
-81
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# v1.3.1
2+
- 直播服务增加更多的tools支持
3+
14
# v1.3.0
25
- 支持直播服务
36

README.md

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,12 @@ Server 来访问七牛云存储、智能多媒体服务等。
2121
- 根据链接刷新文件
2222
- 根据链接预取文件
2323
- 直播
24-
- 创建直播空间bucket和直播流
25-
- 绑定推拉流域名,获取推拉流直播地址
24+
- 创建直播空间bucket
25+
- 创建直播流
26+
- 获取直播空间列表
27+
- 获取流列表
28+
- 绑定推拉流域名
29+
- 获取推拉流直播地址
2630
- 获取直播用量
2731

2832
## 环境要求
@@ -82,25 +86,6 @@ powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | ie
8286
}
8387
}
8488
}
85-
```
86-
87-
```
88-
直播mcp配置
89-
{
90-
"mcpServers": {
91-
"qiniu": {
92-
"command": "uvx",
93-
"args": [
94-
"qiniu-mcp-server"
95-
],
96-
"env": {
97-
"QINIU_API_KEY": "YOUR_API_KEY",
98-
"QINIU_ENDPOINT_URL": "YOUR_ENDPOINT_URL"
99-
},
100-
"disabled": false
101-
}
102-
}
103-
}
10489
```
10590
3. 点击 qiniu MCP Server 的链接开关进行连接
10691
4. 在 Cline 中创建一个聊天窗口,此时我们可以和 AI 进行交互来使用 qiniu-mcp-server ,下面给出几个示例:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "qiniu-mcp-server"
3-
version = "1.3.0"
3+
version = "1.3.1"
44
description = "A MCP server project of Qiniu."
55
requires-python = ">=3.12"
66
authors = [

src/mcp_server/README.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,74 @@
103103
- Returns:
104104
- 操作状态信息
105105

106+
107+
### 直播 工具
108+
109+
1. `CreateBucket`
110+
- 创建新的直播空间
111+
- Inputs:
112+
- `bucket` (string): bucket 名称
113+
- Returns:
114+
- `status_code` (integer): 创建结果code,200代表成功
115+
116+
2. `CreateStream`
117+
- 在直播空间下,创建新的直播流
118+
- Inputs:
119+
- `bucket` (string): bucket 名称
120+
- `stream` (string): 流名称
121+
- Returns:
122+
- `status_code` (integer): 创建结果code,200代表成功
123+
3. `ListBuckets`
124+
- 查询当前用户配置的 Bucket
125+
- Inputs:
126+
- `prefix` (string, optional): Bucket 名称前缀,用于筛选特定前缀的 Bucket
127+
- Returns:
128+
- 满足条件的 Bucket 列表及其详细信息
129+
4. `ListStreams`
130+
- 列举指定 Bucket 中的流列表
131+
- Inputs:
132+
- `bucket` (string): bucket 名称
133+
- Returns:
134+
- 满足条件的流列表及其详细信息
135+
5. `BindPushDomain`
136+
- 为 Bucket 绑定推流域名
137+
- Inputs:
138+
- `bucket` (string): bucket 名称
139+
- `domain` (string): domain 名称
140+
- `type` (string): 推流 类型,可选项rtmp,whip
141+
- Returns:
142+
- `status_code` (integer): 创建结果code,200代表成功
143+
6. `BindPlayDomain`
144+
- 为 Bucket 绑定播放域名
145+
- Inputs:
146+
- `bucket` (string): bucket 名称
147+
- `domain` (string): domain 名称
148+
- `type` (string): 播放协议类型,可选项srt,hls,flv,whep,live
149+
- Returns:
150+
- `status_code` (integer): 创建结果code,200代表成功
151+
7. `GetPushUrls`
152+
- 获取推流地址
153+
- Inputs:
154+
- `bucket` (string): bucket 名称
155+
- `stream` (string): 流名称
156+
- Returns:
157+
- `rtmp` (integer): rtmp推流地址
158+
- `whip` (integer): webrtc低延迟直播推流地址
159+
8. `GetPlayUrls`
160+
- 获取播放地址
161+
- Inputs:
162+
- `bucket` (string): bucket 名称
163+
- `stream` (string): 流名称
164+
- Returns:
165+
- `flv` (integer): flv 拉流地址
166+
- `hls` (integer): hls 拉流地址
167+
- `whep` (integer): 低延迟直播拉流地址
168+
9. `QueryLiveTrafficStats`
169+
- 查询直播流量
170+
- Inputs:
171+
- `bucket` (string): bucket 名称
172+
- Returns:
173+
- `data` (Array of integer): 每5分钟的直播流量
106174
### 其他工具
107175

108176
1. `Version`

src/mcp_server/config/config.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99
_CONFIG_ENV_KEY_ACCESS_KEY = "QINIU_ACCESS_KEY"
1010
_CONFIG_ENV_KEY_SECRET_KEY = "QINIU_SECRET_KEY"
11-
_CONFIG_ENV_KEY_API_KEY = "QINIU_API_KEY"
11+
_CONFIG_ENV_LIVE_API_KEY = "QINIU_LIVE_API_KEY"
12+
_CONFIG_ENV_LIVE_ENDPOINT = "QINIU_LIVE_ENDPOINT"
1213
_CONFIG_ENV_KEY_ENDPOINT_URL = "QINIU_ENDPOINT_URL"
1314
_CONFIG_ENV_KEY_REGION_NAME = "QINIU_REGION_NAME"
1415
_CONFIG_ENV_KEY_BUCKETS = "QINIU_BUCKETS"
@@ -23,7 +24,8 @@
2324
class Config:
2425
access_key: str
2526
secret_key: str
26-
api_key: str
27+
live_api_key: str
28+
live_endpoint: str
2729
endpoint_url: str
2830
region_name: str
2931
buckets: List[str]
@@ -33,7 +35,8 @@ def load_config() -> Config:
3335
config = Config(
3436
access_key=os.getenv(_CONFIG_ENV_KEY_ACCESS_KEY),
3537
secret_key=os.getenv(_CONFIG_ENV_KEY_SECRET_KEY),
36-
api_key=os.getenv(_CONFIG_ENV_KEY_API_KEY),
38+
live_api_key=os.getenv(_CONFIG_ENV_LIVE_API_KEY),
39+
live_endpoint=os.getenv(_CONFIG_ENV_LIVE_ENDPOINT),
3740
endpoint_url=os.getenv(_CONFIG_ENV_KEY_ENDPOINT_URL),
3841
region_name=os.getenv(_CONFIG_ENV_KEY_REGION_NAME),
3942
buckets=_get_configured_buckets_from_env(),
@@ -43,8 +46,10 @@ def load_config() -> Config:
4346
config.access_key = "YOUR_QINIU_ACCESS_KEY"
4447
if not config.secret_key or len(config.secret_key) == 0:
4548
config.secret_key = "YOUR_QINIU_SECRET_KEY"
46-
if not config.api_key or len(config.api_key) == 0:
47-
config.api_key = "YOUR_QINIU_API_KEY"
49+
if not config.live_api_key or len(config.live_api_key) == 0:
50+
config.live_api_key = "YOUR_QINIU_LIVE_API_KEY"
51+
if not config.live_endpoint or len(config.live_endpoint) == 0:
52+
config.live_endpoint = "mls.cn-east-1.qiniumiku.com"
4853
if not config.endpoint_url or len(config.endpoint_url) == 0:
4954
config.endpoint_url = "YOUR_QINIU_ENDPOINT_URL"
5055
if not config.region_name or len(config.region_name) == 0:

src/mcp_server/core/live_streaming/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55

66
def load(cfg: config.Config):
7-
miku = LiveStreamingService(cfg)
8-
register_tools(miku)
7+
live = LiveStreamingService(cfg)
8+
register_tools(live)
99

1010

1111
__all__ = ["load"]

0 commit comments

Comments
 (0)