MCP for integrations

Provision tenants, tokens and users programmatically (B2B)

For server integrations that create Ethora apps for customers: a B2B token, one-call orchestrators, app token rotation and asynchronous batch user provisioning over MCP.

Tenant-actor auth One-call app bootstrap Batches of up to 100 users
Ethora MCP server

In 30 seconds

B2B mode is the Ethora MCP server’s tenant-actor mode: the session authenticates with a B2B server token (a JWT with type=server) sent as the x-custom-token header, and can create apps, mint app tokens, provision rooms, index sources, enable agents and batch-create users for the tenants it owns. It exists for server integrations and automation, not for the hosted assistant session, which stays in user mode.

Use this if

  • you are a partner or platform provisioning a chat workspace per customer
  • you need app tokens for backend SDKs and a way to rotate or revoke them
  • you onboard whole teams in one job

Best for: integrators, resellers and platform teams automating tenant onboarding.

Step by step

1

Switch the session to B2B mode

ethora-configure { b2bToken } then ethora-auth-use-b2b, or start the stdio server with ETHORA_B2B_TOKEN set; on the hosted endpoint a B2B token in the Bearer header selects the mode itself. ethora-status confirms the mode without echoing the value. Run this from your own automation, not a shared assistant session.

# stdio server in B2B mode for a provisioning script
ETHORA_API_URL=https://api.chat.ethora.com/v1 ETHORA_B2B_TOKEN="<your B2B token>" npx -y @ethora/mcp-server
2

Create the tenant in one call

ethora-b2b-app-provision { displayName, tokenLabels, rooms, enableBot, botPrompt, llmProvider, llmModel } creates the app, mints one app token per label, provisions the rooms, then configures and enables its bot, returning a per-step log with the appId and the token values (shown once). ethora-b2b-app-bootstrap-ai { displayName, crawlUrl, docs, agentPrompt } does app plus RAG sources plus bot instead. ethora-b2b-app-create { displayName } makes a bare app.

3

Mint, list, rotate and revoke app tokens

ethora-app-tokens-create-v2 { appId, label } returns the secret exactly once with its tokenId. ethora-app-tokens-list-v2 shows metadata only. ethora-app-tokens-rotate-v2 { tokenId, label } revokes the old token and issues a replacement in one step; anything still using the old one fails at once. ethora-app-tokens-revoke-v2 { tokenId } revokes with no replacement.

4

Provision users in batches

ethora-users-batch-create-v2 { usersList, bypassEmailConfirmation } enqueues 1 to 100 users as a background job (HTTP 202) and returns { jobId, statusUrl }. Conflicts such as an email already registered are reported per user, not by failing the batch. ethora-wait-users-batch-job-v2 { jobId, timeoutMs } blocks until it completes or fails.

You: Create the 40 users from onboarding.csv without email confirmation and report conflicts.

Assistant: ethora-users-batch-create-v2 { usersList: [40 entries], bypassEmailConfirmation: true } ... 202, jobId 9a4c.
ethora-wait-users-batch-job-v2 { jobId: "9a4c", timeoutMs: 120000 } ... completed, 38 created, 2 conflicts.
5

Generate the runbook and env files for your own code

ethora-generate-b2b-bootstrap-runbook { displayName, crawlUrl } prints the tool calls in order with example payloads; documentation only. ethora-generate-env-examples { target } returns .env.example templates for the chat component, the backend SDK and this MCP server. To run the sequence, use ethora-run-recipe { recipeId: “b2b-bootstrap-ai” } or the orchestrators above.

The tools this uses

Names and descriptions come from the server’s own tool list. Read-only tools are safe to auto-approve; destructive ones make your client ask first. Full reference.

ToolNameWhat it doesAccess
Use B2B Authethora-auth-use-b2bSwitch this session’s active auth mode to B2B, so subsequent calls authenticate as a tenant actor via the x-custom-token header.write
Create App (B2B)ethora-b2b-app-createCreate a new Ethora app (tenant) server-side using B2B auth - the partner/integrator equivalent of ethora-app-create.write
Provision App (B2B)ethora-b2b-app-provisionOne-call B2B orchestrator: create an app, mint one or more app tokens, provision default chat rooms, then configure and enable its AI bot.write
Bootstrap AI App (B2B)ethora-b2b-app-bootstrap-aiOne-call B2B orchestrator: create an app, set it as the current context, index RAG sources, then configure and enable its AI bot.write
Create App Tokenethora-app-tokens-create-v2Mint a new app token for an app.write
List App Tokensethora-app-tokens-list-v2List the app tokens issued for an app - metadata only (tokenId, label, created/rotated timestamps, status); the secret token values are never returned (only shown...read-only
Rotate App Tokenethora-app-tokens-rotate-v2Rotate an app token: revoke an existing token and issue a replacement in one step.destructive
Revoke App Tokenethora-app-tokens-revoke-v2Permanently revoke an app token by tokenId - it stops working immediately; any client, SDK, or MCP session still using it gets auth failures.destructive
Batch Create Usersethora-users-batch-create-v2Provision many Ethora users (1-100) in one asynchronous batch job - the bulk equivalent of ethora-user-register.write
Wait for Users Batch Jobethora-wait-users-batch-job-v2Block until a users batch job reaches a terminal state (completed or failed) or timeoutMs - read-only polling wrapper around ethora-users-batch-job-v2.read-only
Generate B2B Bootstrap Runbookethora-generate-b2b-bootstrap-runbookGenerate a human-readable runbook listing this server’s tool calls in the right order for a B2B bootstrap, with example payloads.read-only
Generate Env Examplesethora-generate-env-examplesGenerate .env.example templates for the three common Ethora integration targets: the frontend chat component, the backend SDK, and this MCP server.read-only

One customer, fully provisioned

“Provision a tenant called Northwind Brokers with app tokens labelled backend and mobile, rooms General and Claims, and an enabled bot that answers questions about claim status. Then create the 40 users from the attached CSV without email confirmation, tell me which emails already existed, and list the tokens.”
  1. ethora-auth-use-b2b {}
  2. ethora-b2b-app-provision { displayName: "Northwind Brokers", tokenLabels: ["backend", "mobile"], rooms: ["General", "Claims"], enableBot: true, botPrompt: "You help brokerage staff check claim status." }
  3. ethora-users-batch-create-v2 { usersList: [ { email: "[email protected]", firstName: "A", lastName: "Lee" }, ... 39 more ], bypassEmailConfirmation: true }
  4. ethora-wait-users-batch-job-v2 { jobId: "9a4c2d7e", timeoutMs: 120000, intervalMs: 3000 }
  5. ethora-app-tokens-list-v2 { appId: "66f4e0f1a2b3c4d5e6f7a8b9" }

A tenant app with two rooms, two labelled app tokens from the provision log, a running bot, 38 new users and a conflict list for the other two.

Good to know

FAQ

Is there an enterprise MCP server for provisioning chat tenants?

Yes. The Ethora MCP server has a B2B group of tools for server integrations: create tenant apps, mint and rotate app tokens, provision rooms, index sources, enable an agent and batch-create users, plus one-call orchestrators that do most of that in a single request. The same server runs self-hosted.

What is a B2B token on Ethora?

A server-side JWT with type=server that authenticates an integration as a tenant actor through the x-custom-token header. Configure it with ethora-configure or the ETHORA_B2B_TOKEN variable and switch with ethora-auth-use-b2b, or send it as a Bearer header to the hosted endpoint, which detects the mode from the token type.

How many users can I create at once over MCP?

Up to 100 per call to ethora-users-batch-create-v2. The call enqueues a background job and returns a jobId and statusUrl; duplicates and other per-user problems are reported individually rather than failing the batch. For larger onboardings, issue several batches and wait on each.

How do I rotate an app token without breaking clients?

ethora-app-tokens-rotate-v2 revokes the old token and issues a new one in the same step, so anything still using the old value fails immediately. If your clients cannot switch at once, call ethora-app-tokens-create-v2 first, roll the new secret out, then ethora-app-tokens-revoke-v2 on the old tokenId.

Does B2B mode work on the hosted MCP server?

Yes, but for your own automation rather than a shared assistant session. Send the B2B token as a Bearer header on the open endpoint or configure it in a stdio session. Everyday use in Claude, ChatGPT or Cursor stays in user mode, and the agents and rooms routes reject app tokens.

Get started

Script your tenant onboarding

Create a free account to try the tools in user mode, then read the B2B group in the reference and generate the runbook.

Free tier available Revocable API keys Self-host with the monoserver