feat: 后端工具和 MCP 模块更新

- main.go: 更新工作空间目录,添加 MCP 模型迁移
- tool.go: 添加 description_cn 字段
- auth_service, tool_service: 优化
- 更新 Swagger 文档

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-11 14:45:49 +08:00
parent cab6488d71
commit 298ff7c79d
7 changed files with 1573 additions and 13 deletions

View File

@@ -245,6 +245,40 @@ definitions:
description: 中文映射名
type: string
type: object
model.MCP:
properties:
args:
description: 参数JSON数组格式
type: string
category:
description: 分类
type: string
command:
description: 启动命令
type: string
created_at:
type: string
description:
description: 英文描述
type: string
description_cn:
description: 中文描述
type: string
env:
description: 环境变量JSON对象格式
type: string
id:
type: string
name:
type: string
status:
type: string
transport:
description: stdio, http, sse
type: string
updated_at:
type: string
type: object
model.MemoryInfo:
properties:
available:
@@ -536,6 +570,49 @@ definitions:
- model_type
- provider
type: object
model.Tool:
properties:
args:
description: 参数JSON数组格式
type: string
category:
type: string
command:
description: 启动命令
type: string
created_at:
type: string
description:
description: 英文描述
type: string
description_cn:
description: 中文描述
type: string
env:
description: 环境变量JSON对象格式
type: string
id:
type: string
name:
type: string
parameters:
description: JSON格式存储
type: string
provider:
type: string
require_approval:
type: boolean
security_level:
type: string
status:
description: 状态
type: string
transport:
description: MCP 特有字段
type: string
updated_at:
type: string
type: object
model.UpdateDatabaseRequest:
properties:
charset:
@@ -1399,6 +1476,120 @@ paths:
summary: 获取数据库列表
tags:
- 数据库管理
/mcp/{id}:
delete:
consumes:
- application/json
description: 删除MCP配置
parameters:
- description: MCP ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
summary: 删除MCP
tags:
- MCP管理
get:
consumes:
- application/json
description: 根据ID获取MCP配置
parameters:
- description: MCP ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
summary: 获取MCP详情
tags:
- MCP管理
put:
consumes:
- application/json
description: 更新MCP配置
parameters:
- description: MCP ID
in: path
name: id
required: true
type: string
- description: MCP信息
in: body
name: mcp
required: true
schema:
$ref: '#/definitions/model.MCP'
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
summary: 更新MCP
tags:
- MCP管理
/mcp/add:
post:
consumes:
- application/json
description: 创建新的MCP工具配置
parameters:
- description: MCP信息
in: body
name: mcp
required: true
schema:
$ref: '#/definitions/model.MCP'
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
summary: 创建MCP
tags:
- MCP管理
/mcp/list:
get:
consumes:
- application/json
description: 获取所有MCP工具配置
parameters:
- description: 分类
in: query
name: category
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
summary: 获取MCP列表
tags:
- MCP管理
/model/{id}:
delete:
consumes:
@@ -1957,4 +2148,192 @@ paths:
summary: 获取系统信息
tags:
- 系统
/tool/{id}:
delete:
consumes:
- application/json
description: 删除工具
parameters:
- description: 工具ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
summary: 删除工具
tags:
- 工具管理
get:
consumes:
- application/json
description: 根据ID获取工具详情
parameters:
- description: 工具ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
summary: 获取工具详情
tags:
- 工具管理
put:
consumes:
- application/json
description: 更新工具信息
parameters:
- description: 工具ID
in: path
name: id
required: true
type: string
- description: 工具信息
in: body
name: tool
required: true
schema:
$ref: '#/definitions/model.Tool'
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
summary: 更新工具
tags:
- 工具管理
/tool/add:
post:
consumes:
- application/json
description: 创建新的工具
parameters:
- description: 工具信息
in: body
name: tool
required: true
schema:
$ref: '#/definitions/model.Tool'
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
summary: 创建工具
tags:
- 工具管理
/tool/list:
get:
consumes:
- application/json
description: 获取所有工具列表,支持按分类和状态筛选
parameters:
- description: 工具分类
in: query
name: category
type: string
- description: 工具状态
in: query
name: status
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
summary: 获取工具列表
tags:
- 工具管理
/tool/sync:
get:
consumes:
- application/json
description: 从代码中的默认配置同步工具到数据库
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
summary: 手动同步工具
tags:
- 工具管理
/user/{id}:
get:
consumes:
- application/json
description: 根据ID获取用户详情
parameters:
- description: 用户ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
"404":
description: Not Found
schema:
additionalProperties:
type: string
type: object
security:
- BearerAuth: []
summary: 获取用户详情
tags:
- 用户管理
/user/list:
get:
consumes:
- application/json
description: 获取所有用户列表(需要管理员权限)
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
"401":
description: Unauthorized
schema:
additionalProperties:
type: string
type: object
security:
- BearerAuth: []
summary: 获取所有用户
tags:
- 用户管理
swagger: "2.0"