# Retrieving Emporix MCP Token

The MCP token is required to open a communication channel between Emporix API and the AI tools. Follow these steps to generate the necessary API keys and retrieve the Emporix MCP token.

{% stepper %}
{% step %}
**Add API keys**

Open the [Emporix Developer Portal](https://app.emporix.io/). Navigate to the **Manage API Keys** option and choose the **Add custom API**.
{% endstep %}

{% step %}
**Define custom API keys**

Provide a name for the custom API keys and select the necessary scopes for your tenant:

* MCP scope

  <figure><img src="https://1530167654-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8GgoeZEZYjZrpjOU6w52%2Fuploads%2Fgit-blob-aa4b5bb901144c3fbfe2b5ea2e296ec407360021%2Fmcp_scope.png?alt=media" alt="MCP Server scope" width="700"><figcaption></figcaption></figure>
* additional scopes that you want to grant to your agent - for example, for an AI Agent that is to manage products in Emporix system, grant the scopes related to products:

  <figure><img src="https://1530167654-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8GgoeZEZYjZrpjOU6w52%2Fuploads%2Fgit-blob-9d0a96f204afd5b268e91520a8e9aa5dc7053fa1%2Fmcp_productscopes.png?alt=media" alt="Product scopes for MCP Server" width="700"><figcaption></figcaption></figure>

When done, **Generate** new API keys.

As a result, the generated credentials appear in the Custom API list:

<figure><img src="https://1530167654-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8GgoeZEZYjZrpjOU6w52%2Fuploads%2Fgit-blob-23c39ea2af93fc43d4db07cba9fa218676c1b9f9%2Fmcp_api_keys.png?alt=media" alt="API Keys for Product MCP" width="700"><figcaption></figcaption></figure>
{% endstep %}

{% step %}
**Encode credentials**

Encode the `Client ID` and `Secret` to Base64 using the following string format: `clientId:secret`.

Example commands according to your operating system:

{% tabs %}
{% tab title="MacOS" %}

```
echo -n "clientId:secret" | base64
```

Example:

```
echo -n "X9S0SDt1LiIs7tSt7JpTOZAUBhtXR3VUxDwyChwFAkxFIfwe:uNW6iZklaUVKMpooBOle41rie99cjOBIPB1ktDSXmd4RH1P1r1Pl8WPr2CJXG4LM" | base64
```

{% endtab %}

{% tab title="Windows" %}

```
[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes("clientId:secret"))
```

Example:

```
[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes("X9S0SDt1LiIs7tSt7JpTOZAUBhtXR3VUxDwyChwFAkxFIfwe:uNW6iZklaUVKMpooBOle41rie99cjOBIPB1ktDSXmd4RH1P1r1Pl8WPr2CJXG4LM"))
```

{% endtab %}
{% endtabs %}

The resulting output is the encoded **MCP token**, that looks similar to this:

```
WDlTMFNEdDFMaUlzN3RTdDdKcALOWkFVQmh0WFIzVlV4RHd5Q2h3RkFreEZJZndlOnVOVzZpWmtsYVVWS01wb29CT2xlNDFyaWU5OWNqT0JJUEIxa3REU1htZDRSSDFQMXIxUGw4V1ByMkNKWEc0TE0=
```

{% endstep %}

{% step %}
**Store the token**

Copy or save the token so that you can use it to enable communication between Emporix and your AI tools.
{% endstep %}
{% endstepper %}

{% hint style="info" %}
To see the examples of enabling the Emporix MCP Server, check out these documents:

* [Connecting Emporix MCP Server to Cursor](https://developer.emporix.io/agentic-commerce-intelligence/mcp-in-emporix/mcp/connect-cursor)
* [Connecting Emporix MCP Server to OpenAI](https://developer.emporix.io/agentic-commerce-intelligence/mcp-in-emporix/mcp/connect-openai)
  {% endhint %}
