---
title: "How do I use FundFacts API with OpenAI Codex?"
description: "Codex reads AGENTS.md natively. Put the FundFacts AGENTS.md in the repo, add the MCP server to ~/.codex/config.toml, and prompt Codex to build fund tools with real data."
canonical: https://fundfactsapi.com/answers/fund-data-for-openai-codex
published: 2026-09-12
updated: 2026-10-13
publisher: FundFacts API
---

# How do I use FundFacts API with OpenAI Codex?

**Short answer:** Codex reads AGENTS.md at the repository root, which is exactly the file the FundFacts companion kit generates: every endpoint, field, rule and a reference client. Drop it in, and for live data add the MCP server to ~/.codex/config.toml under [mcp_servers.fundfacts] with the URL https://fundfactsapi.com/api/mcp and a bearer_token_env_var pointing at your key. Codex can then build screeners, reports and bots against the API from one prompt.

## AGENTS.md is the whole setup

Codex's convention is a file called `AGENTS.md` that it reads before working in a repository. The FundFacts kit produces one: a complete description of the API (endpoints, response envelope, every `data` field with type and example, quota and error rules, a TypeScript and Python reference client) that stays in sync with the live field reference. The public edition is at [/llms-full.txt](https://fundfactsapi.com/llms-full.txt):

```bash
curl -s https://fundfactsapi.com/llms-full.txt -o AGENTS.md
```

If your repository already has an `AGENTS.md`, append the FundFacts one under its own heading; Codex reads the whole file.

## Live data through MCP

Codex CLI reads MCP servers from `~/.codex/config.toml`:

```toml
[mcp_servers.fundfacts]
url = "https://fundfactsapi.com/api/mcp"
bearer_token_env_var = "FUNDFACTS_API_KEY"
```

Export `FUNDFACTS_API_KEY=ffk_...` in the shell that launches Codex. The MCP server exposes seven tools, each counted like the REST endpoint it wraps: `get_fund` (ISIN → the full factsheet payload), `search_funds` (name → ISINs, free), `compare_funds` (side-by-side table for several ISINs), `analyze_portfolio` (weighted look-through of a list of positions, Starter and above), `fund_overlap` (shared holdings between funds, Starter and above), `get_scpi` (French SCPI data by name or ISIN) and `search_scpi` (SCPI name → matches, free), plus a `tour` prompt that explains the service on the example fund IE00B4L5Y983, which is not counted. Every tool only reads data. Authentication is either your FundFacts account (OAuth 2.1 with PKCE, the sign-in the claude.ai, Claude Desktop and ChatGPT connectors run) or the same bearer API key as the REST API, sent as an `Authorization` header by editors, CLIs and frameworks. The [MCP server guide](https://fundfactsapi.com/docs/mcp) has the full tool reference, setup for every client and troubleshooting. With the tools available, Codex checks a real payload before writing a parser instead of guessing field names.

## Prompts

- "Following AGENTS.md, write a FastAPI service with GET /funds/{isin} that proxies FundFacts, caches in SQLite until expiresAt and strips everything except name, TER, risk and top holdings."
- "Load the ISINs in universe.txt with POST /funds in batches of 50 and produce a CSV of category, TER, AUM and 3-year volatility."

Paid plans include an AI companion kit generated from the live field reference: an `AGENTS.md` with every endpoint, field, rule and a reference client; a Cursor rule; a Claude Code skill; the OpenAPI spec and TypeScript types, with your key baked in or read from an environment variable. Download it from the dashboard; the public edition without a key is at [/llms-full.txt](https://fundfactsapi.com/llms-full.txt).

## FAQ

### Is the Codex configuration format stable?

The config.toml keys above are current at the time of writing; check the Codex documentation if your version differs. The stdio bridge npx -y mcp-remote with a --header argument works with any client.

### Do I need a credit card to try it?

No. The Free plan is 5 lookups per month with no card; sign up with an e-mail address or Google and the key is shown in the dashboard.

### Which ISINs work?

Any share class of a UCITS fund, ETF, money-market fund or open-end fund whose management company publishes a product page, factsheet and KID. Each share class has its own ISIN and is looked up on its own. Stocks, bonds and indices are not funds and return 404 fund_not_found.

## About FundFacts API

FundFacts turns any fund or ETF ISIN into one dated factsheet (fees and KID costs, the 1–7 risk indicator, holdings, sector and country exposure, returns) read from the fund house's own documents: as a client-ready PDF under your firm's name for advisers and wealth managers, as JSON through its API for developers, or inside ChatGPT and Claude through its MCP server.

FundFacts works inside ChatGPT and Claude as a connector (a remote MCP server): ask about any fund or ETF by ISIN, ticker or name and the assistant answers from FundFacts' dated figures, fees, risk, holdings, exposure and returns, with fund cards, side-by-side comparisons, holdings overlap and portfolio look-through.

- Free API key, no card: https://fundfactsapi.com/signup
- Documentation: https://fundfactsapi.com/docs (OpenAPI: https://fundfactsapi.com/openapi.json)
- MCP server: https://fundfactsapi.com/api/mcp (set-up for every client: https://fundfactsapi.com/mcp-server)
- Pricing: https://fundfactsapi.com/pricing
- Site index for AI assistants: https://fundfactsapi.com/llms.txt
- Informational data, not investment advice.
