model.py 1.1 KB

12345678910111213141516171819202122232425
  1. # -*- coding: utf-8 -*-
  2. from sqlalchemy import JSON, String, Integer
  3. from sqlalchemy.orm import Mapped, mapped_column
  4. from app.core.base_model import ModelMixin, UserMixin
  5. class McpModel(ModelMixin, UserMixin):
  6. """
  7. MCP 服务器表
  8. MCP类型:
  9. - 0: stdio (标准输入输出)
  10. - 1: sse (Server-Sent Events)
  11. """
  12. __tablename__: str = 'app_ai_mcp'
  13. __table_args__: dict[str, str] = ({'comment': 'MCP 服务器表'})
  14. __loader_options__: list[str] = ["created_by", "updated_by"]
  15. name: Mapped[str] = mapped_column(String(50), comment='MCP 名称')
  16. type: Mapped[int] = mapped_column(Integer, default=0, comment='MCP 类型(0:stdio 1:sse)')
  17. url: Mapped[str | None] = mapped_column(String(255), default=None, comment='远程 SSE 地址')
  18. command: Mapped[str | None] = mapped_column(String(255), default=None, comment='MCP 命令')
  19. args: Mapped[str | None] = mapped_column(String(255), default=None, comment='MCP 命令参数')
  20. env: Mapped[dict[str, str] | None] = mapped_column(JSON(), default=None, comment='MCP 环境变量')