Skip to content

AAK-MCP-011: Remote MCP server handler lacks authentication middleware

Severity
CRITICAL
Category
MCP Configuration (mcp-config)
Scanner
agent_audit_kit/scanners/mcp_auth_patterns.py
Auto-fixable
No.
SARIF name
McpHandlerNoAuth

What it detects

A remote MCP server exposes an HTTP handler with no authentication check. Per MCP spec 2025-11-25 all remote servers must require OAuth 2.1 or an equivalent bearer credential. Matches the CVE-2026-33032 pattern where /mcp_message was exposed without the auth middleware that /mcp used.

How to fix

Apply the same auth middleware to every MCP HTTP route. Do not branch on method or path before enforcing auth.

To confirm the finding is gone, report only this rule:

agent-audit-kit scan . --rules AAK-MCP-011

Limitations

Looks for a FastAPI handler declared as @app.post("/mcp...") (or get, put, patch, delete) directly above a def whose parameter list holds no parenthesis, in a file that names an MCP server class, with no Depends( or @require_auth in the 200 characters before it. The same handler declared on an APIRouter (@router.post("/mcp")), with another decorator between the route and the def, with a default such as = Body(...), or the FastMCP app mounted with app.mount("/mcp", mcp.streamable_http_app()), is not matched.

References


All rules. This page is generated from the rule registry when the documentation is built; to change it, change the rule in agent_audit_kit/rules/builtin.py. To give the rule a hand-written write-up, add docs/rules/AAK-MCP-011.md: the page then shows that text, with the registry reference appended under it.