uBixGate: One Door for Every Agent's MCP Tools
The Problem Shows Up All at Once
Give a team’s coding agents MCP servers and three problems arrive together.
Every agent config carries its own copy of each server’s API token, so the token for the ticket tracker lives in a dozen dotfiles and at least one prompt transcript. Everyone gets every tool, because most MCP servers have no idea who is on the other end. And when something goes wrong, nobody can say which person’s agent did it; the server’s log says “the token”, and the token is everyone’s.
uBixGate moves all three into one place. Agents (Claude Code, Cursor, OpenCode, your own) connect to one URL. Behind it sits any number of MCP servers. For every tool call the gateway answers four questions:
| Question | Answer |
|---|---|
| Who is calling? | An OIDC access token, validated against your identity provider’s keys |
| What may they use? | A deny-by-default rule list. Each caller only sees the tools they may call |
| Where does the upstream’s credential come from? | Vault (uBix Vault or HashiCorp Vault), read at call time. The agent never holds it |
| What did they do? | One JSON audit line per call: who, which tool, the decision, the rule that made it |
It is tagged v0.1.0-beta.1 on GitHub, BSD 3-Clause.
The disclaimer, up front, because this sits in a security path: it is a beta and has had no independent security review. The config format, audit fields and metrics may change between betas. The README has a section called What it does not protect against, and I’d read it before putting the gateway in front of anything that matters. More on that below.
What a Call Goes Through
Every tools/call takes the same path, in one goroutine:
- Authenticate. The bearer token must be an RS256 or ES256 JWT signed by a key in the issuer’s JWKS, with the right issuer, valid
expandnbf, and an audience equal to the gateway’s own URL.alg: noneand HS* are refused outright. A failure is a 401 that points the client at the gateway’s protected resource metadata (RFC 9728), which is how MCP clients find out where to log in. - Route. Tools from every upstream appear as
server__tool, sotickets__ticket_createbelongs to theticketsupstream. - Authorize. The policy decides. Denials come back as a tool error that names the rule.
- Inject and forward. The upstream’s credential comes out of Vault and is attached as a header (HTTP upstreams) or an environment variable (stdio upstreams). The caller’s own token is never sent upstream.
- Audit. Exactly one record, whatever happened: allowed, denied, upstream error, timeout.
tools/list runs authentication and the policy too, so a contractor’s agent never even sees ticket_delete. The filtered list is marked cacheScope: private so a client doesn’t share it across users.
Policy You Can Review in a Merge Request
The policy is a YAML list of named rules. Deny rules are checked first, then allow rules, in file order; the first match decides, and no match is a deny by the built-in rule default-deny.
policy:
rules:
- name: contractors-no-writes
effect: deny
when: { groups: [contractors] }
server: "*"
tools: ["*_create", "*_delete"]
- name: devs-tickets-own-project
effect: allow
when: { groups: [developers] }
server: tickets
tools: ["*"]
args: { project: "myorg/*" }
audit_args: [project]
Rules match on user, group, client, server, tool globs and top-level string argument globs. Rules have names because the name is what a denial shows and what the audit line records:
bob deletes a ticket:
ERROR: denied by rule contractors-no-writes
alice deletes a ticket outside myorg/:
ERROR: denied by rule default-deny
Argument values are redacted in the audit log unless the deciding rule keeps them (audit_args), or you can log an HMAC instead so equal values can be correlated without being readable.
The evaluator sits behind one interface, Decide(ctx, Request), so OPA or CEL could be another implementation later. Neither is built; for a beta, a rule list a person can read beats a policy language they have to learn.
Credentials the Agent Never Sees
This is the part I built uBixGate for. The gateway logs in to Vault with its own identity (a token, AppRole, or its Kubernetes service account), renews at half the TTL, and reads each upstream’s credential when a call needs it. Reads are cached briefly, shared across concurrent calls, capped by the secret’s lease and never served past expiry. If an HTTP upstream answers 401, the cached credential is dropped and the call retried once, so a rotation in Vault takes effect without a restart.
stdio upstreams are the awkward case: a running process can’t be handed a new environment. So the gateway restarts a stdio upstream when its credential expires and no call is in flight.
The demo proves the point instead of asserting it. The fake ticket tracker refuses any request without a service token that only Vault and the gateway hold, and the demo script checks that the token appears nowhere in what Alice’s client received:
== 2. Alice opens a ticket. The tracker requires a service token that only Vault and the gateway hold
authenticated as svc-tickets: created ticket in myorg/web
The service token appears nowhere in what Alice received, nor in this script's environment.
That demo runs uBix Vault (initialised and unsealed by a one-shot script), a toy identity provider that mints real signed tokens for alice and bob, the fake tracker, and uBix Shepherd as a stdio upstream. demo.sh speaks MCP with plain curl, so every request is visible.
Small on Purpose
The gateway is 2,454 lines of non-test Go, against a budget of 4,000 that CI enforces. The goal is that one person can read all of it in an afternoon. For something you put between your agents and your production tools, being able to read it is the security feature.
That budget drove most of the dependency decisions:
- The official MCP Go SDK does the protocol. Clients may speak MCP 2026-07-28 or 2025-11-25, and upstreams are spoken to in whatever they negotiate (some stdio servers top out at 2025-11-25). Two revisions, two transports, client and server sides: that’s exactly the code I didn’t want to hand-roll.
- JWT validation is the standard library, not a JOSE package. RS256 and ES256 over
crypto/rsaandcrypto/ecdsais not much code, and it’s the code I most want to be able to read line by line. - The Vault client is its own: login, read, renew. A few hundred lines instead of HashiCorp’s API module and its dependency tree. It speaks the HTTP API that uBix Vault and HashiCorp Vault share; the tests run it against a fake, and the demo, which CI runs on every change, against a real uBix Vault, but nothing has run it against HashiCorp Vault yet.
- Beyond the SDK, the only direct dependencies are a YAML parser and the Prometheus client.
The tests are where the line count isn’t stingy. Policy and JWT validation are table tests (bad signature, wrong audience, expired, alg: none, HS256 with a public key as the secret, JWKS rotation). The integration tests build the gateway from YAML in front of an in-process fake IdP, a fake Vault and fake upstreams over both transports and both protocol revisions, and assert one audit line per call. One check I like: switch credential injection off, and the integration tests fail. A test suite that passes with the security feature removed isn’t testing it.
What It Does Not Protect Against
uBixGate is a policy and attribution point for agents acting on behalf of authenticated people. It assumes the agents are honest but fallible. It is not a sandbox, and the README says so in a list I’ll repeat here:
- Prompt injection and hostile tool output. Results pass back unmodified.
- Misuse inside an allowed scope. If a rule allows
project: myorg/*, the caller may delete every ticket inmyorg. - Arguments the upstream reads differently than the glob. Globs match the raw string. If an upstream normalises
myorg/..or decodes%2F, a constraint can be bypassed. A constraint is only as strong as the upstream’s own parsing. - A compromised upstream or gateway host. The upstream holds its injected credential; the gateway holds a Vault token and every cached credential. Scope its Vault policy to exactly the configured paths.
- A user posing as another client. The client name is attribution, not a boundary, unless your IdP issues per-client tokens.
- Audit tampering by someone with file access. The log is append-only by open mode, not tamper-evident. Ship it off the host if that matters.
And what’s not in the beta at all: per-user upstream credentials (every user’s calls reach an upstream with the same service credential; the gateway’s audit log is the per-user record), SAML or SCIM, server-to-client requests like sampling and elicitation, an admin UI, multi-tenancy, and rate limiting beyond a simple per-user call limit.
Running It
Release archives for Linux, macOS and Windows (built, untested on Windows) are on the release page, with a keyless cosign signature over the checksums. For Kubernetes there’s a Helm chart in deploy/charts/ubixgate. It takes the gateway’s config as a value, logs in to Vault with the pod’s service account, and its Ingress exposes only the MCP endpoint and its metadata, never /metrics. It runs the published container image, ghcr.io/ubixsys/ubixgate:0.1.0-beta.1, built for amd64 and arm64 and signed with keyless cosign like the checksums.
Hooking Claude Code up to it is one command:
claude mcp add --transport http ubixgate https://mcp.example.com/mcp \
--header "Authorization: Bearer $TOKEN"
What’s Next
Per-user upstream credentials are the big one: token exchange, or a Vault login on the user’s behalf, so the upstream’s own logs see Alice instead of the gateway. After that: tool annotations in policy (“read-only tools of any server” instead of a list of names), and an independent security review before anything called 1.0.
It’s the third piece of a family that’s starting to fit together: uBix Vault holds the secrets, uBix Shepherd directs the agents, and uBixGate is the door between the agents and the tools. If you try it, the issues are open.
