Add OAuth 2.1 authorization (2025-06-18, opt-in) #17
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Add OAuth 2.1 authorization — the formalised authentication framework introduced in MCP spec
2025-06-18.Goal
lmcp's current auth is a single shared Bearer token per server (
LMCP_TOKENenv,.godparticleconf entry, or--authflag). That's fine for LAN/single-user deployments and should stay. But spec-compliant clients on public deployments expect OAuth 2.1 flows: dynamic client registration, authorization code with PKCE, token refresh, scope checking.Spec surface (2025-06-18)
/.well-known/oauth-authorization-server/.well-known/oauth-protected-resource/register/authorize/tokenAuthorization: Bearer <jwt>on/mcpServers MAY delegate to an external auth server (Auth0, Keycloak, your own) by pointing the discovery document at it. lmcp's role then reduces to: validate incoming JWTs against the discovery doc's JWKS endpoint, check scopes against tool annotations.
API for lmcp
Or, simpler: delegate to an upstream issuer entirely and lmcp just validates JWTs.
Concerns
luacryptoorlua-resty-jwtas optional dep whenmode = "oauth",opensslfor the verification step,Scope (v1)
/.well-known/*) returning a config file's contents.Authorizationheader parsing.openssl dgst -verifyshell-out (avoids new Lua deps).tools/callif missing the right scope, configurable per-tool).Out of scope
/authorizeand/token).Priority
Low for the home-LAN use case (Bearer-token + LAN trust covers it). High if lmcp ever ships as a publicly-reachable service. Defer until there's a concrete public-deployment requirement; track here so it doesn't get lost.
Mark this as long term feature request. For now, lmcp stays LAN only.
Acked: long-term. lmcp stays Bearer-token + LAN for now. Re-open scope discussion when a public deployment becomes concrete. Awaiting a long-term label from a repo-write account.