room.secrets) manages room-scoped, identity-scoped credentials. Use room secrets when a credential belongs to a room, a room participant, or a room service identity rather than to your whole project.
Room secrets let you keep sensitive values out of your manifest and source code while still making them available to the specific runtime or identity that needs them. When a room secret is injected into a service, the service process can use it at runtime, but the model does not automatically see the value unless your code, tools, logs, or prompts explicitly pass it through.
Common examples include:
- an OAuth token for a user
- a room-local API key for a toolkit or room service
- a delegated credential passed from one participant to another
- a secret used to build request headers for an MCP connection
Before you start
These examples assume:- the MeshAgent CLI is installed
- you have already authenticated with
meshagent setup - you have an active project selected
myroom does not exist yet, create it first:
bash
- you need permission to join that room
- your room connection must include the
secretsAPI permission - if you use
--for-identityto store a secret for another identity, you also need anadminAPI grant
meshagent room secret set, ask a project admin to grant room access or store the secret on behalf of the target identity.
What room secrets are
Room secrets are stored inside the context of a room and are tied to the caller’s participant identity, or to another identity when an admin uses--for-identity.
That means room secrets are not just “smaller project secrets.” They are a separate system built for:
- participant-specific credentials
- room-local service credentials
- live request/provide flows
- delegation between identities
- OAuth storage and refresh
How room secrets are different from other secret types
- Project
keyssecrets are shared across the project and are meant for project services. - Image pull secrets are only for pulling private images.
- Room secrets belong to a room and usually to a specific identity inside that room.
Room secrets vs tokens
Tokens and secrets often appear in the same service spec, but they do different things:- a token defines what MeshAgent APIs the service has permission to use
- a secret gives the service an external credential it can use securely
How a room service reads a secret
Service and ServiceTemplate environment entries support three different sources:
value:for a plain literal stringtoken:for a MeshAgent participant tokensecret:for a room secret reference
secret: entry looks like this:
yaml
identity and id, then injects the secret value into the named environment variable.
Room secret workflow for a room service
Step 1: Store the room secret
Create a room secret for the service identity that should read it:bash
support-agent identity, not for your own identity.
Step 2: Reference the room secret in a service
Create a file namedroom-secret-demo.yaml:
Step 3: Deploy the room service
bash
SERVICE_API_TOKEN environment variable for the support-agent identity, and the startup script checks that the variable is present before starting meshagent process join. The example is only showing how the secret reaches the agent. Any third-party integration that uses that token is a separate step.
Packaging a ServiceTemplate With Installer-Provided Secrets
Packaging a ServiceTemplate With Installer-Provided Secrets
ServiceTemplate is the secure install-time input pattern for cases where each installer should provide their own secret.It does not create a new secret type. Instead:- the template variable is the input field shown to the installer
- Powerboards stores that value as a room secret
- the service reads the stored room secret later with
secret:
- Add a
ServiceTemplatevariable so the installer can paste the value. - Mark that variable with
meshagent.secret.*annotations so Powerboards stores the value as a room secret. - Have the service read the stored room secret with
secret:.
- the installer sees a
service_api_tokeninput field - Powerboards stores that value as a room secret owned by
support-agent - the service reads that stored room secret at runtime through
secret:
meshagent service create-template does not automatically create room secrets from these annotations. Those annotations are for Powerboards and similar installers. If you are deploying from the CLI, create the room secret yourself with meshagent room secret set.How secret delegation and identity scoping work
Room secrets are scoped by participant identity, and some flows also include adelegated_to value.
Important implications:
- If you create a secret with
--for-identity support-agent, that secret belongs tosupport-agent. - Listing secrets as yourself will not show secrets that belong to another identity.
- Delegated secrets may require
--delegated-towhen reading or deleting them. - Admin-only flows can store secrets on behalf of another identity with
for_identity.
Advanced room-secret capabilities
Beyond basic set/get/list/delete, the Secrets API also supports:request_secretprovide_secretdelete_requested_secretrequest_oauth_tokenprovide_oauth_authorizationget_offline_oauth_tokendelegated_tofor_identity
meshagent mcp http --header-secret ... can resolve a room secret into an HTTP header. For a full example, see Supabase MCP.
If you need OAuth token request, storage, refresh, or offline access, see OAuth with Room Secrets.