8000 Authentication · acuvity/minibridge Wiki · GitHub
[go: up one dir, main page]

Skip to content

Authentication

csrfn edited this page May 5, 2025 · 3 revisions

Minibridge has been designed to be flexible. In this section, we will try different authentication mechanism:

  1. A Basic authentication: the Client starts with a username/password and the policer decides to authorize (or not) the call to the backend
  2. A Bearer authentication: the Client has a token which can be passed via the --agent-token. The token can be decoded by the policer to check the claims
  3. A passthrough: Considering the Client has its own authentication mechanism, the frontend pass the credentials to the backend which decides to authorize (or not) the traffic

Note

If Minibridge frontend is not connecting to the backend using TLS, it will refuse to send the credentials or pass the Authorization header. It will print a warning when that happens and nothing will likely work. Make sure to always use TLS when you forward credentials to the backend.

Basic Authentication

This is the simpliest example to showcase how you can leverage a basic authentication passed to the Minibridge backend. The policer will verify that the frontend is coming with a username "bob" and a password "secret"

Simple Rego policy:

package main

import rego.v1

reasons contains "invalid credentials" if {
	input.agent.password != "secret"
}

allow if {
	count(reasons) == 0
}

Backend:

minibridge backend --listen :8000 --tls-server-cert=/tmp/certs/server.crt --tls-server-key=/tmp/certs/server.key --policer-type rego --policer-rego-policy /tmp/example.rego -- uvx mcp-server-fetch

Frontend:

{
    "mcpServers": {
        "acuvity-mcp-server-fetch": {
            "command": "minibridge",
            "args": [
                "frontend",
                "--backend",
                "wss://127.0.0.1:8000/ws",
                "--tls-client-backend-ca",
                "/tmp/certs/server.crt",
                "--agent-user",
                "bob",
                "--agent-pass",
                "secret"
            ]
        }
    }
}

Tip

Checkout the example folder in Minibridge repository.

Bearer Authentication

{
    "mcpServers": {
        "acuvity-mcp-server-fetch": {
            "command": "minibridge",
            "args": [
                "frontend",
                "--backend",
                "wss://127.0.0.1:8000/ws",
                "--tls-client-backend-ca",
                "/tmp/certs/server.crt",
                "--agent-token",
                "<token>"
            ]
        }
    }
}

Tip

Checkout the example folder in Minibridge repository.

Passthrough Authentication

This mode simply forwards the HTTP Authorization header to the Minibridge backend. It is useful when the frontend runs on a public network and you want the policer to authenticate multiple callers.

{
    "mcpServers": {
        "acuvity-mcp-server-fetch": {
            "command": "minibridge",
            "args": [
                "frontend",
                "--backend",
                "wss://127.0.0.1:8000/ws",
                "--tls-client-backend-ca",
                "/tmp/certs/server.crt",
                "--agent-auth-passthrough"
            ]
        }
    }
}

Clone this wiki locally

0