
# How to Connect Codex to dfin.pro MCP {#intro}


Canonical HTML page: [/docs/examples/codex-dfin-mcp/](/docs/examples/codex-dfin-mcp/)

LLM-friendly Markdown page: [/docs/examples/codex-dfin-mcp.md](/docs/examples/codex-dfin-mcp.md)




Codex is OpenAI's AI assistant for research, analysis, and coding. Out of the box it works from its training data, but connecting it to dfin.pro gives it access to live financial information — company filings, earnings transcripts, financial statements, ratios, stock screens, and fund analytics — so you get answers grounded in actual data rather than an outdated snapshot.

There are three ways to make the connection, and you only need to follow one:

- **Section 2** — the Codex desktop app (recommended for most users)
- **Section 3** — the Codex CLI plugin (if you prefer working from the command line)
- **Section 4** — direct `config.toml` editing (a manual fallback if the above don't suit your setup)

All three paths require the API key step in Section 1, so start there regardless of which path you choose.

## 1.0 Set the API key {#set-api-key}

Codex needs your dfin.pro API key stored as an environment variable named `DFIN_API_KEY`. An environment variable is a way to give an app a credential it can find automatically, without pasting it into a config file every time. Set it permanently using the commands below so Codex can still find it after you restart the app, open a new terminal, or start a new thread.

### macOS Zsh

```bash
echo 'export DFIN_API_KEY="paste-your-api-key-here"' >> ~/.zshrc
source ~/.zshrc
```

### Linux Bash

```bash
echo 'export DFIN_API_KEY="paste-your-api-key-here"' >> ~/.bashrc
source ~/.bashrc
```

### Windows PowerShell

```powershell
[Environment]::SetEnvironmentVariable("DFIN_API_KEY", "paste-your-api-key-here", "User")
```

Close and reopen PowerShell after setting the variable.

### Windows Command Prompt

```cmd
setx DFIN_API_KEY "paste-your-api-key-here"
```

Close and reopen Command Prompt after setting the variable.

## 2.0 Add the server in the app {#app-setup}

If you're using the Codex desktop app, this is the quickest path. First, make sure you have the latest version installed from the official [OpenAI website](https://openai.com/codex/).

### 2.1 Configure the MCP

Click the settings gear at the bottom left, then click **Settings** in the menu. In the left menu, find **MCP servers** under **Integrations**. Click **Add Server**.



In the next window, select **Streamable HTTP** and fill in the three fields:

- **MCP server name:** `dfin`
- **URL:** `https://www.dfin.pro/mcp`
- **Bearer token env var:** `DFIN_API_KEY`

Click **Save**.



If the UI does not expose the bearer-token environment variable option, use the [`config.toml` setup](#config-toml) instead.

Once the server is saved, ensure it's enabled.



Once saved, open a new Codex chat to activate the connection, then use the checks in Section 5 to confirm it's working.

### 2.2 Optional: add the skill

Installing the dfin.pro skill gives Codex better default behavior for financial research — it knows how to phrase queries, which tools to reach for, and how to structure the results. It's not required, but it makes a noticeable difference if you plan to use dfin.pro regularly.

The skill is published on GitHub at [dfin-pro/dfin-financial-mcp](https://github.com/dfin-pro/dfin-financial-mcp).

You can install it with `/skill-installer`.



Click the option that appears, then paste the GitHub repository link.



Once it is installed, Codex will confirm the installation and ask you to restart. Use the platform-specific restart steps at the end of this guide so the app fully reloads.





## 3.0 Install the CLI plugin {#install-codex-cli}

This section is for Codex CLI users. If you set up the connection through the desktop app in Section 2, you can skip this.

The dfin.pro Codex plugin is published from the GitHub-backed marketplace source at `dfin-pro/dfin-financial-mcp`. Add that marketplace source first:

```bash
codex plugin marketplace add dfin-pro/dfin-financial-mcp
```

Then install the plugin from Codex.

In the Codex app, open **Plugins**, choose the dfin.pro marketplace source, and install `dfin-financial-mcp`.

In Codex CLI, run:

```text
codex
/plugins
```

Choose the dfin.pro marketplace source, open `dfin-financial-mcp`, and select `Install plugin`.

Start a new Codex thread after installation. The plugin bundles the MCP connection config for `https://www.dfin.pro/mcp` and the `dfin-research` skill, so you don't need to paste the MCP server settings by hand.



## 4.0 Edit config.toml {#config-toml}

Codex stores MCP configuration in `config.toml`. On Windows, the file is typically under `C:\Users\<your-user>\.codex\config.toml`.

Add this server entry to your Codex config:

```toml
[mcp_servers.dfin]
enabled = true
url = "https://www.dfin.pro/mcp"
bearer_token_env_var = "DFIN_API_KEY"
```

For most local installs, the config file is `~/.codex/config.toml`. If you keep project-scoped Codex settings, use the trusted project's `.codex/config.toml` instead.

## 5.0 Check that it works {#check}

Restart Codex after changing environment variables, installing the plugin, or editing `config.toml`.

On Windows, fully quit the Codex desktop app from the taskbar or system tray by right-clicking Codex and choosing **Exit**, then reopen it.

On macOS, fully quit Codex with **Codex > Quit Codex**, `Command+Q`, or the Dock quit action, then reopen it.

For Codex CLI, use `/exit` or `/quit`. If you added `DFIN_API_KEY` after the terminal was already open, close and reopen the terminal before running `codex` again.

In a new Codex thread, open:

```text
/mcp
```

Confirm that the `dfin` server appears connected. Then ask a small question that should use dfin.pro, such as:

```prompt
Give me an overview of Micron's revenue and margins over the last 5 years.
```

Here's what that looks like:



If the server does not appear connected, check that `DFIN_API_KEY` is set in the same environment Codex is running in and that the server URL is exactly `https://www.dfin.pro/mcp`. If you're still stuck, reach out at [info@dfin.pro](mailto:info@dfin.pro).