> For the complete documentation index, see [llms.txt](https://docs.humanity.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.humanity.org/working-with-llms/codex-integration-guide.md). Agents can also search and read this documentation through its [MCP server](https://docs.humanity.org/~gitbook/mcp).

# Codex Integration Guide

Give Codex (VS Code) real-time access to Humanity documentation and examples using a custom MCP server.

{% 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="https://383350980-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FL1EBectYBMnvu9vU5N1M%2Fuploads%2FF9dAzu613PMUOwejK19A%2FScreenshot%20From%202026-02-16%2012-40-56.png?alt=media&amp;token=8f910744-acd3-4e07-ac08-606937be94eb" 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="https://383350980-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FL1EBectYBMnvu9vU5N1M%2Fuploads%2Fas7Ut4Z5CeVi3BYTCEb3%2FScreenshot%20From%202026-02-16%2012-45-07.png?alt=media&amp;token=17ee35b7-133e-4162-a424-93a0767b74f7" 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
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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
