feat(mcp): câble le garde /_mcp + exemption CSRF dans l'app (scope B #111)

This commit is contained in:
Colin Maudry
2026-07-10 15:00:53 +02:00
parent 697711f676
commit 4f18cc07f2
2 changed files with 39 additions and 0 deletions
+13
View File
@@ -124,6 +124,19 @@ if _mcp_enabled:
)
import src.mcp.tools # noqa: E402,F401 # l'import enregistre les @mcp_enabled
# Les routes /_mcp existent maintenant : exempter du CSRF (POST JSON-RPC
# externe sans jeton) puis brancher le garde d'abonnement.
from src.mcp.auth import init_mcp_auth # noqa: E402
if _auth_csrf is not None:
for _rule in app.server.url_map.iter_rules():
if _rule.rule.startswith("/_mcp"):
_vf = app.server.view_functions.get(_rule.endpoint)
if _vf is not None:
_auth_csrf.exempt(_vf)
init_mcp_auth(app.server)
from src.subscriptions.setup import init_subscriptions # noqa: E402
init_subscriptions(app.server)