How do I use FundFacts API with OpenAI Codex?
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.Published September 12, 2026 · Updated October 13, 2026 · by FundFacts APIShort 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:
bashcurl -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 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.
Verify it yourself
The demo endpoint returns the live payload for a fund that is already in the store, without a key. Everything on this page can be checked against it.bashcurl -s https://fundfactsapi.com/api/v1/demo/funds/IE00B4L5Y983 | jq '{name, asOf: .data.dataAsOf, ter: .data.headlineMetrics.ter, risk: .data.riskRating, top: .data.topHoldings[:3]}'