Error loading config.toml: invalid type: sequence, expected a string in `mcp_servers.perplexity.env.env_vars`
Resolved 💬 5 comments Opened Dec 10, 2025 by doggy8088 Closed Dec 10, 2025
💡 Likely answer: A maintainer (etraut-openai, contributor)
responded on this thread — see the highlighted reply below.
What version of Codex is running?
codex-cli 0.66.0
What subscription do you have?
ChatGPT Plus
Which model were you using?
gpt-5.1-codex-max
What platform is your computer?
Microsoft Windows NT 10.0.19045.0 x64
What issue are you seeing?
I followed this guide to setup my Perplexity MCP: https://github.com/openai/codex/blob/main/docs/config.md#stdio
My ~/.codex/config.toml file:
[mcp_servers.perplexity]
command = "npx"
args = ["-y", "@perplexity-ai/mcp-server"]
[mcp_servers.perplexity.env]
env_vars = [ "PERPLEXITY_API_KEY" ]
When run codex, it will produce:
Error loading config.toml: invalid type: sequence, expected a string
in `mcp_servers.perplexity.env.env_vars`
I believe this is a bug from Codex CLI.
What steps can reproduce the bug?
codex mcp add perplexity -- npx -y '@perplexity-ai/mcp-server'- Configure
~/.codex/config.tomladd env_vars to it - Run
codex
What is the expected behavior?
This is either document wrong or Codex CLI implementation wrong.
Additional information
<img width="994" height="113" alt="Image" src="https://github.com/user-attachments/assets/35cd3fa8-d04b-4384-9f39-37acdc6b0b60" />
5 Comments
The
env_varskey is valid only in the top-level table for the mcp server. Keys used in the.envsubtable represent individual environment variables, and their values must be strings. You're attempting to define an env variable namedenv_varshere.The guide you referenced isn't as clear as it could be. You may find this documentation to be clearer.
@etraut-openai Can you reopen this issue? It might be a documentation problem. The document provides an example
env_vars = ["API_KEY2"], which is incorrect. The problem still exists. Please don't close it until it is resolved.<img width="1338" height="721" alt="Image" src="https://github.com/user-attachments/assets/a82683ab-cd9c-4638-adc5-cc08423b5c2e" />
The document you mentioned is still vague to me. I'm unsure how to configure it. Can you provide more details?
<img width="1067" height="596" alt="Image" src="https://github.com/user-attachments/assets/ac0fc76c-1de6-4ee1-bb25-01584784e99c" />
@etraut-openai What exactly your mean about top-level table? I didn't get it.
By "top-level table", I mean
[mcp_servers.perplexity]in your example.This is valid and means "share the values of environment variables
FOOandBARwith this MCP server".This is valid and means "define values for environment variables
FOOandBARwhen calling this MCP server".This is not valid:
@etraut-openai Thank you! Hope the doc can be updated.