Authorization header behavior
- Last Updated: December 3, 2026
- 2 minute read
- Documentation
Marklogic MCP Server handles incoming Authorization headers. These headers are used when it calls MarkLogic Server.
Marklogic MCP Server supports three authentication modes, configured by the auth_method property under workflow context definitions in config.yaml:
| Mode | Incoming header expected from MCP client | MarkLogic REST app server authentication behavior |
|---|---|---|
basic |
Authorization: Bearer <base64(username:password)> |
Decodes the credentials and uses them to authenticate to MarkLogic Server. |
digest |
Authorization: Bearer <base64(username:password)> |
Decodes the credentials and uses them to authenticate to MarkLogic Server. |
oauth |
Authorization: Bearer <token> |
Forwards the bearer token to the MarkLogic REST app server on each request. |
In this project, “OAuth” means the IdP-backed bearer-token flow used by the oauth authentication mode.
Basic and digest
When auth_method in config.yaml is basic or digest, the MCP client must send an Authorization header in this format:
Authorization: Bearer <base64(username:password)>
MarkLogic MCP Server decodes the bearer value into username:password and uses those credentials when it authenticates to MarkLogic Server. This approach keeps credential handling on the client side while still allowing MarkLogic MCP Server to manage the MarkLogic Server session.
Bearer token flow
When auth_method in config.yaml is oauth, the MCP client must send an Authorization header in this format:
Authorization: Bearer <access-token>
MarkLogic MCP Server forwards that token to the MarkLogic REST app server as a Bearer token on every upstream request. This is a per-request flow: each call is evaluated with the caller’s token.
If no bearer token is present, then the MCP client is redirected to the identity provider (IdP) authorization endpoint instead of calling the MarkLogic REST app server directly.
Failure modes
| Situation | Behavior |
|---|---|
Missing Bearer token in basic/digest mode. |
The request fails before calling MarkLogic Server. |
Bearer token in basic or digest mode cannot be decoded as base64 username:password. |
The request fails before calling MarkLogic Server. |
Expired or invalid bearer token in oauth mode. |
MarkLogic Server returns an authentication error, which is surfaced to the caller. |
MarkLogic Server credentials derived from basic or digest are invalid. |
Upstream requests fail with an authentication error. |
Practical notes
- MarkLogic MCP Server reads the
Authorizationheader from the incoming MCP request using a case-insensitive lookup. - Authorization handling is per workflow, but the same rules apply to all MarkLogic MCP Server tools.
- For
basicanddigest, MarkLogic MCP Server decodes the incoming bearer value and uses the resulting credentials to authenticate to MarkLogic Server. - For
oauth, the bearer token is forwarded on each request rather than cached and reused to authenticate MarkLogic Server.