# Codex Integration Guide

{% embed url="<https://openai.com/codex/>" %}

## 1. Add Codex to VS Code

* Open **VS Code → Extensions**.
* Search for **“Codex – OpenAI’s coding agent”** (publisher: OpenAI).
* Click **Install**.
* If Codex doesn’t appear immediately, **restart VS Code**.

After install, you’ll see **Codex** in the left sidebar; you can also drag it to the **right sidebar** if you prefer.

## 2. Sign in (connect your account)

After installation, the extension will prompt you to sign in. You can use **ChatGPT account.** \
\
if extension does not show up in your sidebar, hit `CTRL + SHIT + P` and enter `Codex:Open Codex Sidebar` and click. \
\
The Codex chat window will be displayed.&#x20;

## 3. Connect to Humanity Gitbook MCP

1. At the top right side of the Codex chat window click on the **gear icon** and select **MCP Settings** **→ Open MCP Settings.**
2. Under **Custom Server** click **Add Server.**
3. Choose a name and click on **Streamable HTTP.**  Leave all other fields as default.
4. For the **URL** insert [**https://docs.humanity.org/\~gitbook/mcp**](https://docs.humanity.org/~gitbook/mcp) and click **Save.**

<figure><img src="/files/Yr4TgRJJjKb8H1E7T1Xf" alt=""><figcaption></figcaption></figure>

5. Make sure the server is active (switch button is on) and wait for the synchronization to complete.&#x20;

<p align="center"><img src="/files/K9ek5bGrT8BstfB5dIjf" alt="" data-size="original"><br></p>

<p align="center"></p>

## 4. Scope Codex's output

When prompting Codex, include:

* A reference to the name of the MCP server you use to connect with Gitbook.
* The desired outcome (e.g. OAuth login + preset verification).

Example:

```
Use the <name_of_your_mcp_server> and give me an example on how to connect with the SDK / API
```


---

# Agent Instructions: 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:

```
GET https://docs.humanity.org/working-with-llms/codex-integration-guide.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
