# How to connect ChatGPT to MCP

The new Developer Mode in [ChatGPT](https://chatgpt.com/) lets you wire external capabilities into ChatGPT via custom connectors.

<Callout title="Developer Mode" type="info">
  Developer Mode is currently only available on Plus and Pro plans. It is not
  available on Free or Business plans. You can read more about Developer Mode in
  the [OpenAI
  documentation](https://platform.openai.com/docs/guides/developer-mode).
</Callout>

When combined with [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) servers hosted on [Gram](/docs/mcp/getting-started#quickstart-guides), you can give ChatGPT access to your APIs and tools in just a few minutes.

![Screenshot showing Acme To-Do in ChatGPT preview](/assets/docs/gram/img/guides/chatgpt/acme-todo-in-chatgpt-preview.png)

This guide walks you through connecting ChatGPT to a [Gram-hosted MCP server](https://www.speakeasy.com/blog/release-gram-beta) using the example Acme To-Do API. You'll learn to set up the connection, configure the custom connector, and test it with natural language prompts for managing your to-dos.

We'll use the Acme To-Do API as our example. It's a simple Python Flask REST API for managing to-do list items. You can find the complete OpenAPI document here: [`acmetodo.yaml`](https://github.com/ritza-co/acme-todo/blob/main/acmetodo.yaml).

## Prerequisites

To follow this tutorial, you need:

- **A [Gram account](https://app.getgram.ai)**
- **A ChatGPT account with access to Developer Mode:** Use the Plus or Pro plan.
- **A deployed version of the Acme To-Do API:** Fork our [Acme To-Do API repository](https://github.com/ritza-co/acme-todo) and deploy it to your own infrastructure.

## Creating a Gram MCP server

If you already have a Gram-hosted MCP server configured, skip to the section on [connecting ChatGPT to your Gram-hosted MCP server](#connecting-chatgpt-to-your-gram-hosted-mcp-server). For an in-depth guide to how Gram works and more details on creating a Gram-hosted MCP server, check out the [Gram concepts guide](https://www.speakeasy.com/mcp/core-concepts).

## Setting up a Gram project

In the [Gram dashboard](https://app.getgram.ai), click **New Project** to start the guided setup flow for creating a toolset and MCP server.

Enter a project name and click **Submit**.

![Screenshot of the Gram dashboard showing the New Project link](/assets/docs/gram/img/guides/chatgpt/create-new-project.png)

Click **Get Started** on the project homepage. Gram will now guide you through the following steps:

### Upload the OpenAPI document

Upload the Acme To-Do OpenAPI document, [`acmetodo.yaml`](https://github.com/ritza-co/acme-todo/blob/main/acmetodo.yaml), enter the name of your API, and click **Continue**.

![Screenshot of the upload your OpenAPI spec dialog](/assets/docs/gram/img/guides/chatgpt/uploading-openapi.png)

### Create a toolset

Give your toolset a name (for example, `Acmetodo`) and click **Continue**.

Notice that the names of the tools generated from your OpenAPI document are displayed in this dialog.

![Screenshot of the create toolset dialog](/assets/docs/gram/img/guides/chatgpt/create-toolset.png)

### Configure MCP

Enter a URL slug for the MCP server (for example, `acme-todo`) and click **Continue**.

![Screenshot of the configure MCP dialog](/assets/docs/gram/img/guides/chatgpt/configure-mcp-slug.png)

Gram creates the toolset from the OpenAPI document.

Click **Toolsets** in the sidebar to view the **Acmetodo** toolset.

You can edit individual tools in the toolset by clicking on the name or description of a tool.

![Screenshot of the MCP details page](/assets/docs/gram/img/guides/chatgpt/mcp-details.png)

## Configuring environment variables

<Callout title="Server URL" type="info">
By default, the server URL is set by the OpenAPI document. The `acmetodo.yaml` OpenAPI document uses a base URL of `https://api.ritzademo.com`, which points to the live demo Acme To-Do API.

If you use your own API, set the server URL to the URL of your deployment. You can either edit the OpenAPI document and skip the step below, or set the server URL in the environment variables.

</Callout>

[Environments](/docs/mcp/secure/environments) store API keys and configurations separate from your toolset logic.

In the **Environments** tab, click the **Default** environment. Click the three-dot menu in the top-right corner of the environment card and then click **Fill for Toolset**. Select the **Acmetodo** toolset and click **Fill Variables** to automatically populate the required variables.

![Screenshot showing the fill for toolset dialog to automatically populate required variables](/assets/docs/gram/img/guides/chatgpt/env-fill-vars.png)

Set the base URL variable for your API. For example, if your Acmetodo API is deployed at `https://acme-todo.example.com`, set `ACMETODO_SERVER_URL` to that value. Click **Save**.

![Screenshot showing setting the server URL environment variable](/assets/docs/gram/img/guides/chatgpt/add-server-url.png)

## Publishing an MCP server

Let's make the toolset available as an MCP server.

Go to the **MCP** tab, find the **Acmetodo** toolset, and click on it to open the MCP details page.

Enable the MCP server by clicking the **Enable** button and then **Enable Server**.

![Screenshot showing the enable button to enable the MCP server](/assets/docs/gram/img/guides/chatgpt/enable-mcp.png)

Scroll down to the **Visibility** section and ensure the visibility of the server is set to **Public**.

![Screenshot showing server visibility](/assets/docs/gram/img/guides/chatgpt/server-visibility.png)

Scroll down to the **Hosted URL** section and copy the URL.

![Screenshot showing the MCP server config dialog for the Acme To-Do toolset](/assets/docs/gram/img/guides/chatgpt/mcp-public-server-copy-url.png)

## Connecting ChatGPT to your Gram-hosted MCP server

ChatGPT supports the use of MCP servers as connectors in Developer Mode. Here's how to add an MCP server connector to ChatGPT:

### Add a Remote MCP server connector in ChatGPT

In Gram, go to the **MCP** tab, open your toolset, and copy the **Hosted URL**.

In the ChatGPT web UI, open **Settings**, go to the **Connectors** tab, and scroll down to **Advanced settings**. Click the **Enable Developer Mode** switch.

![Enable Developer Mode](/assets/docs/gram/img/guides/chatgpt/enable-developer-mode.png)

Return to the **Connectors** tab and click the **Create** button.

![Open Connectors and add a new Remote MCP](/assets/docs/gram/img/guides/chatgpt/connectors-create-button.png)

In the **New Connector** dialog, fill in the details as follows:

- **Name:** `acme-todo`
- **Description:** Briefly describe the connector.
- **Server URL:** Paste your Gram Hosted URL.
- **Authentication:** Here, you can choose to use OAuth for authentication. The Acme To-Do MCP server doesn't require authentication, so we'll choose **No authentication**.

  ![Add Remote MCP server connector dialog](/assets/docs/gram/img/guides/chatgpt/add-remote-mcp.png)

- **I trust this application:** Click the checkbox to confirm that you trust the app.

Lastly, click **Create**.

Once saved, the MCP server appears as a connector in the **Connectors** section.

![Remote MCP tool installed](/assets/docs/gram/img/guides/chatgpt/acme-todo-installed-chatgpt.png)

ChatGPT lists your tools as **Actions**. You can enable or disable individual tools.

### Use the connector in a chat

Start a new chat in ChatGPT, click the **+** icon to open the dropdown, and select **Developer Mode** under **More**.

![Enable Developer Mode for the chat](/assets/docs/gram/img/guides/chatgpt/enable-developer-mode-chat.png)

Enable the **acme-todo** connector.

![Enable the Acme MCP tool in chat](/assets/docs/gram/img/guides/chatgpt/enable-acme-mcp.png)

Ask ChatGPT to perform an action that requires the Acme To-Do API. For example:

```
Create a new task. I need to go for a hike this Saturday. Use acme todo.
```

<video width="600" muted={true} controls>
  <source
    src="/assets/docs/gram/videos/chatgpt-acme-todo-demo.mp4"
    type="video/mp4"
  />
  Your browser does not support the video tag.
</video>

## Troubleshooting

- **Connector not connecting:** Test the MCP server in the **Gram Playground**. Then, verify that the MCP server URL in the tool matches the MCP server URL in Gram.

  ![Screenshot showing how to test an MCP server in the Gram Playground](/assets/docs/gram/img/guides/chatgpt/playground-test.png)

- **Authentication errors:** For private servers, confirm your Gram API key in **Settings -> API Keys** and ensure the `Authorization: Bearer ...` header is configured in ChatGPT.
- **Tools not appearing:** Confirm that your toolset includes the expected tools and that the environment variables have been set. Finally, republish the server if you updated the toolset.

## What's next

You now have ChatGPT connected to a Gram-hosted MCP server built from the Acme To-Do API. Ready to build your own? [Try Gram today](/book-demo) and turn any OpenAPI document into agent-ready tools your models can use safely.
