Skip to main content
Glama
byward

byward

Official
README.md
<p align="center"><img src="docs/assets/byward-logo.svg" alt="byward owl logo" width="128" height="128"></p>

# byward

[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/byward-dev/byward/badge)](https://scorecard.dev/viewer/?uri=github.com/byward-dev/byward)
[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/17230/badge)](https://www.bestpractices.dev/projects/17230)

**A sign-in gate for MCP servers.** byward puts any [MCP](https://modelcontextprotocol.io) server,
HTTP or stdio, behind OAuth 2.1 and your identity provider: Microsoft Entra ID first-class, Okta,
Keycloak, Google, Auth0, or any OpenID Connect provider. One Go binary, configured by environment
variables.

> **Latest release: [v0.6.0](https://github.com/byward-dev/byward/releases/tag/v0.6.0).**
> These docs follow `main`; the docs for a release are at its tag ([v0.5.0](https://github.com/byward-dev/byward/tree/v0.5.0/docs)).
> Pre-1.0, with no independent security audit yet: read the [security posture](docs/security-posture.md).

## How it works

```
MCP client ──OAuth 2.1──▶ byward ──sign-in──▶ your IdP (Entra ID, Okta, Keycloak, …)
 (Claude, ChatGPT,          │
  VS Code, Cursor…)         └──▶ MCP server (HTTP or stdio)
                                 never sees the client's or the IdP's token
```

- **MCP clients sign in with standard OAuth 2.1.** byward is the authorization server: it signs the
  user in at your IdP, shows its own consent page, and issues short-lived tokens of its own.
- **Clients connect without manual setup**, through Client ID Metadata Documents (CIMD) or Dynamic
  Client Registration (DCR). Static clients cover anything else.
- **The MCP server needs no auth code.** It never gets the client's token (no token passthrough).
- **Access is gated** by tenant, app roles and groups, a verified email domain or a Google Workspace
  domain, as the IdP provides them ([access gate](docs/how-to/access-gate.md)). Refresh tokens rotate with reuse
  detection, and operators can revoke a user or everyone.
- **Built to run:** SQLite state for one replica, or PostgreSQL for several
  ([postgres](docs/how-to/postgres.md)), rate limits on the OAuth endpoints, a structured
  audit stream, Prometheus metrics, and `byward doctor` to check a deployment.

Not a gateway: no routing or aggregation of several servers, and no policy language. byward
authenticates and gates access; your MCP server decides what each user may do
([scope and non-goals](docs/adr/0001-scope-auth-only-proxy-entra-first-class.md)).

## Verified clients

Signed in through byward against a real Entra tenant and called a tool (last run 2026-11-28, on
`main` at 394659d, after v0.4.1):

| Client | How it registers |
|---|---|
| Claude Code 2.1.311 | CIMD (a static client also works; last run on the v0.2 code) |
| claude.ai (web, 2026-11-28) | CIMD |
| ChatGPT developer mode (web, 2026-11-28) | CIMD |
| VS Code 1.142.0 | CIMD |
| Cursor 3.30.8 | DCR |

The TypeScript, Python and Go MCP SDK clients and MCP Inspector run against byward in CI.

## Try it

**Without an IdP, on your own machine:** `--insecure-no-auth` serves an MCP server with no sign-in
at all, on loopback only, to see byward relay requests before you set up an IdP
([ADR-0027](docs/adr/0027-insecure-no-auth.md)):

```sh
byward --insecure-no-auth --public-url http://127.0.0.1:8080/mcp --upstream-url http://127.0.0.1:3001/mcp
```

**With Entra:** the [Entra quickstart](docs/how-to/quickstart-entra.md) registers the app (or
`byward init entra` prints the commands for you) and then runs byward in front of your MCP server.
For another IdP, start with its guide ([Okta](docs/how-to/okta.md), [Keycloak](docs/how-to/keycloak.md),
[Google](docs/how-to/google.md), [Auth0](docs/how-to/auth0.md), [any OIDC IdP](docs/how-to/oidc.md)); the settings below
then use `BYWARD_IDP` and `BYWARD_OIDC_*` instead of `BYWARD_ENTRA_*`.

```sh
docker run --rm -p 8080:8080 --user "$(id -u):$(id -g)" \
  -v "$PWD/byward-data:/var/lib/byward" \
  -v "$PWD/entra-client-secret:/run/secrets/entra-client-secret:ro" \
  -e BYWARD_PUBLIC_URL=https://mcp.example.com/mcp \
  -e BYWARD_UPSTREAM_URL=http://upstream:3001/mcp \
  -e BYWARD_ENTRA_TENANT="$TENANT_ID" \
  -e BYWARD_ENTRA_CLIENT_ID="$APP_ID" \
  -e BYWARD_ENTRA_CLIENT_SECRET_FILE=/run/secrets/entra-client-secret \
  -e BYWARD_LISTEN=0.0.0.0:8080 \
  ghcr.io/byward-dev/byward:v0.6.0
```

`upstream` is your MCP server's address as the container sees it (the quickstart runs both on one
Docker network).

TLS usually ends at your ingress or reverse proxy; byward can also serve it with your certificate
([TLS](docs/how-to/tls.md)). Then work through the
[hardening checklist](docs/how-to/harden-a-deployment.md).

Images and archives are signed with cosign and carry build provenance; how to verify them:
[packaging](docs/reference/packaging.md).

## Documentation

| I want to… | Read |
|---|---|
| Try it on my machine | [Try it](#try-it) above, or [Keycloak on your machine](docs/how-to/keycloak.md#try-it-on-your-machine) |
| Connect my identity provider | [Entra quickstart](docs/how-to/quickstart-entra.md) · [Okta](docs/how-to/okta.md) · [Keycloak](docs/how-to/keycloak.md) · [Google](docs/how-to/google.md) · [Auth0](docs/how-to/auth0.md) · [several identity providers](docs/how-to/several-identity-providers.md) |
| Deploy it | [deploy](docs/how-to/deploy.md) · [hardening checklist](docs/how-to/harden-a-deployment.md) |
| Put a stdio MCP server behind it | [stdio upstreams](docs/how-to/stdio-upstream.md) |
| Control who gets in, and revoke access | [access gate](docs/how-to/access-gate.md) · [revoke access](docs/how-to/revoke-access.md) |
| Call downstream APIs as the user | [downstream APIs (On-Behalf-Of)](docs/how-to/downstream-apis.md) |
| Look up a setting, command or metric | [settings](docs/reference/settings.md) · [commands](docs/reference/commands.md) · [observability](docs/reference/observability.md) |
| Understand the security model | [security posture](docs/security-posture.md) · [decisions](docs/adr/) |

Everything else: [the docs index](docs/README.md).

## Development

`mise run check` runs everything CI runs; setup is in [CONTRIBUTING.md](CONTRIBUTING.md).

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md) (including the AI-assistance policy) and the
[Code of Conduct](CODE_OF_CONDUCT.md). Report vulnerabilities privately: [SECURITY.md](SECURITY.md).

MCP is a trademark of LF Projects, LLC. byward is an independent project.

## License

[Apache-2.0](LICENSE)