Problem
The AFM spec recognizes several authentication types (bearer, basic, api-key, jwt, oauth2) but does not define the required or optional fields for any of them. The spec states that "additional fields are authentication-type specific," leaving it to runtimes and users to figure out what each type needs.
Of these, only bearer, basic, and api-key are implemented in runtimes today. jwt and oauth2 are recognized by the spec but have no runtime support — their field schemas need to be defined before they can be implemented.
This creates problems:
- No validation: Runtimes can't validate auth configs against a schema — a missing
token field on a bearer type is only caught at request time.
- Inconsistency across runtimes: Different implementations may expect different field names or structures for the same auth type.
- Poor authoring experience: Users writing
.afm.md files have no spec-defined reference for what fields to provide. They rely on runtime-specific docs or trial and error.
- Blocked implementations:
jwt and oauth2 can't be implemented without first agreeing on what fields they require.
Proposal
Define the required and optional fields for each authentication type in the spec.
Proposed field schemas
bearer
| Field |
Required |
Description |
token |
yes |
The bearer token value |
authentication:
type: bearer
token: "${env:API_TOKEN}"
basic
| Field |
Required |
Description |
username |
yes |
The username |
password |
yes |
The password |
authentication:
type: basic
username: "${env:SERVICE_USER}"
password: "${env:SERVICE_PASS}"
api-key
| Field |
Required |
Description |
api_key |
yes |
The API key value |
authentication:
type: api-key
api_key: "${env:API_KEY}"
jwt
TBD
oauth2
TBD
Where authentication appears
Authentication is used across multiple contexts in the spec:
tools.mcp[].transport.authentication — MCP server connections
model.authentication — model/provider connections
interfaces[].subscription.authentication — webhook subscriptions
The field schema should apply uniformly regardless of where the authentication object appears.
Open questions
- JWT generation: Should the spec support runtime-side JWT signing (providing a key and claims), or only accept pre-signed tokens? If generation is supported, what fields are needed (
signing_key, algorithm, claims, expiry)?
- Custom headers for API keys: Some APIs expect the key in a specific header (e.g.,
X-API-Key vs Authorization). Should api-key support an optional header_name field?
- Extensibility: Should runtimes be allowed to support additional auth types beyond the spec-defined set, or should unknown types be rejected?
Problem
The AFM spec recognizes several authentication types (
bearer,basic,api-key,jwt,oauth2) but does not define the required or optional fields for any of them. The spec states that "additional fields are authentication-type specific," leaving it to runtimes and users to figure out what each type needs.Of these, only
bearer,basic, andapi-keyare implemented in runtimes today.jwtandoauth2are recognized by the spec but have no runtime support — their field schemas need to be defined before they can be implemented.This creates problems:
tokenfield on abearertype is only caught at request time..afm.mdfiles have no spec-defined reference for what fields to provide. They rely on runtime-specific docs or trial and error.jwtandoauth2can't be implemented without first agreeing on what fields they require.Proposal
Define the required and optional fields for each authentication type in the spec.
Proposed field schemas
bearertokenbasicusernamepasswordapi-keyapi_keyjwtTBD
oauth2TBD
Where authentication appears
Authentication is used across multiple contexts in the spec:
tools.mcp[].transport.authentication— MCP server connectionsmodel.authentication— model/provider connectionsinterfaces[].subscription.authentication— webhook subscriptionsThe field schema should apply uniformly regardless of where the authentication object appears.
Open questions
signing_key,algorithm,claims,expiry)?X-API-KeyvsAuthorization). Shouldapi-keysupport an optionalheader_namefield?