About Codex CLI

OpenAI Codex CLI is a lightweight coding agent that runs in your terminal. It supports the Model Context Protocol (MCP), allowing you to connect fo-semantic-mcp for AI-assisted D365 F&O development.

Configuration Steps

  1. Locate Your Codex Config File

    Codex stores its configuration in config.toml:

    Windows:

    C:\Users\<username>\.codex\config.toml

    macOS / Linux:

    ~/.codex/config.toml
  2. Get Your API Key

    Sign in to xplusplus.ai and get your API key from the dashboard.

    Get API Key
  3. Add MCP Server Configuration

    Open your config.toml file and add the fo-semantic-mcp server configuration:

    # Your existing Codex settings model = "gpt-4.1" model_reasoning_effort = "medium" # FO-Semantic MCP Server for D365 F&O [mcp_servers.fo-semantic] command = "npx" args = ["-y", "fo-semantic-mcp"] [mcp_servers.fo-semantic.env] FOINDEX_API_KEY = "your_api_key_here" FO_LOCAL_ASSETS_PATH = "C:\\Users\\YourName\\AppData\\Local\\Microsoft\\Dynamics365\\10.0.xxxx\\PackagesLocalDirectory" FO_SEARCH_DEFAULT_LIMIT = "10" FO_THRESHOLD = "0.7"

    Configuration Options

    FOINDEX_API_KEY (required) - Your API key from xplusplus.ai
    FO_LOCAL_ASSETS_PATH (recommended) - Path to your local F&O PackagesLocalDirectory for XML file reading
    FO_SEARCH_DEFAULT_LIMIT - Number of search results (default: 10)
    FO_THRESHOLD - Relevance threshold 0-1 (default: 0.5)

  4. Restart Codex

    Save the config file and restart Codex CLI. The MCP server will be automatically downloaded and started via npx.

  5. Test the Connection

    Try asking Codex to search for F&O artifacts:

    > List the F&O forms that involve CustTable

Example in Action

Here's what it looks like when Codex uses the MCP server to find F&O forms related to CustTable:

Codex CLI using fo-semantic-mcp to search F&O artifacts
Codex automatically calls fo-semantic-mcp to search for forms involving CustTable, returning the full paths to each XML file.

What's Happening

When you ask about F&O artifacts, Codex automatically invokes the MCP server's search_fo_artifacts function. The server queries the xplusplus.ai artifact index and returns matching results with their local file paths.

Finding Your PackagesLocalDirectory

To enable local XML file reading, you need to set FO_LOCAL_ASSETS_PATH to your F&O installation:

Typical Windows path:

C:\Users\[YourName]\AppData\Local\Microsoft\Dynamics365\[version]\PackagesLocalDirectory

PowerShell command to find it:

Get-ChildItem "$env:LOCALAPPDATA\Microsoft\Dynamics365\" -Recurse -Filter "PackagesLocalDirectory" | Select-Object FullName

Note: Use double backslashes (\\) in the TOML config file for Windows paths, or use forward slashes (/).

Troubleshooting

MCP server not starting?

No results returned?

Ready to Start?

Get your API key and start using AI-assisted F&O development with Codex

Get API Key Back to MCP Server