# Connecting Emporix MCP Server with OpenAI

Enable communication between the Emporix MCP Server and OpenAI ChatGPT. This way, you grant access to Emporix data though the set of relevant scopes to OpenAI Platform, so that you can process it further with AI capabilities brought by the Chat GPT.

## Prerequisites

To follow the steps, make sure you have the required tools and accounts:

* [OpenAI Platform](https://platform.openai.com)
* [Emporix Tenant](https://app.emporix.io/)
* [MCP Token](https://developer.emporix.io/agentic-commerce-intelligence/mcp-in-emporix/mcp/retrieving-mcp-token)

## Configuration

{% stepper %}
{% step %}
**Go to OpenAI settings**

Open the [OpenAI Platform Playground](https://platform.openai.com/playground/prompts). In **Prompts** -> **Tools**, choose **Create** and select the **MCP Server** to configure the connection.

<figure><img src="https://1530167654-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8GgoeZEZYjZrpjOU6w52%2Fuploads%2Fgit-blob-17a34628f9020f0ab688504cb0d33a8bf47e23b9%2Fopenai.png?alt=media" alt="Open AI configuration"><figcaption></figcaption></figure>
{% endstep %}

{% step %}
**Choose to add new tool**

Select **Add new** to add tools from the Emporix MCP server.

<figure><img src="https://1530167654-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8GgoeZEZYjZrpjOU6w52%2Fuploads%2Fgit-blob-5b661dc31845c9ddfce4489d0e68bb6bfa3fc806%2Fmcp_openai.png?alt=media" alt="Add MCP tools" width="500"><figcaption></figcaption></figure>
{% endstep %}

{% step %}
**Set up connection**

Provide the connection details in the modal that shows up.

* As the **URL**, provide the MCP connection string in the following format:

  ```
  https://api.emporix.io/mcp/{domain}/{tenant}/{mcp_token}/mcp
  ```

  Replace the `{domain}`, `{tenant}` and `{mcp_token}` placeholders with the relevant values.
* Optionally, provide label name in **Label**.
* Leave the **Authentication** as *None* since the MCP token is included in the connection string.

When ready, choose **Connect** to establish connection.
{% endstep %}

{% step %}
**Select tools**

Select the tools you want to use that are based on the available scopes granted in the token:

<figure><img src="https://1530167654-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8GgoeZEZYjZrpjOU6w52%2Fuploads%2Fgit-blob-25a7cfad2925a785652e818f8d44370711fd4b33%2Fmcp_openai_tools.png?alt=media" alt="Add tools" width="500"><figcaption></figcaption></figure>

When done, choose **Add**.
{% endstep %}
{% endstepper %}

### Using OpenAI

You can now start a conversation with AI chat about Emporix data, for example:

<figure><img src="https://1530167654-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8GgoeZEZYjZrpjOU6w52%2Fuploads%2Fgit-blob-4884b663a9e5609b4f4ea02a6d81508c17f4cd26%2Fmcp_openai_chat.png?alt=media" alt="OpenAI chat" width="500"><figcaption></figcaption></figure>

The OpenAI agent can access the Emporix data to retrieve and manipulate it according to your needs within the granted scopes.
