> 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/agentic-commerce-intelligence/mcp-in-emporix/mcp/retrieving-mcp-token.md).

# 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="/files/FGQu1P2PVYZhWkkNfJ8S" 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="/files/dqF07rJWH5HEE2bkweAa" 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="/files/fOxHAajucrfAO5vxHakx" 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](/agentic-commerce-intelligence/mcp-in-emporix/mcp/connect-cursor.md)
* [Connecting Emporix MCP Server to OpenAI](/agentic-commerce-intelligence/mcp-in-emporix/mcp/connect-openai.md)
  {% endhint %}


---

# 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/agentic-commerce-intelligence/mcp-in-emporix/mcp/retrieving-mcp-token.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.
