-
Notifications
You must be signed in to change notification settings - Fork 8
Change Doc #7
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
Change Doc #7
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
# 七牛云 MCP 服务器 | ||
|
||
基于七牛云产品构建的 Model Context Protocol (MCP) 服务器,支持在 AI 大模型的上下文中直接访问和操作七牛云的服务。 | ||
|
||
## Keywords | ||
七牛, Dora, Kodo, CDN | ||
|
||
## Tools | ||
|
||
### 存储工具 | ||
|
||
1. `ListBuckets` | ||
- 查询当前用户配置的 Bucket | ||
- Inputs: | ||
- `prefix` (string, optional): Bucket 名称前缀,用于筛选特定前缀的 Bucket | ||
- Returns: | ||
- 满足条件的 Bucket 列表及其详细信息 | ||
|
||
2. `ListObjects` | ||
- 列举指定 Bucket 中的文件列表 | ||
- Inputs: | ||
- `bucket` (string): Bucket 名称 | ||
- `max_keys` (integer, optional): 单次返回的最大文件数量,默认为20,最大值为100 | ||
- `prefix` (string, optional): 文件 Key 前缀,用于筛选特定前缀的文件 | ||
- `start_after` (string, optional): 起始标记,指定列表的开始位置,可以是上一次列举的结果中最后一个文件的 Key | ||
- Returns: | ||
- 满足条件的文件列表及其详细信息 | ||
|
||
3. `GetObject` | ||
- 获取 Bucket 中文件的内容 | ||
- Inputs: | ||
- `bucket` (string): Bucket 名称 | ||
- `key` (string): 文件的 Key | ||
- Returns: | ||
- 文件内容 | ||
|
||
4. `GetObjectURL` | ||
- 生成文件的访问链接,注意文件存储的 Bucket 必须绑定域名,七牛云测试域名不支持 HTTPS,需要用户自己处理为 HTTP。 | ||
- Inputs: | ||
- `bucket` (string): Bucket 名称 | ||
- `key` (string): 文件的 Key | ||
- `disable_ssl` (boolean, optional): 是否禁用 HTTPS,默认使用 HTTPS | ||
- `expires` (integer, optional): 链接有效期,单位为秒 | ||
- Returns: | ||
- 对象的访问链接 | ||
|
||
### 图片处理工具 | ||
|
||
1. `ImageScaleByPercent` | ||
- 按照指定百分比缩放图片 | ||
- Inputs: | ||
- `object_url` (string): 待处理图片的访问链接,图片必须存储在七牛云空间中 | ||
- `percent` (integer): 缩放比例,范围为1%~999% | ||
- Returns: | ||
- `object_url`: 处理后图片的访问链接 | ||
|
||
2. `ImageScaleBySize` | ||
- 按照指定宽度或高度缩放图片 | ||
- Inputs: | ||
- `object_url` (string): 待处理图片的访问链接,图片必须存储在七牛云空间中 | ||
- `width` (integer, optional): 目标宽度,单位为像素 | ||
- `height` (integer, optional): 目标高度,单位为像素 | ||
- 注意:至少需要指定宽度或高度中的一个参数 | ||
- Returns: | ||
- `object_url`: 处理后图片的访问链接 | ||
|
||
3. `ImageRoundCorner` | ||
- 为图片添加圆角效果 | ||
- Inputs: | ||
- `object_url` (string): 待处理图片的访问链接,图片必须存储在七牛云空间中 | ||
- `radius_x` (string, optional): 水平方向圆角半径,可使用像素值或百分比 | ||
- `radius_y` (string, optional): 垂直方向圆角半径,可使用像素值或百分比 | ||
- 注意:如果只指定一个参数,另一个参数将自动使用相同的值 | ||
- Returns: | ||
- `object_url`: 处理后图片的访问链接 | ||
|
||
4. `ImageInfo` | ||
- 获取图片的基本信息 | ||
- Inputs: | ||
- `object_url` (string): 图片的访问链接,图片必须存储在七牛云空间中 | ||
- Returns: | ||
- `size`: 图片大小,单位为字节 | ||
- `width`: 图片的宽度,单位为像素 | ||
- `height`: 图片的高度,单位为像素 | ||
- `format`: 图片的格式,如 png 等 | ||
- `color_model`: 图片的颜色模型,如 nrgba | ||
|
||
### CDN 工具 | ||
|
||
1. `CDNPrefetchUrls` | ||
- 预先将指定资源缓存到CDN节点,提高用户访问速度 | ||
- Inputs: | ||
- `urls` (Array of string): 待预取资源的URL列表,最多支持60个URL | ||
- Returns: | ||
- 操作状态信息 | ||
|
||
2. `CDNRefresh` | ||
- 刷新CDN节点上的缓存资源,确保内容更新 | ||
- Inputs: | ||
- `urls` (Array of string, optional): 需要刷新的具体URL列表,最多支持60个URL | ||
- `dirs` (Array of string, optional): 需要刷新的目录列表,最多支持10个目录 | ||
- 注意:必须提供`urls`或`dirs`中的至少一项 | ||
- Returns: | ||
- 操作状态信息 | ||
|
||
### 其他工具 | ||
|
||
1. `Version` | ||
- 获取七牛 MCP Server 的版本信息 | ||
- Inputs: 无 | ||
- Returns: | ||
- 服务器版本信息 | ||
|
||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
from . import client | ||
from . import processing | ||
from .tools import register_tools | ||
from ...config import config | ||
|
||
|
||
def load(cfg: config.Config): | ||
cli = client.Client(cfg) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing function or method docstring (missing-function-docstring) Detailslint 解释
错误用法以下是一个缺少函数文档字符串的示例: def calculate_area(length, width):
return length * width 在这个例子中, 正确用法以下是添加了文档字符串的正确示例: def calculate_area(length, width):
"""
计算矩形面积
参数:
length (float): 矩形的长度
width (float): 矩形的宽度
返回:
float: 矩形的面积
"""
return length * width 在这个例子中,
|
||
cli = processing.MediaProcessingService(cfg) | ||
register_tools(cli) | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
from ...config import config | ||
|
||
|
||
class Client: | ||
class MediaProcessingService: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing class docstring (missing-class-docstring) Detailslint 解释
错误用法以下是一个缺少类文档字符串的示例: class MediaProcessor:
def process(self, file_path):
# 处理文件的逻辑 在这个例子中, 正确用法以下是一个包含类文档字符串的示例: class MediaProcessor:
"""
这个类用于处理媒体文件。
"""
def process(self, file_path):
"""
处理指定路径的媒体文件。
:param file_path: 要处理的媒体文件的路径
"""
# 处理文件的逻辑 在这个例子中,
|
||
def __init__(self, cfg: config.Config): | ||
self.cfg = cfg | ||
self.auth = qiniu.Auth(cfg.access_key, cfg.secret_key) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
from mcp import types | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unable to import 'mcp' (import-error) Detailslint 解释这个lint结果表明在代码中尝试导入一个名为 错误用法# 错误的导入方式
import mcp 正确用法
通过以上步骤,你应该能够解决导入错误的问题。
|
||
|
||
from . import utils | ||
from .client import Client | ||
from .processing import MediaProcessingService | ||
from ...consts import consts | ||
from ...tools import tools | ||
|
||
|
@@ -12,7 +12,7 @@ | |
|
||
|
||
class _ToolImpl: | ||
def __init__(self, cli: Client): | ||
def __init__(self, cli: MediaProcessingService): | ||
self.client = cli | ||
|
||
@tools.tool_meta( | ||
|
@@ -259,7 +259,7 @@ def get_fop_status(self, **kwargs) -> list[types.TextContent]: | |
return [types.TextContent(type="text", text=str(status))] | ||
|
||
|
||
def register_tools(cli: Client): | ||
def register_tools(cli: MediaProcessingService): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing function or method docstring (missing-function-docstring) Detailslint 解释
错误用法以下是一个缺少函数文档字符串的示例: def calculate_area(length, width):
return length * width 在这个例子中, 正确用法以下是添加了文档字符串的正确示例: def calculate_area(length, width):
"""
计算矩形面积
参数:
length (float): 矩形的长度
width (float): 矩形的宽度
返回:
float: 矩形的面积
"""
return length * width 在这个例子中,
|
||
tool_impl = _ToolImpl(cli) | ||
tools.auto_register_tools( | ||
[ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing module docstring (missing-module-docstring)
Details
lint 解释
这个lint结果表明在文件
mcp_server/core/media_processing/__init__.py
中缺少模块文档字符串(module docstring)。模块文档字符串是用于描述整个模块的注释,通常放在模块的最开始部分。错误用法
在这个例子中,
__init__.py
文件缺少了模块文档字符串。正确用法
在这个例子中,
__init__.py
文件添加了一个模块文档字符串,描述了该模块的功能。