ByteChef LogoByteChef
Embedded

MCP Servers

Expose component actions and integration workflows as MCP tools for your connected users' AI agents.

MCP Servers overview

An embedded MCP server exposes component actions and integration workflows as tools over the Model Context Protocol, so an AI agent in your product can act in your connected users' accounts. Each request to the server is made on behalf of one connected user, identified by a JWT signed with your Signing Key, and tools run with that user's connections.

MCP servers are managed under Embedded → MCP Servers. Creating, editing and deleting servers, their components, tools and workflows, and switching tools on or off, require a tenant admin. Editing checks the MCP_EDIT permission, which only a tenant admin holds for embedded servers. Connected users can only switch tools and workflows on or off, and set workflow inputs, for their own integration instances (see Which tools a user's agent sees).

Servers are scoped to an environment. The list shows the servers of the environment selected in the application sidebar.

Server list

Each row in the list shows:

ElementDescription
NameThe server name.
Tool countsThe number of component tools (component actions, across all components) and workflow tools (one per workflow) the server exposes.
TagsTags assigned to the server. Click + to add one.
Enabled switchTurns the server on or off.
Last modifiedModified at with a date and time, or No modifications.
⋮ menuEdit (rename the server) and Delete (after you confirm).

Use the left sidebar to filter the list by Components (servers that expose a component), Integrations, or Tags.

Creating an MCP Server

  1. Click New MCP Server in the top-right corner (Create MCP Server when the list is empty).
  2. Enter a Name.
  3. Click Save.

The server is created empty and disabled. Add the components and workflows it exposes from the server row (see below), then turn it on with its Enabled switch. A new server requires authentication (see Authentication).

Adding components and workflows to a server

Expand the server row. It has Component Tools, Workflow Tools and Connect tabs.

Component tools

  1. On the Component Tools tab, click Add Component.
  2. In Select Component, pick the component.
  3. In Select Tools from <component>, choose which of its actions are exposed as tools and configure each tool's parameters.
  4. Save the dialog.

For each exposed action, you choose which parameters you fix yourself and which the connected agent fills at call time with the fromAi(...) expression, the same mechanism used to attach tools to an AI Agent. See Supplying tool parameters with fromAi for the syntax.

The tool forms offer Let AI fill required, new tools start with their empty required fields set to fromAi(...), and when a tool runs, a field without a value gets its default: the built-in one for a component tool, the default of the trigger's input schema for a workflow tool. A value you saved wins over the agent's, and a field you cleared stays empty. For a select whose options come from the connection, the options offered to the agent are read from the connected user's own connection when the tools are listed. See Let AI fill required and Defaults at call time.

Workflow tools

  1. On the Workflow Tools tab, click Add Workflows.
  2. In the Basic step, pick the Integration, Integration Version and Integration Instance Configuration.
  3. In the Workflows step, switch on the workflows to expose.
  4. Save the dialog.

Only workflows with a New Workflow Call trigger are eligible. A configuration without one shows "No tool-eligible workflows found". A workflow that is off in the configuration is listed as Turned off in the configuration and cannot be added. Adding a workflow does not turn it on and does not change the configuration. Its inputs and connections are set in the instance configuration, not on the MCP server.

Each switched-on workflow shows its tool settings under its row: Tool Name, Tool Description and the fields of its New Workflow Call trigger, the same mapping that Configure opens later. Tool settings are stored per workflow. A blank Tool Name defaults to the workflow's label in upper case, with every run of characters other than letters, digits, _ and - replaced by _ (Send Email becomes SEND_EMAIL).

The Workflow Tools tab groups workflows by instance configuration. Each configuration row has a ⋮ menu with Edit Workflows and Delete. To move a configuration to another integration version, change it under Configurations. Click a workflow's name to see its executions. Each workflow has a Configure button (the tool's property values), a switch, and a ⋮ menu with Edit (its connections and inputs in the instance configuration) and Delete.

Delete removes a workflow from this server only. It stays in the instance configuration, with its other triggers. Deleting the whole server works the same way: the instance configurations it used, and their workflows, are kept.

Exposing automations

A server can also expose workflows of an automation project as tools. The Workflow Tools tab shows an Automations section below the integrations.

  1. Click Add Automations.
  2. In the Basic step, pick the Automation and its Automation Configuration. Only configurations of the server's environment are listed.
  3. In the Workflows step, switch on the workflows to expose. Only workflows with a New Workflow Call trigger are listed. A workflow that is off in the configuration is listed as Turned off in the configuration and cannot be added. Adding a workflow never turns anything on and never changes the configuration.
  4. Each switched-on workflow shows its tool settings under its row: Tool Name, Tool Description and the fields of its New Workflow Call trigger, the same mapping that Configure opens later. The name defaults to the workflow's label in upper case with spaces and other punctuation replaced by _ (Send Email becomes SEND_EMAIL), and the description to the workflow's description.
  5. Save the dialog.

Each automation is listed with its project name, its configuration and the version it releases. Its ⋮ menu has Edit Workflows and Delete. Expand it to see its workflow tools. Click a tool's name to see its executions. Each tool row has:

  • a Configure button, which opens the tool's properties popover. Set the input mapping there: fix a value, or let the agent fill it at call time with fromAi(...). See Supplying tool parameters with fromAi.
  • a switch that turns the tool on or off for the whole server.
  • a ⋮ menu with Delete, which removes the tool from this server only.

A tool is marked Not available while its configuration or workflow is off, or when the workflow has lost its New Workflow Call trigger.

A connected user gets the tool only after they have activated the automation. When you later add workflows to an automation you already attached, only users who already have the server get them, switched on or off as the server is for them. Changing a tool's name, description or input mapping, or switching it off and on, adds no users.

There are two separate switches:

SwitchWhat it controls
The automation's own switchOnly the automation's event triggers, such as a webhook or a schedule.
The MCP switchWhether the tool is offered to the user's AI agents.

The MCP switch is set in these places:

  • An admin sets it per server on the MCP Servers tab in Connected Users.
  • The connected user sets it once per automation, across all servers, with the public endpoint POST /automation/workflows/{workflowUuid}/mcp/enable (and DELETE to turn it off). The variant /{externalUserId}/automation/workflows/{workflowUuid}/mcp/enable does the same for a named external user.
  • The connected user sets it with the Available to AI agents switch in the SDK or the Automation Hub. The switch is shown only while an MCP server offers the automation: the tool is switched on for the server, and the configuration and its workflow are on.

An automation whose only trigger is the workflow call is a Tool only automation. It shows only the Available to AI agents switch, and the connected user's Automations tab marks it Tool only.

If you turn the workflow off in the configuration, the tool is removed for everyone.

If the automation needs a connection the user has not set, the tool is still listed. Calling it returns connection_required, and the message tells the user to connect the app for the automation in your application. There is no setup link.

Connect tab

The Connect tab shows the Server URL. Click the refresh button to generate a new secret key. The old URL stops working immediately.

Enabling and disabling individual tools

Expand a server row, then expand one of its components to see the tools it exposes. Each tool has a Configure button, which opens the tool's parameters, a switch, and an ellipsis (⋮) menu with Delete.

  • Switch on - the tool is offered to agents.
  • Switch off - the tool is not offered to any agent and cannot be called, whatever a connected user has enabled for themselves.

The switch applies to the whole server, for every connected user. When you edit a component's tools, each tool keeps its switch state. Newly added tools start switched on.

Connecting to a server

Each server is reachable at /api/embedded/{secretKey}/mcp. A request names its environment with the X-Environment header (PRODUCTION when omitted), and it must be the server's own environment: an authenticated request for another environment is rejected with 401, and so is an anonymous one that sends the header with another environment. Send X-Environment on every request to a Development or Staging server, and sign the JWT with that environment's signing key.

Authentication

Each server has a Require authentication setting (authenticationRequired), on for every newly created server. The MCP Servers page has no control for it. It can be changed only through the updateEmbeddedMcpServer GraphQL mutation, which a tenant admin can call.

  • On - the request's Authorization header must carry a JWT that your backend signed with one of your Signing Keys for the server's environment. Its kid header identifies the signing key and its sub claim carries the external user id. The JWT resolves the caller to a connected user, created on first use. A disabled connected user is rejected. A request without a valid JWT is rejected with 401. An API key is not accepted.
  • Off - the endpoint serves the request using the URL secret alone. No credential is required, any token sent is ignored, and no ConnectedUser is resolved. A component tool that needs a connection, and every workflow tool, then fails with an error saying the tool requires a connected user and that authentication must be enabled on the MCP server.

A disabled server answers a request carrying a valid JWT (or any request, when authentication is off) with 403 and the JSON body {"error": "server_disabled", "message": "…"}, and no sign-in challenge. A request without a valid JWT to a server that requires one still gets 401.

Servers created before this setting existed default to off, so they keep working unchanged. Servers that already had Enforce tool authorization (enforceToolAuthorization) on default to on. The server rejects Enforce tool authorization without Require authentication, because an anonymous caller has no identity to authorize.

Example: connecting from your agent

The endpoint speaks the MCP Streamable HTTP transport. With the official TypeScript SDK (@modelcontextprotocol/sdk), your backend connects on behalf of one connected user like this:

import {Client} from '@modelcontextprotocol/sdk/client/index.js';
import {StreamableHTTPClientTransport} from '@modelcontextprotocol/sdk/client/streamableHttp.js';

const serverUrl = new URL('https://your-bytechef-host.example.com/api/embedded/<secret-key>/mcp');

const transport = new StreamableHTTPClientTransport(serverUrl, {
    requestInit: {
        headers: {
            Authorization: `Bearer ${jwtToken}`, // signed for this user, with sub = 'user-123'
            'X-Environment': 'PRODUCTION',
        },
    },
});

const client = new Client({name: 'my-product-agent', version: '1.0.0'});

await client.connect(transport);

const {tools} = await client.listTools();

Mint a fresh JWT per user and per session, as for the SDK. A client that does not send X-Environment reaches the server only if it is a Production server.

When a tool needs the user's account

A tool that needs a connection does not run until the ConnectedUser has connected that integration in the request's environment. Until then, calling it returns a connection_required result instead:

{
  "error": "connection_required",
  "message": "The googleMail integration is not connected for this user. To connect, visit: ...",
  "setupUrl": "https://your-bytechef-host.example.com/connect.html?token=..."
}

This applies to component tools and integration workflow tools. An automation tool answers connection_required without a link: its message tells the user to connect the app for the automation in your application.

The message asks the agent to show the link to the user as a markdown link labelled Connect <component> rather than as the raw URL. A host that renders tool results itself can read setupUrl directly, for example to show a Connect button.

setupUrl opens ByteChef's hosted connect page, which shows the same Connect dialog your app uses. Its token identifies the user, the integration and the environment, and is valid for 10 minutes. An expired link shows Link Expired, and the next call to the tool returns a fresh one. When the user closes the dialog, the page tells them they can close the tab and return to the application that sent them there.

Which tools a user's agent sees

Tools you switched off on the server are never listed. A workflow tool is listed only while its workflow is enabled in the instance configuration. An automation tool is listed only while its workflow is on in the automation configuration and the user has turned its MCP switch on (see Exposing automations).

Before a user connects an integration, the server lists every remaining tool it exposes for that integration. Workflow tools, and component tools whose component needs a connection, return connection_required when called. A component tool that needs no connection runs directly.

Once the user has connected, the server lists only the tools that user has enabled. For a workflow tool, the user's switch for that tool decides, independently of the workflow's other triggers: switching the tool off does not stop the workflow's webhook or schedule, and switching the workflow off on the user's integration does not hide the tool. Tools start disabled. When you later add a component tool or a workflow to the server, or switch one back on, users who already have the server get it straight away, switched on unless the server is switched off for them. The user enables them on the Tools tab of the Connect dialog, which lists the server's component tools and workflow tools for that integration. The list appears only when an MCP server exposes something for the integration; it is shown as a tab when the integration also has regular workflows, and on its own otherwise.

To switch a server's tools off for a single user, use the MCP Servers tab in Connected Users.

Workflow tool runs

Calling a workflow tool starts a run of the workflow and waits up to 300 seconds for it to finish. If it does not finish in time, the tool call fails with an error saying the job did not finish within 300 seconds.

When the run finishes, the tool returns the workflow's output. A failed run returns its error. A run that stops before it finishes returns its jobId and a status:

StatusMeaning
approval_requiredThe run is paused waiting for a human approval decision.
suspendedThe run is paused and resumes later on its own.
stoppedThe run was stopped before it finished.

Recorded tool calls

Every component tool and workflow tool call made through an embedded MCP server is recorded, including calls that return connection_required and workflow runs that time out. The records are listed under Monitor > External Invocations. A workflow tool's record carries the jobId of the run it started, so you can find the run in Workflow Executions.

Tenant scoping

A session only exposes the tenant's own workflows, connections, and execution history.

How is this guide?

Last updated on

On this page