Docs
MCP

Codex

Add the Foam MCP server to Codex. Codex reads the token from your environment each time it connects.

Before you start

You need your Foam token in FOAM_TOKEN. If you have not done that yet, follow Get your token first.

Add Foam to Codex

  1. Run:
    codex mcp add foam --url https://sdk.api.foam.ai/mcp --bearer-token-env-var FOAM_TOKEN
    Codex stores the variable name, not the token, and reads FOAM_TOKEN from your environment each time it connects. Launch Codex, or the IDE that runs it, from a shell where the variable is set.
  2. The command writes this to ~/.codex/config.toml. You can add it by hand instead:
    [mcp_servers.foam]
    url = "https://sdk.api.foam.ai/mcp"
    bearer_token_env_var = "FOAM_TOKEN"
  3. Check the connection with codex mcp list, or /mcp inside Codex. Then try: Using foam, list my services.

If Codex says the token variable is not set

Export FOAM_TOKEN in your shell profile and restart Codex or your IDE so it inherits the variable.