← All notes

MCP authorization: OAuth for HTTP transports, environment credentials for stdio

Answer: Authorization is optional for MCP implementations. When supported, HTTP-based transports should conform to the MCP authorization specification. STDIO transports should not follow that specification; instead, they retrieve credentials from the environment.

Roles and tokens

A protected MCP server acts as an OAuth 2.1 resource server and accepts protected resource requests using access tokens. MCP clients must include the resource parameter in authorization and token requests, binding tokens to their intended audiences. Token passthrough is explicitly forbidden. Clients and servers must implement secure token storage.

Gemini CLI client behavior

For remote MCP servers over SSE or HTTP transports, Gemini CLI supports OAuth 2.0 authentication. With OAuth discovery, it can detect 401 responses and discover OAuth endpoints from server metadata. Use /mcp auth to list servers requiring authentication or authenticate with one.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Model Context Protocol, Authorization (MCP specification 2025-11-25), Apache-2.0 (specification; earlier contributions MIT) (https://raw.githubusercontent.com/modelcontextprotocol/modelcontextprotocol/main/LICENSE); google-gemini/gemini-cli (GitHub), MCP servers with the Gemini CLI, Apache-2.0 (https://raw.githubusercontent.com/google-gemini/gemini-cli/main/LICENSE). Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Model Context Protocol, Authorization (MCP specification 2025-11-25), Apache-2.0 (specification; earlier contributions MIT) (https://raw.githubusercontent.com/modelcontextprotocol/modelcontextprotocol/main/LICENSE); google-gemini/gemini-cli (GitHub), MCP servers with the Gemini CLI, Apache-2.0 (https://raw.githubusercontent.com/google-gemini/gemini-cli/main/LICENSE).

Cite this

Permanent ID: iil:note:17rp2f9p

iinventedlight. 2026. "MCP authorization: OAuth for HTTP transports, environment credentials for stdio." iinventedlight Library, iil:note:17rp2f9p, version of 2026-11-16. https://iinventedlight.com/library/notes/ao-mcp-authorization-oauth/. License: CC-BY-4.0.

@misc{iil_note_17rp2f9p,
  author = {{iinventedlight}},
  title = {{MCP authorization: OAuth for HTTP transports, environment credentials for stdio}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-16},
  url = {https://iinventedlight.com/library/notes/ao-mcp-authorization-oauth/},
  note = {Permanent ID iil:note:17rp2f9p. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

Extra files beside this note

These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.

All artifact files (JSON index)

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/ao-mcp-authorization-oauth.md.