yapi-mcp 0.1.1__py3-none-any.whl → 0.1.2__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.
yapi_mcp/server.py CHANGED
@@ -123,39 +123,39 @@ async def yapi_get_interface(
123
123
  @mcp.tool()
124
124
  async def yapi_save_interface(
125
125
  catid: Annotated[int, "分类 ID (必需)"],
126
- project_id: Annotated[int | None, "项目 ID (创建时必需)"] = None,
127
- interface_id: Annotated[int | None, "接口 ID (有值=更新,无值=创建)"] = None,
128
- title: Annotated[str | None, "接口标题 (创建时必需)"] = None,
129
- path: Annotated[str | None, "接口路径 (创建时必需,以/开头)"] = None,
130
- method: Annotated[str | None, "HTTP方法 (创建时必需)"] = None,
126
+ project_id: Annotated[int, "项目 ID (创建时必需)"] = 0,
127
+ interface_id: Annotated[int, "接口 ID (有值=更新,无值=创建)"] = 0,
128
+ title: Annotated[str, "接口标题 (创建时必需)"] = "",
129
+ path: Annotated[str, "接口路径 (创建时必需,以/开头)"] = "",
130
+ method: Annotated[str, "HTTP方法 (创建时必需)"] = "",
131
131
  req_body: Annotated[str, "请求参数(JSON字符串)"] = "",
132
132
  res_body: Annotated[str, "响应结构(JSON字符串)"] = "",
133
133
  desc: Annotated[str, "接口描述"] = "",
134
- req_body_type: Annotated[str | None, "请求体类型(form/json/raw/file)"] = None,
135
- req_body_is_json_schema: Annotated[bool | None, "请求体是否为JSON Schema"] = None,
136
- res_body_type: Annotated[str | None, "响应体类型(json/raw)"] = None,
137
- res_body_is_json_schema: Annotated[bool | None, "响应体是否为JSON Schema"] = None,
134
+ req_body_type: Annotated[str, "请求体类型(form/json/raw/file)"] = "",
135
+ req_body_is_json_schema: Annotated[bool, "请求体是否为JSON Schema"] = True,
136
+ res_body_type: Annotated[str, "响应体类型(json/raw)"] = "",
137
+ res_body_is_json_schema: Annotated[bool, "响应体是否为JSON Schema"] = True,
138
138
  ) -> str:
139
139
  """保存 YApi 接口定义。interface_id 有值则更新,无值则创建新接口。"""
140
140
  config = get_config()
141
141
  try:
142
- if path is not None:
143
- _ensure_path_starts_with_slash(path)
142
+ if path and not path.startswith("/"):
143
+ raise InvalidInterfacePathError
144
144
 
145
145
  async with YApiClient(str(config.yapi_server_url), config.cookies) as client:
146
146
  result = await client.save_interface(
147
147
  catid=catid,
148
- project_id=project_id,
149
- interface_id=interface_id,
150
- title=title,
151
- path=path,
152
- method=method,
148
+ project_id=project_id if project_id else None,
149
+ interface_id=interface_id if interface_id else None,
150
+ title=title if title else None,
151
+ path=path if path else None,
152
+ method=method if method else None,
153
153
  req_body=req_body,
154
154
  res_body=res_body,
155
155
  desc=desc,
156
- req_body_type=req_body_type,
156
+ req_body_type=req_body_type if req_body_type else None,
157
157
  req_body_is_json_schema=req_body_is_json_schema,
158
- res_body_type=res_body_type,
158
+ res_body_type=res_body_type if res_body_type else None,
159
159
  res_body_is_json_schema=res_body_is_json_schema,
160
160
  )
161
161
  action = result["action"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: yapi-mcp
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Model Context Protocol server for YApi 1.12.0 API management platform
5
5
  Project-URL: Homepage, https://github.com/geq1fan/yapi-mcp
6
6
  Project-URL: Repository, https://github.com/geq1fan/yapi-mcp
@@ -1,14 +1,14 @@
1
1
  yapi_mcp/__init__.py,sha256=-B1Yt-BsgzhccXKx5Y6f3TWR1OQbb8I8cOvnSKYjcSU,136
2
2
  yapi_mcp/__main__.py,sha256=hOOyTtbTkoNugBbb_SofxEMRf8PuoOhWa8Z8-OyfWqw,151
3
3
  yapi_mcp/config.py,sha256=k19HWCCBfBJttlsWj4f2QdxvFoBvHSJ1AVvb08WT-tQ,1373
4
- yapi_mcp/server.py,sha256=YllpCCrlUjRcAtysExx_-8s6NLpalK-0uGIxomSJh4Y,6470
4
+ yapi_mcp/server.py,sha256=NVkl_PKBzDjBbjyl2ynpxtf8cpKRtaWz9H0BZ6UDxpQ,6564
5
5
  yapi_mcp/tools/__init__.py,sha256=iCyxPtAUoQ7RU976LPMXgGghqm2l0bH-LYBCnEOLtew,33
6
6
  yapi_mcp/yapi/__init__.py,sha256=gK6ta7uNWkDqen5yWSDqqXYlCxz3uU-A2bKaqeO55Qk,31
7
7
  yapi_mcp/yapi/client.py,sha256=gcwYdeHT9Yjq-550HyDh61wJYS8TeeAgFMoXoeb-bIg,10058
8
8
  yapi_mcp/yapi/errors.py,sha256=RQvvdl1d-CBawZDTdgf3g_ThJUhGUvwRPCI-q2I6Mfc,3815
9
9
  yapi_mcp/yapi/models.py,sha256=MJZQx_esXPcQ7UTnhlo_QVU81NrIPF2pB36mxvcLJ5w,2349
10
- yapi_mcp-0.1.1.dist-info/METADATA,sha256=yD1XDVB2FP6CLTgy3QofMx6g_9-YbYsLEaQJZvI71EY,5198
11
- yapi_mcp-0.1.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
12
- yapi_mcp-0.1.1.dist-info/entry_points.txt,sha256=u1QWnfoawIuUR6RuyPmqi9TpySnasIRU1lvJZa315EU,43
13
- yapi_mcp-0.1.1.dist-info/licenses/LICENSE,sha256=b-a1jI555eCf0fkRmK3mrIGQe8hYqC5aXy0nGXiEasA,1106
14
- yapi_mcp-0.1.1.dist-info/RECORD,,
10
+ yapi_mcp-0.1.2.dist-info/METADATA,sha256=NpaST-JZA4syzU8qEK9A0LrcgVmmNogsuksUdYRr3Wo,5198
11
+ yapi_mcp-0.1.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
12
+ yapi_mcp-0.1.2.dist-info/entry_points.txt,sha256=u1QWnfoawIuUR6RuyPmqi9TpySnasIRU1lvJZa315EU,43
13
+ yapi_mcp-0.1.2.dist-info/licenses/LICENSE,sha256=b-a1jI555eCf0fkRmK3mrIGQe8hYqC5aXy0nGXiEasA,1106
14
+ yapi_mcp-0.1.2.dist-info/RECORD,,