diff --git a/backend/common/utils/whitelist.py b/backend/common/utils/whitelist.py index c02dfe44..78010184 100644 --- a/backend/common/utils/whitelist.py +++ b/backend/common/utils/whitelist.py @@ -20,7 +20,9 @@ wlist = [ "*.woff2", "*.ttf", "*.eot", - "*.otf" + "*.otf", + "/mcp", + "/mcp/message" ] class WhitelistChecker: diff --git a/backend/main.py b/backend/main.py index 2cb6b8d3..eee5691b 100644 --- a/backend/main.py +++ b/backend/main.py @@ -14,6 +14,7 @@ from common.core.config import settings from common.core.response_middleware import ResponseMiddleware, exception_handler from alembic.config import Config from alembic import command +from fastapi_mcp import FastApiMCP def run_migrations(): alembic_cfg = Config("alembic.ini") @@ -38,6 +39,14 @@ app = FastAPI( lifespan=lifespan ) +mcp = FastApiMCP( + app, + name="My API MCP", + description="My API description", +) + +mcp.mount() + # Set all CORS enabled origins if settings.all_cors_origins: app.add_middleware( diff --git a/backend/pyproject.toml b/backend/pyproject.toml index 535c219b..41aaea6a 100644 --- a/backend/pyproject.toml +++ b/backend/pyproject.toml @@ -34,6 +34,7 @@ dependencies = [ "psycopg2-binary (>=2.9.10,<3.0.0)", "oracledb (>=3.1.1,<4.0.0)", "pyyaml (>=6.0.2,<7.0.0)", + "fastapi-mcp (>=0.3.4,<0.4.0)", ] [[tool.uv.index]] url = "https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple"