createEmbedMcpToken in the @omni-co/embed SDK. See Embed user MCP tokens for setup steps.
Parameters
createEmbedMcpToken accepts the same identity and role parameters as a signed embed URL, plus the parameters that tell the SDK where to send the request. Each identity parameter works the same as the embed URL parameter with the same name.
A token updates the embed user the same way an embed URL does, meaning Omni removes groups, attributes, roles, and entity settings that the token doesn’t include for every session. See How sessions update embed users for the full list.
Parameters that only shape an iframe, such as
contentPath, theme, uiSettings, linkAccess, and mode, aren’t accepted.
- Required parameters only
- Custom domain (organizationShortId)
Example
createEmbedMcpToken call with only the required parameters, for a non-custom domain:Return value
Error codes
createEmbedMcpToken can throw two types of errors: a plain Error and EmbedMcpTokenError.
Plain errors
The SDK checks your parameters before it sends a request to Omni. It throws a plainError if:
externalId,name, orsecretis missing- You pass both
hostandorganizationName, or neither of them - You don’t pass
connectionRolesormodelRoles - You use a custom domain and don’t pass
organizationShortId
EmbedMcpTokenError
AnEmbedMcpTokenError means that Omni refused the request. The error’s code property contains the reason, which is one of the values in the following table.
If you send a direct request instead of using the SDK, the reason is in the response’s error_reason property, or in the error property if error_reason is missing.

