Skip to content

Support Authorization headers for authentication #41

Description

@johnthagen

The MCP servers we connect the agent require to Authorization headers (that are internally forwarded on to other API backends behind them). This allows a user to pass Basic / Bearer etc authentication/tokens in a header out of band to authenticate requests.

The key here is that for authorization, this needs to be "per user" and collected in the browser rather than something hard-coded into custom Pydantic AI agent configuration.

It would be great if ai-chat-ui supported an optional "login" prompt that would allow setting common authentication headers (e.g, Basic Auth and Bearer Auth) that would be sent to HTTP MCPToolsets.

Existing Art

Codex

Codex supports adding headers to queries to HTTP MCP servers

Image

OpenCode

OpenCode supports adding headers to MCP server requests

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "my-remote-mcp": {
      "type": "remote",
      "url": "https://my-mcp-server.com",
      "enabled": true,
      "headers": {
        "Authorization": "Bearer MY_API_KEY"
      }
    }
  }

Swagger UI

This is similar to how Swagger UI exposed authentication options in its user-friendly REST API development pages.

Image Image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions