> For the complete documentation index, see [llms.txt](https://developer.emporix.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.emporix.io/user-guides/extensibility-and-integrations/extensibility-cases/extension-hosting.md).

# Extension and Cloud Function Hosting

Emporix offers a built-in hosting model for custom extensions and cloud functions. Learn how the hosting works, what you can deploy, and how to manage the full deployment lifecycle.

Emporix provides a built-in, secure, and scalable hosting environment for custom extensions and cloud functions built on top of the Emporix Management Dashboard. Instead of maintaining your own cloud infrastructure, you can deploy and operate your custom code directly within the Emporix environment — with versioning, rollback, monitoring, and tenant isolation included out of the box.

{% hint style="danger" %}
Hosting of the extensions and cloud functions is not included in standard billing plans and is billed separately on a pay-as-you-go basis. If you're interested in getting access to the feature, contact the [Sales Team](mailto:support@emporix.com).
{% endhint %}

## How it works

The hosting model is project-based. It means that each tenant initializes a single hosting project as a one-time action. The project receives a unique Project ID and acts as the container for all hosted extensions and cloud functions on that tenant.

Emporix supports lazy hosting, which means no pre-configuration is required per tenant before the project is initialized. Once the project is set up, you can add any number of extensions and cloud functions to it.

Each hosted resource follows the same lifecycle:

1. You upload the code either from a GitHub repository or as a `zip` / `tar.gz` archive.
2. The system automatically triggers a build process.
3. A successful build produces a versioned release that is immediately available for use.
4. For extensions hosting — all previous releases are retained, enabling rollback to any earlier version at any time.

## What you can host

### Extensions

Extensions are custom UI add-ons built on the [MD Module Template](https://github.com/emporix/md-module-template), which is based on the module federation concept. A hosted extension integrates directly into the Emporix Management Dashboard and can be registered in one of two ways:

* As a **module** — visible in the **Extensions** section of the Management Dashboard.
* As a **perspective** — accessible with a dedicated URL path in the Dashboard navigation.

Each extension is identified by a unique **Hosting ID**, which becomes part of its hosting URL. Display names can be localized to support multiple languages.

{% hint style="warning" %}
The Emporix infrastructure supports up to 20 extensions per hosting project.
{% endhint %}

### Cloud functions

Cloud functions are serverless units of custom logic that can be triggered by events, Emporix APIs, or other platform processes. Unlike extensions, they are not UI components; they operate in the background and can be exposed in the [Partner Library](https://developer.emporix.io/partner-library/) or consumed through custom API integrations. You can also use hosted cloud functions as tools on a [dynamic MCP server](https://app.gitbook.com/s/8GgoeZEZYjZrpjOU6w52/agentic-intelligence/configuration/custom-mcp#configuring-a-dynamic-mcp-server), so AI agents can call your custom business logic.

{% hint style="info" %}
To expose a hosted cloud function as an agent tool, create a dynamic MCP server in **Agentic AI** -> **AI MCP** and map each tool to a Cloud Function ID. See [Configuring a dynamic MCP server](https://app.gitbook.com/s/8GgoeZEZYjZrpjOU6w52/agentic-intelligence/configuration/custom-mcp#configuring-a-dynamic-mcp-server).
{% endhint %}

Supported runtimes:

* Node.js 24
* Python 3.14

Cloud functions support **environment variables**, which can be defined as key-value pairs and used within the function code to securely decode credentials and configuration data.

Full invocation logs are available in the hosting details of each cloud function, showing when and how it was called and what the outcome was.

**Example cloud function**

Here is the example of a simple cloud function that returns a welcome message and the headers injected by Emporix.

{% file src="/files/ekrYZdXCgB9SJDuvHm78" %}

## Deployment and versioning

Every deployment — whether an initial upload or an update — triggers a build. The **Build History** tracks all builds with the following details: deployment ID, build ID, status, and timeline.

For extensions, all published versions are retained in the **Releases** panel. Each release shows its version ID, status, and timeline. If a new deployment introduces a regression, you can use the **Rollback** option to revert to any previous release — this results in the release of the selected version.

{% hint style="info" %}
To set up hosting and deploy your first extension or cloud function, refer to the step-by-step instructions in the Management Dashboard: [Hosting](/user-guides/management-dashboard/administration/hosting.md).
{% endhint %}

## Invoking cloud functions

Once you have enabled a cloud function hosting in Emporix, you can call the cloud function within your integration through API.

* **HTTP Methods**

To invoke a cloud function, send an `HTTP` request to the function endpoint. Standard `HTTP` methods are available, so depending on what you need, you can call one of the following: `POST`, `GET`, `PUT`, `DELETE`.

* **Endpoint path**

The root endpoint path:

```
https://api.emporix.io/cloud-functions/{TENANT}/functions/{FUNCTION_ID} 
```

If your cloud function exposes internal endpoints in addition, you can extend the path. For example:

```
https://api.emporix.io/cloud-functions/{TENANT}/functions/{FUNCTION_ID}/products
```

* **Authentication and authorization**

All the requests are routed through the Emporix platform. This means that the platform validates the provided tokens (service, customer, or anonymous). You do not need to implement any additional token validation inside your cloud function.

* **Request headers**

Emporix enriches each request with additional headers that can be used within your function:

| Header                    | Description                                                                                                                                                                                                                                                                                               |
| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `emporix-token`           | <p>The token used for this invocation. Reuse it to call Emporix APIs.</p><ul><li>HTTP agent call — reflects the caller.</li><li>Commerce event — generated from the agent's <strong>Event Scopes</strong>.</li><li>External MCP client — generated from the scopes assigned to the MCP API key.</li></ul> |
| `emporix-tenant`          | Always set. Identifies the tenant that invoked the function.                                                                                                                                                                                                                                              |
| `emporix-scopes`          | The scopes assigned to that token. Use this header to see which resources the function can access.                                                                                                                                                                                                        |
| `emporix-user-id`         | Set for employee tokens on HTTP agent calls and for customer tokens. Not set for service tokens, commerce events, or external MCP clients.                                                                                                                                                                |
| `emporix-session-id`      | Set when the function runs inside an agent session.                                                                                                                                                                                                                                                       |
| `emporix-legal-entity-id` | Set only for customer tokens when the customer is assigned to a legal entity. Not set for service tokens, commerce events, or external MCP clients.                                                                                                                                                       |

{% hint style="info" %}
When a cloud function is a tool on a [dynamic MCP server](https://app.gitbook.com/s/8GgoeZEZYjZrpjOU6w52/agentic-intelligence/configuration/custom-mcp#cloud-function-context-for-dynamic-mcp-tools), the same headers are injected. The token and identity headers that are set depend on whether the tool is invoked from an agent HTTP call, a commerce event, or an external MCP client.
{% endhint %}

* **Environment variables**

If your cloud function uses environment variables, you can access them in your code as follows:

```
process.env.{ENV_KEY}
```

For example, `process.env.client_id`.

* **Example**

See the example request calling a cloud function:

```bash
curl --location --request POST 'https://api.emporix.io/cloud-functions/{{tenant}}/functions/{{FUNCTION_ID}}' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{EMPORIX_TOKEN}}' \
--data-raw '{
    "name":"John"
}'
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developer.emporix.io/user-guides/extensibility-and-integrations/extensibility-cases/extension-hosting.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
