Skip to content
Registry StackDocsv0.48.0

Citizen chat assistant

View as Markdown

Run breg-mcp and breg-review beside your Base Registry Engine (BReg) so a citizen can ask a chat host, for example an AI assistant, to read their own Record and prepare a change to it. The citizen then submits that change on a review page you host. You need a registry project with a proposal-mode Action, an issuer that exchanges tokens and carries task grants, and a TLS proxy.

breg-mcp is a Model Context Protocol (MCP) gateway. A chat host calls it at /mcp with a token issued for one signed-in citizen. The gateway reads that citizen’s Record and starts or edits a Proposal draft, which its tools call an application. breg-review is a server-rendered page where the citizen signs in, compares the draft with their Record, and submits it.

The gateway advertises MCP revision 2026-07-28 and serves Streamable HTTP with tools/list, tools/call, and protected-resource metadata. It advertises tools only: no resources, prompts, sampling, or model-host administration. Its tested surface is not a compatibility certification for every chat host or every protocol revision the SDK recognises.

Neither service adds registry semantics: BReg decides what the citizen may see or change, under the access profile each service names. The two run with separate credentials, so no process can both prepare a change and submit it.

Both services ship in releases as an experimental surface: they stay outside the compatibility promise and may change in any minor release. Neither provides the task authority that issues the citizen’s grants, so your deployment integrates its own (see An issuer and a task authority).

ToolWhat it does
describe_serviceReturns the configured name, description, and disclosure
get_my_detailsReturns the citizen’s own Record
start_applicationStarts a draft, keyed by a startAttemptId UUID
list_applicationsLists the citizen’s applications, a page at a time
update_applicationEdits a draft at an expectedRevision, with 1 to 64 patch operations
prepare_reviewReturns the draft and its reviewUrl
get_application_statusReturns the application’s status

Each input schema offers only the fields the gateway’s access profile may write, and never the target input. Registry text comes back labelled as data, never as instructions.

A chat host that reaches past that split gets these results:

The chat host tries toResult
Pass the target input, or a field it may not writeinvalid-arguments, before any call to BReg
Start when BReg returns no single Record for the citizenrecord-not-resolved; nothing is created
Reach an application the citizen does not own, or whose target is no longer theirsnot-found
Edit with an outdated expectedRevisionstale-application
Edit after submissionapplication-not-editable
Submit, cancel, or applyNo tool exists, and the gateway’s profile holds no such operation

status reads draft until the citizen submits, then submitted, then applied, rejected, or cancelled as the Action’s review and application settings decide.

The review page re-reads the draft and its target under the citizen’s token before it shows the form and at submit. An unreadable target gets the same 404 as a missing draft, and a changed draft is shown again with a notice.

Declare a Record type with an owner field the citizen cannot write, a proposal-mode Action whose reference input targets it, and two access profiles. Actions and Proposals shows the Action. The gateway’s agent profile carries a task grant:

accessProfiles:
citizen-agent:
principalClaim: sub
actorKind: agent
requesterClients: [<gateway-exchange-client-id>]
requiredScopes: [address-correction:self]
requiredPurposes: [address-correction]
taskGrant:
sourceIssuer: https://tasks.example.com
permissions:
records:
- recordType: person-address
operations: [get, list]
readableFields: [address-line, locality, postal-code]
rowBoundaries:
- field: owner
claim: sub
operator: equals
actions:
- action: correct-address
operations: [start]
targets:
- recordType: person-address
rowBoundaries:
- field: owner
claim: sub
operator: equals
proposals:
- action: correct-address
operations: [get, list, edit]
ownership: caller
readableInputs: [address, new-address-line, new-locality, new-postal-code]
targets:
- recordType: person-address
rowBoundaries:
- field: owner
claim: sub
operator: equals

The citizen gateway needs Proposal Get to prepare a review and report status, so its profile uses taskGrant. A task-grant profile must name requesterClients and requiredPurposes, and may not write Records directly. A standing agent without a task grant can Start and edit its own draft. An institution may separately grant get-review-context, including for a submitted Proposal, to an exact requester client with a verified trusted actor. That agent profile defines source disclosure; it does not inherit the represented person’s BReg permissions. Other submitted lifecycle operations remain refused with breg.proposal.standing-agent-operation-forbidden. Keep review-context disclosure disabled until the institution approves its reviewer population and field/row ceiling.

The review page’s profile, citizen-review here, uses actorKind: human, its own client, and no task grant. It adds submit and cancel on the Proposal. Control access and reads explains each permission.

In BReg’s runtime configuration, admit both clients, trust the gateway as an actor, and name the task authority:

authentication:
oidc:
audience: https://registry.example.com/citizen-address-correction
allowedClients:
- <gateway-exchange-client-id>
- <review-page-client-id>
authorityClaims:
principal: sub
purpose: registry_purpose
trustedActors:
<gateway-exchange-client-id>: <gateway-actor-subject>
taskGrantStatus:
- sourceIssuer: https://tasks.example.com
baseUrl: https://tasks.example.com
tokenEndpoint: https://login.example.com/token
clientAssertionAudience: https://login.example.com
clientId: <registry-status-client-id>
privateKeyRef: secret:file/task-status-key
statusResource: <task-authority-resource>

BReg accepts a delegated token only when its act claim names the subject trustedActors maps to the gateway’s exchange client. Before every Proposal read and change, BReg asks the taskGrantStatus authority whether the grant is still current. What a token must carry gives the rest of the token contract.

Neither service serves an authorization endpoint. Register each chat host, the gateway’s exchange client, and the review page’s client with your issuer ahead of time, each with its own key.

The chat host’s token is an RFC 9068 at+jwt whose audience is exactly the gateway’s resourceServer.resource.

For the gateway, the issuer must support:

  • private_key_jwt authentication for the exchange client, with the issuer as assertion audience.
  • A client_credentials grant that honours the RFC 8707 resource parameter, so the actor token is issued for the gateway and never for BReg.
  • RFC 8693 exchange of the chat host’s token. The issued token names the citizen in sub, carries BReg’s audience, and has an act claim of exactly sub, or sub and iss.

Each exchanged token also carries the task grant: registry_grant_id, registry_grant_source_issuer, registry_grant_client, registry_grant_resource, registry_grant_exp, registry_grant_bounds, registry_approver, registry_purpose, registry_actor_kind set to agent, and an identity object of 1 to 32 members. The bounds cover the agent profile’s Record and Action permissions, plus one entry for each Proposal:

{
"type": "breg",
"permissions": [
{ "collection": "person-addresses", "operations": ["get", "list"] },
{ "collection": "action:correct-address", "operations": ["start"] },
{ "collection": "proposal:<proposal-id>", "operations": ["get", "list", "edit"] }
]
}

Whoever issues grants must therefore learn each Proposal the gateway starts and name it in that citizen’s later grants; a Start grant gives no later Get, List, or Edit access. Neither service provides this task authority or provisions those grants, and token exchange alone creates no per-Proposal authority. The task authority answers BReg’s status request at /v1/task-grants/{grantId}/status, unless statusPath names another route.

For the review page, the issuer must offer OpenID Connect discovery, the code flow with PKCE (S256), private_key_jwt with the issuer as assertion audience, and the RFC 8707 resource parameter. ID tokens are signed with EdDSA, ES256, ES384, RS256, or PS256. The registry token carries registry_actor_kind set to human.

breg-mcp reads one closed YAML document at the absolute --runtime-config path. It refuses unknown and duplicate keys, and names the replacement for a renamed one. String values accept ${VAR}, ${VAR:-default}, and ${VAR:?message}; secret references never do.

apiVersion: id.registrystack.org/formats/breg/mcp-runtime/v1alpha1
kind: BRegMcpRuntimeConfig
listener:
bind: 10.0.0.10:8110
tlsTermination: operator-controlled-upstream
networkExposure: private-address
secretProviders:
file:
root: /run/secrets/breg-mcp
resourceServer:
resource: https://assistant.example.com/mcp
issuer: https://login.example.com
jwksSource:
type: uri
uri: https://login.example.com/jwks.json
algorithms:
- ES256
allowedClients:
- <chat-host-client-id>
requiredScopes:
- address-correction:self
registry:
baseUrl: https://registry.example.com/
accessProfile: citizen-agent
audience: https://registry.example.com/citizen-address-correction
scopes:
- address-correction:self
exchange:
tokenEndpoint: https://login.example.com/token
clientId: <gateway-exchange-client-id>
privateKeyRef: secret:file/gateway-key
assertionAudience: https://login.example.com
service:
name: Address correction
description: Correct the postal address the registry holds for you.
disclosure: The assistant you use will see your current address and the correction you request.
details:
recordType: person-address
application:
action: correct-address
targetInput: address
reviewBaseUrl: https://review.example.com/
audit:
destination: file
path: /var/lib/breg-mcp/audit/audit.jsonl
hashKeyRef: secret:file/audit-key
rateLimits:
perCitizen:
requestsPerMinute: 30
burst: 10
perClient:
requestsPerMinute: 600
burst: 100

The table below gives each key. Rules that span keys or services:

  • registry.audience is BReg’s audience and must differ from resourceServer.resource, or check reports breg.mcp-runtime.audience-reused.
  • exchange.clientId is the client BReg’s trustedActors names. Listing it in resourceServer.allowedClients is refused with breg.mcp-runtime.exchange-client-admitted-inbound.
  • registry.accessProfile names the task-grant agent profile. service.application.targetInput takes the input’s identifier, not its API name.
  • service.reviewBaseUrl is the review page’s publicOrigin. Review links take the form <reviewBaseUrl>/proposals/<applicationId>.
  • Plain http URLs are accepted only on a loopback host under tlsTermination: development-loopback.
  • A fetched key set may not sit at a loopback, private, or cloud-metadata address. Use jwksSource.type: static for an issuer on a private network.
Key pathTypeRequiredAccepted valuesConstraints
apiVersionstringYes
  • id.registrystack.org/formats/breg/mcp-runtime/v1alpha1
None specified
auditThe audit block every Registry Stack product shares: the hash key, then a file (the default) or stdout destination, with rotation and retention for a file.objectYesNot specifiedNone specified
audit.destinationWhere audit lines go: file or stdout.stringNo
  • file
  • stdout
Schema default, where declared: "file"
None specified
audit.hashKeyRefSecret reference to the audit hash key.stringYesNot specified
  • pattern: ^(?:secret:env/[A-Z][A-Z0-9_]{0,127}|secret:file/[a-z][a-z0-9._-]{0,127})$
audit.pathThe absolute path of the active audit file. Required for a file destination, and refused with stdout.stringConditionalNot specified
  • pattern: ^/+(?:(?:[^/.][^/]*|\.(?:[^/.][^/]*|\.[^/]+)?)/+)*(?:[^/.][^/]*|\.(?:[^/.][^/]*|\.[^/]+))$
audit.retentionDaysDays a rotated file is kept, for a file destination. Default: 90.integerNoNot specified
  • format: uint32
  • maximum: 36500
  • minimum: 1
audit.rotateBytesSize at which the active file rotates, in bytes, for a file destination. Default: 100 MiB.integerNoNot specified
  • format: uint64
  • maximum: 4294967295
  • minimum: 1048576
exchangeThe gateway's own client identity at the authorization server.objectYesNot specifiedNone specified
exchange.assertionAudienceThe authorization server's issuer identifier, exactly as its metadata publishes it: the client assertion's sole audience. It has no default.stringYesNot specified
  • maxLength: 512
  • minLength: 1
  • pattern: ^[^\u0000-\u001F\u007F-\u009F]+$
exchange.clientIdThe gateway's client identifier at the authorization server. It may not also be one of resourceServer.allowedClients.stringYesNot specified
  • maxLength: 512
  • minLength: 1
  • pattern: ^[^\u0000-\u001F\u007F-\u009F]+$
exchange.privateKeyRefSecret reference to the private JWK the gateway signs its client assertions with, under a declared provider.stringYesNot specified
  • pattern: ^(?:secret:env/[A-Z][A-Z0-9_]{0,127}|secret:file/[a-z][a-z0-9._-]{0,127})$
exchange.tokenEndpointThe authorization server's token endpoint. An https URL with no query or fragment; plain http is accepted only on a loopback host under development-loopback.stringYesNot specified
  • format: uri
  • maxLength: 2048
  • pattern: ^[Hh][Tt][Tt][Pp][Ss]?://[^/?#@\u005C\u0000-\u0020\u007F-\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]+([/?#][^\u005C\u0000-\u0020\u007F-\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]*)?$
kindstringYes
  • BRegMcpRuntimeConfig
None specified
limitsobjectNoNot specifiedNone specified
limits.maximumRequestBytesLargest request body the MCP endpoint reads, in bytes.integerNoNot specifiedSchema default, where declared: 65536
  • format: uint64
  • maximum: 1048576
  • minimum: 1
listenerThe listener of a runtime that declares its TLS termination and network exposure.objectYesNot specifiedNone specified
listener.bindSocket address the runtime listens on, written host:port with an IP address host ([addr]:port for IPv6).stringYesNot specified
  • maxLength: 128
  • minLength: 1
listener.networkExposureThe operator-declared private network placement of an HTTP listener.stringNo
  • container-private
  • private-address
Schema default, where declared: "private-address"
None specified
listener.tlsTerminationDeclares the trusted transport boundary for a runtime's plaintext HTTP listener. Production listeners require operator-controlled upstream TLS termination; direct plaintext is limited to the explicit loopback-only development mode.stringYes
  • development-loopback
  • operator-controlled-upstream
None specified
logLevelOperational log level when BREG_MCP_LOG is not set. Defaults to info; accepted values are error, warn, and info.stringNo
  • error
  • info
  • warn
Schema default, where declared: "info"
None specified
rateLimitsobjectYesNot specifiedNone specified
rateLimits.perCitizenThe limit each citizen's requests share.objectYesNot specifiedNone specified
rateLimits.perCitizen.burstRequests admitted at once before the average applies.integerYesNot specified
  • format: uint32
  • maximum: 1000000
  • minimum: 1
rateLimits.perCitizen.requestsPerMinuteRequests admitted per minute, on average.integerYesNot specified
  • format: uint32
  • maximum: 1000000
  • minimum: 1
rateLimits.perClientThe limit each chat-host client's requests share.objectYesNot specifiedNone specified
rateLimits.perClient.burstRequests admitted at once before the average applies.integerYesNot specified
  • format: uint32
  • maximum: 1000000
  • minimum: 1
rateLimits.perClient.requestsPerMinuteRequests admitted per minute, on average.integerYesNot specified
  • format: uint32
  • maximum: 1000000
  • minimum: 1
registryThe one registry deployment and access profile the gateway acts on.objectYesNot specifiedNone specified
registry.accessProfileThe standing agent access profile every call names.stringYesNot specified
  • pattern: ^[a-z][a-z0-9_-]{0,63}$
registry.attemptTimeoutMillisecondsHow long one registry call may take before it is abandoned, in milliseconds.integerNoNot specifiedSchema default, where declared: 10000
  • format: uint64
  • maximum: 120000
  • minimum: 100
registry.audienceThe registry's token audience, requested as the exchange resource.stringYesNot specified
  • maxLength: 512
  • minLength: 1
  • pattern: ^[A-Za-z][A-Za-z0-9+.-]*:(?:[A-Za-z0-9._~:/?\[\]@!$&'()*+,;=-]|%[0-9A-Fa-f]{2})*$
registry.baseUrlThe registry deployment's base URL. An https URL with no query or fragment; plain http is accepted only on a loopback host under development-loopback.stringYesNot specified
  • format: uri
  • maxLength: 2048
  • pattern: ^[Hh][Tt][Tt][Pp][Ss]?://[^/?#@\u005C\u0000-\u0020\u007F-\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]+([/?#][^\u005C\u0000-\u0020\u007F-\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]*)?$
registry.scopesThe scopes requested for the delegated registry token.arrayYesNot specified
  • maxItems: 128
  • minItems: 1
  • uniqueItems: true
registry.scopes[]Array itemAn RFC 6749 scope token: printable ASCII other than space, ", and \.stringNoNot specified
  • maxLength: 512
  • minLength: 1
  • pattern: ^[!#-\[\]-~]+$
resourceServerWho may call the gateway: the chat hosts' authorization server.objectYesNot specifiedNone specified
resourceServer.algorithmsThe asymmetric signature algorithms an accepted token may use.arrayYesNot specified
  • maxItems: 128
  • minItems: 1
  • uniqueItems: true
resourceServer.algorithms[]Array itemAn asymmetric access-token signature algorithm.stringNo
  • ES256
  • ES384
  • EdDSA
  • RS256
  • RS384
None specified
resourceServer.allowInsecureHttpPermit plain HTTP beyond loopback to the declared issuer and to a JWKS URI declared in jwksSource.booleanNoNot specifiedSchema default, where declared: falseNone specified
resourceServer.allowedClientsThe chat-host clients whose tokens the gateway accepts.arrayYesNot specified
  • maxItems: 128
  • minItems: 1
  • uniqueItems: true
resourceServer.allowedClients[]Array itemAn identifier another system issues, written exactly as its issuer gives it.stringNoNot specified
  • maxLength: 512
  • minLength: 1
  • pattern: ^[^\u0000-\u001F\u007F-\u009F]+$
resourceServer.issuerThe exact issuer accepted in access-token iss claims. An https URL with no query or fragment; plain http is accepted only on a loopback host under development-loopback.stringYesNot specified
  • format: uri
  • maxLength: 2048
  • pattern: ^[Hh][Tt][Tt][Pp][Ss]?://[^/?#@\u005C\u0000-\u0020\u007F-\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]+([/?#][^\u005C\u0000-\u0020\u007F-\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]*)?$
resourceServer.jwksSourceWhere the issuer's signing keys come from. Omitted, they are read through the issuer's OpenID Connect discovery document.objectNoNot specifiedSchema default, where declared: {"type":"discovery"}None specified
resourceServer.jwksSource.documentRefAn exact secret reference: secret:file/name, resolved under secretProviders.file.root, or secret:env/NAME, resolved only when secretProviders.environment is declared.stringConditionalNot specified
  • pattern: ^(?:secret:env/[A-Z][A-Z0-9_]{0,127}|secret:file/[a-z][a-z0-9._-]{0,127})$
resourceServer.jwksSource.typestringYes
  • discovery
  • static
  • uri
None specified
resourceServer.jwksSource.uriAn absolute http or https URL with a host preserved as written, no user information, and no backslash, whitespace or control character. DNS case and equivalent IPv6 literals are permitted.stringConditionalNot specified
  • format: uri
  • maxLength: 2048
  • pattern: ^[Hh][Tt][Tt][Pp][Ss]?://[^/?#@\u005C\u0000-\u0020\u007F-\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]+([/?#][^\u005C\u0000-\u0020\u007F-\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]*)?$
resourceServer.maximumTokenLifetimeSecondsThe longest lifetime an accepted access token may declare, from its iat to its exp, in seconds.integerNoNot specifiedSchema default, where declared: 3600
  • format: uint64
  • maximum: 86400
  • minimum: 1
resourceServer.requiredScopesScopes every accepted token must carry. There is no sentinel for "any scope": a gateway that acts for a citizen always names the scope that consent was given for.arrayYesNot specified
  • maxItems: 128
  • minItems: 1
  • uniqueItems: true
resourceServer.requiredScopes[]Array itemAn RFC 6749 scope token: printable ASCII other than space, ", and \.stringNoNot specified
  • maxLength: 512
  • minLength: 1
  • pattern: ^[!#-\[\]-~]+$
resourceServer.resourceThis gateway's resource identifier: the exact URL of its MCP endpoint, which every accepted token must name as its audience. An https URL whose path is /mcp, with no query or fragment; plain http is accepted only on a loopback host under development-loopback.stringYesNot specified
  • format: uri
  • maxLength: 2048
  • pattern: ^[Hh][Tt][Tt][Pp][Ss]?://[^/?#@\u005C\u0000-\u0020\u007F-\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]+([/?#][^\u005C\u0000-\u0020\u007F-\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]*)?$
resourceServer.scopeClaimThe access-token claim that carries the granted scopes.stringNoNot specifiedSchema default, where declared: "scope"
  • maxLength: 512
  • minLength: 1
  • pattern: ^[^\u0000-\u001F\u007F-\u009F]+$
secretProvidersThe secret providers a runtime enables. A reference is resolved only by a provider declared here: secret:file/name under file.root, and secret:env/NAME only when environment: {} is present.objectYesNot specifiedNone specified
secretProviders.environmentEnables secret:env/NAME references, read from the process environment. Declared as an empty mapping: environment: {}.objectConditionalNot specifiedNone specified
secretProviders.fileEnables secret:file/name references, read from files under root.objectConditionalNot specifiedNone specified
secretProviders.file.rootAbsolute directory holding one file per secret. Each file must be a regular file owned by the runtime user, mode 0400 or 0600, with exactly one hard link.stringConditionalNot specified
  • pattern: ^/
serviceThe authored service a citizen is told about, and the registry entities its tools work over.objectYesNot specifiedNone specified
service.applicationThe proposal-mode Action and its target input, resolved by the gateway.objectYesNot specifiedNone specified
service.application.actionA local identifier: a lowercase letter, then up to 63 lowercase letters, digits, _, or -.stringYesNot specified
  • pattern: ^[a-z][a-z0-9_-]{0,63}$
service.application.targetInputThe input identifier of the input that references the citizen's own record.stringYesNot specified
  • pattern: ^[a-z][a-z0-9_-]{0,63}$
service.descriptionText a citizen reads: not blank, at most 4096 characters.stringYesNot specified
  • maxLength: 4096
  • minLength: 1
  • pattern: \S
service.detailsThe Record type holding the citizen's own record, found through the agent profile's linked lookup.objectYesNot specifiedNone specified
service.details.recordTypeA local identifier: a lowercase letter, then up to 63 lowercase letters, digits, _, or -.stringYesNot specified
  • pattern: ^[a-z][a-z0-9_-]{0,63}$
service.disclosureWhat the citizen is told about the data the chat host will see.stringYesNot specified
  • maxLength: 4096
  • minLength: 1
  • pattern: \S
service.nameText a citizen reads: not blank, at most 4096 characters.stringYesNot specified
  • maxLength: 4096
  • minLength: 1
  • pattern: \S
service.reviewBaseUrlThe citizen-facing review page; an application is reviewed and submitted there, never through the chat host. The review page's publicOrigin, with no path, query, or fragment.stringYesNot specified
  • format: uri
  • maxLength: 2048
  • pattern: ^[Hh][Tt][Tt][Pp][Ss]?://[^/?#@\u005C\u0000-\u0020\u007F-\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]+([/?#][^\u005C\u0000-\u0020\u007F-\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]*)?$

breg-review reads its own document under the same rules.

apiVersion: id.registrystack.org/formats/breg/review-runtime/v1alpha1
kind: BRegReviewRuntimeConfig
listener:
bind: 10.0.0.11:8115
tlsTermination: operator-controlled-upstream
networkExposure: private-address
publicOrigin: https://review.example.com
secretProviders:
file:
root: /run/secrets/breg-review
signIn:
issuer: https://login.example.com
clientId: <review-page-client-id>
clientKeyRef: secret:file/client-key.jwk
scopes:
- address-correction:self
registry:
baseUrl: https://registry.example.com
resource: https://registry.example.com/citizen-address-correction
action: correct-address
targetInput: address
accessProfile: citizen-review
audit:
destination: file
path: /var/lib/breg-review/audit/audit.jsonl
hashKeyRef: secret:file/audit-key

Rules that span keys or services:

  • Register publicOrigin followed by /signin/callback as the client’s redirect URI.
  • The private JWK that signIn.clientKeyRef names must carry a kid. The page always requests openid, so listing it in signIn.scopes is refused.
  • registry.resource equals the gateway’s registry.audience. registry.action and registry.targetInput match its service.application, and registry.accessProfile names the human profile.
  • The issuer must be reachable at a public address.
  • session.maximumPendingSignIns must hold every sign-in that rateLimits.globalSignIn admits within session.signInLifetimeSeconds.
  • One citizen holds at most three sessions, and a fourth sign-in ends the oldest.
  • development-loopback also drops the Secure attribute and the __Host- prefix from the session cookie.
Key pathTypeRequiredAccepted valuesConstraints
apiVersionstringYes
  • id.registrystack.org/formats/breg/review-runtime/v1alpha1
None specified
auditThe audit block every Registry Stack product shares: the hash key, then a file (the default) or stdout destination, with rotation and retention for a file.objectYesNot specifiedNone specified
audit.destinationWhere audit lines go: file or stdout.stringNo
  • file
  • stdout
Schema default, where declared: "file"
None specified
audit.hashKeyRefSecret reference to the audit hash key.stringYesNot specified
  • pattern: ^(?:secret:env/[A-Z][A-Z0-9_]{0,127}|secret:file/[a-z][a-z0-9._-]{0,127})$
audit.pathThe absolute path of the active audit file. Required for a file destination, and refused with stdout.stringConditionalNot specified
  • pattern: ^/+(?:(?:[^/.][^/]*|\.(?:[^/.][^/]*|\.[^/]+)?)/+)*(?:[^/.][^/]*|\.(?:[^/.][^/]*|\.[^/]+))$
audit.retentionDaysDays a rotated file is kept, for a file destination. Default: 90.integerNoNot specified
  • format: uint32
  • maximum: 36500
  • minimum: 1
audit.rotateBytesSize at which the active file rotates, in bytes, for a file destination. Default: 100 MiB.integerNoNot specified
  • format: uint64
  • maximum: 4294967295
  • minimum: 1048576
kindstringYes
  • BRegReviewRuntimeConfig
None specified
listenerThe listener of a runtime that declares its TLS termination and network exposure.objectYesNot specifiedNone specified
listener.bindSocket address the runtime listens on, written host:port with an IP address host ([addr]:port for IPv6).stringYesNot specified
  • maxLength: 128
  • minLength: 1
listener.networkExposureThe operator-declared private network placement of an HTTP listener.stringNo
  • container-private
  • private-address
Schema default, where declared: "private-address"
None specified
listener.tlsTerminationDeclares the trusted transport boundary for a runtime's plaintext HTTP listener. Production listeners require operator-controlled upstream TLS termination; direct plaintext is limited to the explicit loopback-only development mode.stringYes
  • development-loopback
  • operator-controlled-upstream
None specified
logLevelOperational log level when BREG_REVIEW_LOG is not set. Defaults to info; accepted values are error, warn, and info.stringNo
  • error
  • info
  • warn
Schema default, where declared: "info"
None specified
publicOriginThe browser-facing origin, such as https://review.example: an https URL with no path, query, or fragment; plain http is accepted only on a loopback host under development-loopback. The sign-in redirect URI is this origin with /signin/callback.stringYesNot specified
  • format: uri
  • maxLength: 2048
  • pattern: ^[Hh][Tt][Tt][Pp][Ss]?://[^/?#@\u005C\u0000-\u0020\u007F-\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]+([/?#][^\u005C\u0000-\u0020\u007F-\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]*)?$
rateLimitsThe page's own request limits. It reads neither peer addresses nor forwarded headers, so it cannot tell one browser from another before sign-in: a per-client limit belongs at the edge proxy.objectNoNot specifiedNone specified
rateLimits.globalSignInOne limit shared by everyone on the unauthenticated sign-in routes, /signin and /signin/callback. Default: 600 a minute, burst 120.objectNoNot specifiedNone specified
rateLimits.globalSignIn.burstRequests admitted at once before the average applies.integerYesNot specified
  • format: uint32
  • maximum: 1000000
  • minimum: 1
rateLimits.globalSignIn.requestsPerMinuteRequests admitted per minute, on average.integerYesNot specified
  • format: uint32
  • maximum: 1000000
  • minimum: 1
rateLimits.perCitizenOne limit for each signed-in person, shared by all their sessions, on every request that presents a session. Default: 120 a minute, burst 30.objectNoNot specifiedNone specified
rateLimits.perCitizen.burstRequests admitted at once before the average applies.integerYesNot specified
  • format: uint32
  • maximum: 1000000
  • minimum: 1
rateLimits.perCitizen.requestsPerMinuteRequests admitted per minute, on average.integerYesNot specified
  • format: uint32
  • maximum: 1000000
  • minimum: 1
registryThe Base Registry Engine deployment and the one access profile the page reads and submits through.objectYesNot specifiedNone specified
registry.accessProfileThe registry access profile every read and submit names.stringYesNot specified
  • pattern: ^[a-z][a-z0-9_-]{0,63}$
registry.actionThe proposal-mode Action identifier.stringYesNot specified
  • pattern: ^[a-z][a-z0-9_-]{0,63}$
registry.baseUrlThe registry deployment's base URL. An https URL with no query or fragment; plain http is accepted only on a loopback host under development-loopback.stringYesNot specified
  • format: uri
  • maxLength: 2048
  • pattern: ^[Hh][Tt][Tt][Pp][Ss]?://[^/?#@\u005C\u0000-\u0020\u007F-\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]+([/?#][^\u005C\u0000-\u0020\u007F-\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]*)?$
registry.resourceThe RFC 8707 resource indicator the person's access token names.stringYesNot specified
  • maxLength: 512
  • minLength: 1
  • pattern: ^[A-Za-z][A-Za-z0-9+.-]*:(?:[A-Za-z0-9._~:/?\[\]@!$&'()*+,;=-]|%[0-9A-Fa-f]{2})*$
registry.targetInputThe reference input naming the record the Proposal changes. The page reads that record under the person's own token before it offers the submit form, because the registry does not tie a request's target to its requester.stringYesNot specified
  • pattern: ^[a-z][a-z0-9_-]{0,63}$
secretProvidersThe secret providers a runtime enables. A reference is resolved only by a provider declared here: secret:file/name under file.root, and secret:env/NAME only when environment: {} is present.objectYesNot specifiedNone specified
secretProviders.environmentEnables secret:env/NAME references, read from the process environment. Declared as an empty mapping: environment: {}.objectConditionalNot specifiedNone specified
secretProviders.fileEnables secret:file/name references, read from files under root.objectConditionalNot specifiedNone specified
secretProviders.file.rootAbsolute directory holding one file per secret. Each file must be a regular file owned by the runtime user, mode 0400 or 0600, with exactly one hard link.stringConditionalNot specified
  • pattern: ^/
sessionobjectNoNot specifiedNone specified
session.maximumLifetimeSecondsThe longest a session lasts. A session also ends when the access token it holds expires, whichever comes first. Default: 3600.integerNoNot specifiedSchema default, where declared: 3600
  • format: uint64
  • maximum: 86400
  • minimum: 60
session.maximumPendingSignInsThe most sign-ins in progress the page holds at once. It must hold every sign-in rateLimits.globalSignIn admits within signInLifetimeSeconds. Default: 10000.integerNoNot specifiedSchema default, where declared: 10000
  • format: uint32
  • maximum: 1000000
  • minimum: 1
session.maximumSessionsThe most signed-in sessions the page holds at once. Default: 10000.integerNoNot specifiedSchema default, where declared: 10000
  • format: uint32
  • maximum: 1000000
  • minimum: 1
session.signInLifetimeSecondsHow long a started sign-in may take to return from the provider. Default: 600.integerNoNot specifiedSchema default, where declared: 600
  • format: uint64
  • maximum: 3600
  • minimum: 60
signInThe OpenID Provider the page signs people in with, and the confidential client it authenticates as.objectYesNot specifiedNone specified
signIn.clientIdThe page's client identifier at the provider.stringYesNot specified
  • maxLength: 512
  • minLength: 1
  • pattern: ^[^\u0000-\u001F\u007F-\u009F]+$
signIn.clientKeyRefSecret reference to the client's private JWK, used for private_key_jwt client authentication, under a declared provider.stringYesNot specified
  • pattern: ^(?:secret:env/[A-Z][A-Z0-9_]{0,127}|secret:file/[a-z][a-z0-9._-]{0,127})$
signIn.issuerThe provider's issuer. An https URL with no query or fragment; plain http is accepted only on a loopback host under development-loopback, because the page sends its client credentials to the token endpoint.stringYesNot specified
  • format: uri
  • maxLength: 2048
  • pattern: ^[Hh][Tt][Tt][Pp][Ss]?://[^/?#@\u005C\u0000-\u0020\u007F-\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]+([/?#][^\u005C\u0000-\u0020\u007F-\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]*)?$
signIn.scopesScopes requested beside openid, such as the review scope the registry profile requires. The page always requests openid, so the list does not name it.arrayYesNot specified
  • maxItems: 16
  • minItems: 1
  • uniqueItems: true
signIn.scopes[]Array itemAn RFC 6749 scope token: printable ASCII other than space, ", and \.stringNoNot specified
  • maxLength: 512
  • minLength: 1
  • pattern: ^[!#-\[\]-~]+$

Check each document with the binary you will serve, then start both:

Terminal window
breg-mcp --runtime-config /etc/breg-mcp/runtime.yaml check
breg-review --runtime-config /etc/breg-review/runtime.yaml check
breg-mcp --runtime-config /etc/breg-mcp/runtime.yaml serve
breg-review --runtime-config /etc/breg-review/runtime.yaml serve

check reads the file offline: no secret, no socket, no audit file. It exits 0 when the file is accepted, 1 when something is refused, 2 on a usage error, and 3 when the file cannot be read. --format json prints one report, --deny-warnings makes a warning exit 1, and --environment substitutes ${NAME} expressions first.

serve then refuses an unsafe or missing secret, or an unwritable audit directory, before it binds. Only the first real call proves the issuer and BReg accept the configuration.

Neither service terminates TLS. Your proxy forwards plain HTTP to the private listeners, and:

  • Serves the review page at exactly publicOrigin.
  • Keeps the gateway’s Host, or rewrites it to the authority of resourceServer.resource. Any other Host gets 403.
  • Never adds an Origin header, which the gateway refuses before it verifies the token, and passes Authorization unchanged.
  • Rate limits by client address, more tightly on /signin and /signin/callback. The review page reads no peer address, so its rateLimits.globalSignIn is shared by everyone.

GET /health answers 200 {"status":"alive"}. GET /ready answers 200 {"status":"ready"} while the audit journal is writable, and 503 {"status":"not-ready"} otherwise. Neither probe calls BReg or the issuer.

Each release publishes both services as linux-amd64 binaries, verified as Obtain the runtime describes, and as images under ghcr.io/registrystack/. Deploy both from one tag, and images by digest.

Each image runs as the Distroless nonroot user and reads /etc/<service>/runtime.yaml. Mount configuration and secrets read-only, and a volume at /var/lib/<service> for the journal. Bind 0.0.0.0 with networkExposure: container-private. The image has no shell, so probe it from your platform.

Every credential is a reference. secret:file/<name> reads a file under secretProviders.file.root, and secret:env/<NAME> reads a variable once secretProviders.environment is declared. Secret files follow the ownership and mode rules in Create the secret files. Each service needs its own private JSON Web Key (JWK) and an audit key of at least 32 bytes.

Secrets are read at startup. To rotate a client key, register the new public key beside the old one, replace the file, restart, and then retire the old key. A fetched issuer key set picks up a new key by itself; with jwksSource.type: static, add it and restart before the issuer uses it.

Keep the audit key stable, because it keys the pseudonyms and the gateway’s retry identity. To change it, restart with no retry outstanding and write to a fresh audit.path.

Each service writes its own journal through the shared audit writer, which owns rotation, retention, and fail-closed behaviour. BReg audits the delegated calls separately. Give each process its own audit.path on durable storage, and ship sealed files before audit.retentionDays removes them.

Each gateway tool call ends with an outcome: ok, refused with no registry effect, or unfinished when a sent start or edit has an unknown effect. Citizens and clients appear only as keyed pseudonyms. No field value, tool argument, token, or cookie is written. When the journal refuses an entry, the gateway answers service-unavailable and the review page audit-unavailable.

Both services write JSON lines on standard output. BREG_MCP_LOG or BREG_REVIEW_LOG sets the level to error, warn, or info, the default; any other value exits 2. A refused configuration exits 1 on standard error. Later startup failures go to standard output from breg-mcp and to standard error from breg-review, so collect both.

ServiceLevelMessage
breg-mcpinfotool call, with request_id, tool, and outcome
breg-mcpwarnthe access-token key set is unavailable
breg-mcperrortool audit request refused or tool audit response refused
breg-reviewwarna rate limit refused a request
breg-reviewwarnthe registry declined a review request or the registry could not answer a review
breg-reviewerrorAny message ending could not be audited

Neither service logs a token, secret, cookie, or field value.

Run the new binary’s check before you replace the old one. Both services finish requests in flight on SIGTERM or SIGINT. The gateway keeps no state, but the review page holds sessions in memory, so a restart signs every citizen out. Run one review page instance, or pin each browser to one, because every limit counts per instance. After a registry package changes the Action, the review page answers older drafts with 409 action-changed.

A failed tool call answers {"error":{"code":"<code>","message":"<text>"}}, with a traceId when BReg supplied one. Each code has one fixed message:

CodeCause
invalid-argumentsThe arguments do not fit the tool
record-not-resolvedBReg returned no single Record for the citizen
not-foundNo such application for this citizen
application-not-editableThe application is no longer a draft
stale-applicationThe gateway compared revisions and found the application or its Action definition changed
change-refusedBReg refused a required condition, a current-state conflict, or an expired idempotency receipt
idempotency-conflictAn earlier request with the same key is running or differed
not-permittedThe Action refused the request
authorization-failedA credential is missing, unusable, or no longer accepted; signing in again resolves it
authorization-refusedThe issuer refused delegated access or granted too few scopes; signing in again alone may not resolve it
registry-unavailableBReg, the issuer, or the task authority did not answer
service-unavailableThe gateway cannot record or run the call
unexpected-responseBReg answered in a form the gateway cannot use

change-refused establishes neither a stale revision nor a withdrawn grant. BReg answers a withdrawn grant with the same value-free 412 as any other failed condition, so the gateway cannot tell the two apart and never reports a withdrawn grant as stale-application.

Generate one startAttemptId for each application the citizen intends, and reuse it on every retry, including after an uncertain answer. The same ID replays the original Start, and a new ID opens another application even with identical input. The task authority must reissue the original grant for the retry, because a new or widened grant cannot replay the earlier Start.

A request refused before any tool runs gets an RFC 9457 problem:

Statuscode
401unauthorized or invalid-token, with a WWW-Authenticate challenge
403insufficient-scope, or forbidden for a wrong Host or any Origin header
404not-found
429rate-limited, with Retry-After
503temporarily-unavailable

Whatever the chat host does:

  • The gateway never submits, cancels, or applies a Proposal, or writes a Record. Its lint configuration disallows those client methods, and a boundary check proves it.
  • BReg holds the same line: the gateway’s task-grant profile cannot write Records and stays within the grant.
  • The target comes from the citizen’s own Record. BReg checks the targets row boundaries on every Start, edit, and submit, and takes ownership from the verified caller.
  • The chat host’s token is never forwarded, and no delegated token outlives the citizen’s own.
  • BReg checks the grant’s status before every Proposal read and change.
  • The review page re-reads the target under the citizen’s own token before it submits.
  • BReg keeps the Proposal state and the application evidence. Neither the gateway nor the review page keeps a parallel workflow, and where the Action requires review, external policy decides it. BReg then applies the exact frozen Plan, automatically by default under its restricted system grant or manually when you configure that. See Actions and Proposals.
  • Neither service retries a mutation on its own. After an uncertain submit the citizen retries from the retained view under the same key, and a later read does not settle an uncertain command or follow a successor submission.
  • Boundaries, linked reads, target scope, and Proposal permissions belong in the registry project, not in the gateway or review page configuration.

The configurable, source-built registry-mcp service can bind this same citizen provider, or a separate Casework delegated staff reader. Keep breg-mcp for existing citizen deployments. Config checks validate documents offline; a passing check does not prove an issuer exchange or a registry grant.

Before you operate registry-mcp, plan for what it does not provide:

  • It is built from source only. No numbered release asset, installer, rstack component, or container image ships it, so build it from the exact source revision you operate. breg-mcp remains the maintained citizen deployment.
  • Citizen and staff access need separate configurations, each with its own resource, admitted clients, scopes, and credentials. The config check refuses one configuration that binds both the BReg citizen provider and the Casework staff reader, and the service never forwards the caller’s inbound token as a provider credential.
  • The Adapter binding is experimental. It needs a compatible Adapter that exports an executable effective contract (adapter effective-contract), and it runs only the configured operations that contract serves as GET or as explicitly read-only POST. The config check refuses a configured write.
  • dataClass: non-personal is your own unchecked attestation. It is not a data classifier, a grant to read personal data, or a substitute for source authorization. Person-level access and external effects are outside what the binding supports.
  • The Adapter binding reads one machine token from the secret reference you supply, once at startup. Nothing renews it: before it expires, replace the referenced token and restart the service. Do not lengthen the token’s lifetime as a workaround.