# ChatGPT + Codex by Cli Integration

ChatGPT supports external tools through two mechanisms depending on the interface you are using: GPT Actions (for custom GPTs) and the OpenAI Responses API with tool calling (for developers using the API directly). The IPstack hosted MCP endpoint can be connected via the Streamable HTTP transport.

<table><colgroup><col></colgroup><tbody><tr><td><p><strong>📌 Note on MCP Support</strong></p><p><span>As of early 2026, OpenAI's native MCP client support in ChatGPT is in active rollout. The steps below use the Streamable HTTP remote endpoint, which is the most compatible approach across ChatGPT, GPT Builder, and the Responses API.</span></p></td></tr></tbody></table>

## **Prerequisites**

-   A MCP Bearer MCP token with mcp\_access\_enabled.

## **7.2 Config for ChatGPT + Codex to run by cli**

This approach lets you build a Custom GPT in ChatGPT that can call IPstack tools through GPT Actions.

**Step 1: Install npm package - @openai/codex**

<table><colgroup><col></colgroup><tbody><tr><td><span>npm install -g @openai/codex</span></td></tr></tbody></table>

**Step 2: Install npm package - mcp-remote**

<table><colgroup><col></colgroup><tbody><tr><td><span>npm install -g mcp-remote</span></td></tr></tbody></table>

**Step 3: Create config file in users directory**

<table><colgroup><col></colgroup><tbody><tr><td><p><span>[mcp_servers.apilayer]</span></p><p><span>&nbsp;&nbsp;startup_timeout_sec = 120</span></p><p><span>&nbsp;&nbsp;command = "mcp-remote"</span></p><p><span>&nbsp;&nbsp;args = [</span></p><p><span>&nbsp;&nbsp;&nbsp;&nbsp;"https://mcp.apilayer.com/mcp",</span></p><p><span>&nbsp;&nbsp;&nbsp;&nbsp;"--header",</span></p><p><span>&nbsp;&nbsp;&nbsp;&nbsp;"Authorization:Bearer ${APILAYER_TOKEN}",</span></p><p><span>&nbsp;&nbsp;]</span></p><p><span>&nbsp;</span></p><p><span>[mcp_servers.apilayer.env]</span></p><p><span>&nbsp;&nbsp;APILAYER_TOKEN = "Place Your Ipstack MCP token&nbsp; here"</span></p></td></tr></tbody></table>

**Step 4: Consume api by codex**

Type codex from the terminal in the directory which we trust, or maybe from a newly created directory, like the user wants. /mcp to list mcp etc.

## **Verify Integration**

Once configured. Examples:

-   "What country and city is the IP address 8.8.8.8 located in?"  (uses ipstack\_lookup)
-   “Get location details for {IP\_ADDRESS}.” (uses ipstack\_lookup)
-   “What region does IP {IP\_ADDRESS} belong to?”

Allow access to tool calls to get the data.
