AI agents & LLMs

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.Updated 12 September 2026 · by FundFacts API

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:

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 six 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, Pro and above), fund_overlap (shared holdings between funds, Pro and above) and get_scpi (French SCPI data by name or ISIN). Authentication is the same bearer API key as the REST API, sent as an Authorization header. 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.
bash
curl -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]}'

Frequently asked questions

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 15 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.

Try it on your own ISINs

One request returns key facts, holdings, risk and performance as JSON. Free plan, no card.