Repository navigation
Authentication
Minibridge has been designed to be flexible. In this section, we will try different authentication mechanism:
- A Basic authentication: the Client starts with a username/password and the policer decides to authorize (or not) the call to the backend
-
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 - 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.
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-fetchFrontend:
{
"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.
{
"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.
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"
]
}
}
}