
Give each MCP tool its own scope, and return a refusal the client can act on
Part 6 gated the whole server with one scope, which meant the token that let an agent look up a customer also let it issue refunds. Splitting that per tool is easy. Making the refusal useful is not: the obvious implementation returns HTTP 200 with the error buried in the body, so a client has nothing to trigger step-up authorization on. Getting the 403 and WWW-Authenticate challenge the spec defines means leaving the framework's abstraction entirely — and the version that does it decodes the token a second time, unverified.

The wrong valid token: authenticating an MCP tools server with authentik
Agent orchestration part 4 scoped tools in the client and admitted the server still trusted whoever reached the port. This puts a JWT verifier in front of it, with its own authentik client, so the tools server refuses anonymous callers — and refuses the gateway's own valid token, because a separate provider means a separate issuer. Includes the documented client-credentials helper that cannot work here, and the four silent 404s it produces instead of saying so.

The key that expires: giving an agent its own identity at the gateway
Part 4 ended with a shell, a static key and a model that answered. This replaces that key with a token your identity provider issues, that carries a scope, and that dies after five minutes. authentik issues it over client credentials, the gateway verifies it in twenty-five lines, and three status codes prove the boundary. Includes the requirement authentik doesn't document, and the licence wall you hit if you follow LiteLLM's own guide.