Skip to content

fix: support Codex MCP import from TOML config#31

Open
npo-mmenke wants to merge 1 commit intonicobailon:mainfrom
npo-mmenke:codex-toml-import
Open

fix: support Codex MCP import from TOML config#31
npo-mmenke wants to merge 1 commit intonicobailon:mainfrom
npo-mmenke:codex-toml-import

Conversation

@npo-mmenke
Copy link
Copy Markdown

@npo-mmenke npo-mmenke commented Apr 2, 2026

Problem

pi-mcp-adapter currently imports Codex MCP servers from ~/.codex/config.json
and expects them under mcpServers.

In current Codex installations, MCP servers are stored in
~/.codex/config.toml under [mcp_servers.<name>] instead.

That means Pi's imports: ["codex"] does not pick up MCP servers from a
modern Codex setup, even though codex mcp list shows them correctly.

What this changes

  • prefer ~/.codex/config.toml when importing Codex MCP config
  • read Codex TOML entries from mcp_servers
  • fall back to ~/.codex/config.json / mcpServers for backward compatibility
  • continue to the JSON fallback if config.toml exists but is invalid
  • surface warnings during provenance/import parsing instead of silently swallowing them

Tests

Added coverage for:

  • importing Codex MCP servers from TOML
  • falling back to JSON when TOML is absent
  • falling back to JSON when TOML is invalid
  • provenance behavior for invalid TOML fallback

Verification

  • npm test -- __tests__/config-imports.test.ts
  • npm test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant