Files
FastapiAdmin/backend/app/api/v1/module_ai/mcp/model.py
T
zhangtao 9feb08a962 feat(mcp): 重构 MCP 服务器及智能助手模块
- 新增代码生成模块路由支持
- 重构 MCP 服务器API,支持增删改查接口和分页查询
- 实现 MCP 智能对话的流式响应和 WebSocket 通信
- 优化 MCP 数据模型,支持环境变量等配置项
- 改进 MCP CRUD 层,集成权限控制和统一操作方法
- 优化异常处理,提升接口错误信息准确性
- 修正依赖导入和数据校验,增强代码健壮性
2025-09-22 00:37:10 +08:00

23 lines
956 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
from typing import Optional, Dict, Any
from sqlalchemy import JSON, String, Integer
from sqlalchemy.orm import Mapped, mapped_column
from app.core.base_model import CreatorMixin
class McpModel(CreatorMixin):
"""
MCP 服务器表
"""
__tablename__ = 'ai_mcp'
__table_args__ = ({'comment': 'MCP 服务器表'})
name: Mapped[str] = mapped_column(String(50), unique=True, comment='MCP 名称')
type: Mapped[int] = mapped_column(Integer, default=0, comment='MCP 类型(0:stdio 1:sse')
url: Mapped[Optional[str]] = mapped_column(String(255), default=None, comment='远程 SSE 地址')
command: Mapped[Optional[str]] = mapped_column(String(255), default=None, comment='MCP 命令')
args: Mapped[Optional[str]] = mapped_column(String(255), default=None, comment='MCP 命令参数')
env: Mapped[Optional[Dict[str, Any]]] = mapped_column(JSON(), default=None, comment='MCP 环境变量')