pyproject.toml 2.05 KB
[project]
name = "mcp-hive"
version = "0.2.0"
description = "公司统一 MCP 服务中心:把各业务线的数据接口封装成 MCP 工具,带调用审计与可视化控制台"
requires-python = ">=3.10"
dependencies = [
    "mcp>=1.27,<2.0",
    "httpx>=0.27",
    "python-dotenv>=1.0",
    "sqlalchemy[asyncio]>=2.0",
    "aiomysql>=0.2",
    "starlette>=0.37",
    "uvicorn[standard]>=0.30",
]

[project.optional-dependencies]
gateway = [
    "fastapi>=0.115",
    "itsdangerous>=2.1",  # Starlette 的 SessionMiddleware 用它给会话 cookie 签名
]
dev = [
    "pytest>=8.0",
    "pytest-asyncio>=0.24",
    "respx>=0.21",
    "ruff>=0.6",
    "mypy>=1.11",
]

[project.scripts]
# 统一入口:--all 挂载全部服务,--service <key> 单服务独立进程
mcp-hive-serve = "mcp_hive.serve:main"
mcp-hive-gateway = "mcp_hive.gateway.app:main"
mcp-hive-admin = "mcp_hive.admin.cli:main"

[build-system]
requires = ["setuptools>=68.0"]
build-backend = "setuptools.build_meta"

[tool.setuptools.packages.find]
where = ["src"]

[tool.setuptools.package-data]
"mcp_hive.gateway" = ["static/**/*"]

[tool.pytest.ini_options]
testpaths = ["tests"]
pythonpath = ["src"]
asyncio_mode = "auto"
# --basetemp:本机 %TEMP%\pytest-of-admin 是一个 2026-07 遗留的只读目录,
# 会让 tmp_path fixture 直接 PermissionError。指到仓库内(已 gitignore)绕开它。
addopts = "-q --strict-markers --basetemp=.pytest-tmp"
filterwarnings = ["ignore::DeprecationWarning"]

[tool.ruff]
line-length = 110
target-version = "py310"
src = ["src", "tests"]

[tool.ruff.lint]
select = ["E", "F", "W", "I", "UP", "B", "C4", "SIM", "BLE", "RUF"]
ignore = [
    "E501",    # 行长交给 formatter
    "RUF001",  # 中文注释里的全角标点是有意的
    "RUF002",
    "RUF003",
]

[tool.ruff.lint.per-file-ignores]
"tests/*" = ["S101"]

[tool.mypy]
python_version = "3.10"
mypy_path = "src"
ignore_missing_imports = true
warn_unused_ignores = true
warn_redundant_casts = true
no_implicit_optional = true

[[tool.mypy.overrides]]
module = "tests.*"
disallow_untyped_defs = false