mirror of
https://github.com/arc53/DocsGPT.git
synced 2026-05-21 21:05:05 +00:00
* feat: durability and idempotency keys * feat: more durable frontend * fix: tests * fix: mini issues * fix: better json validation * fix: tests
39 lines
1.0 KiB
Python
39 lines
1.0 KiB
Python
"""ASGI entrypoint: Flask (WSGI) + FastMCP on the same process."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from a2wsgi import WSGIMiddleware
|
|
from starlette.applications import Starlette
|
|
from starlette.middleware import Middleware
|
|
from starlette.middleware.cors import CORSMiddleware
|
|
from starlette.routing import Mount
|
|
|
|
from application.app import app as flask_app
|
|
from application.mcp_server import mcp
|
|
|
|
_WSGI_THREADPOOL = 32
|
|
|
|
mcp_app = mcp.http_app(path="/")
|
|
|
|
asgi_app = Starlette(
|
|
routes=[
|
|
Mount("/mcp", app=mcp_app),
|
|
Mount("/", app=WSGIMiddleware(flask_app, workers=_WSGI_THREADPOOL)),
|
|
],
|
|
middleware=[
|
|
Middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"],
|
|
allow_methods=["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"],
|
|
allow_headers=[
|
|
"Content-Type",
|
|
"Authorization",
|
|
"Mcp-Session-Id",
|
|
"Idempotency-Key",
|
|
],
|
|
expose_headers=["Mcp-Session-Id"],
|
|
),
|
|
],
|
|
lifespan=mcp_app.lifespan,
|
|
)
|