mcpServers block you already have in Claude Code, Cursor, VS Code, Gemini CLI, Codex, or PraisonAI YAML, and give its tools to an agent. You don’t need to rewrite it as MCP(command=..., args=...).
Import
parse_mcp_servers from praisonaiagents.mcp. The top-level praisonaiagents package does not export it.Which config shapes are accepted?
parse_mcp_servers looks for the servers under mcpServers, servers, mcp_servers, or mcp.servers, in that order. If none of these keys holds a mapping, it treats the whole dict as {name: entry}. An entry can also be a plain command string, such as {"fs": "npx -y @modelcontextprotocol/server-filesystem /tmp"}.
Quick Start
1
Paste an editor config
2
Load every server at once
3
Expand ${VAR} from the environment
4
Codex-style bearer token
How It Works
parse_mcp_servers only changes the shape of the config. It leaves ${VAR} exactly as written. MCP.from_config builds the client, and it also accepts a raw editor entry, so you can skip parse_mcp_servers when you only have one server.
Field mapping
The fields
name, description, trust, alwaysAllow, autoApprove, and startup_timeout_sec are dropped without a warning. Any other unknown field is dropped and a warning is logged.
Normalised entry
MCP.from_config parameters
Safety behaviour
- Disabled servers (
"disabled": trueor"enabled": false) raiseValueErrorwhen you build them. expand_env=Truedoes not modify your original dict.- Leave
expand_envoff for entries that a loader has already interpolated, so nothing is expanded twice. parse_mcp_serversdoes not check whether a server is trusted. If you read a project file that someone else wrote, filter it withdrop_untrusted_mcp_serversfrompraisonaiagents.mcp.trustfirst.
Common Patterns
Import a Claude Code project config
Import a Claude Code project config
PraisonAI YAML mcp.servers block
PraisonAI YAML mcp.servers block
Filter tools with Gemini CLI fields
Filter tools with Gemini CLI fields
Best Practices
Keep secrets as ${VAR}
Keep secrets as ${VAR}
Write tokens as
${VAR} in your config and pass expand_env=True. That way the secret stays out of the config file.Prefer streamable HTTP for authenticated servers
Prefer streamable HTTP for authenticated servers
Legacy SSE cannot send headers. Use a Streamable HTTP URL, or set
"type": "streamable-http".Name each server
Name each server
Pass
name= so that errors and warnings tell you which server failed.Related
MCP
The base MCP client and its construction forms
MCP YAML Configuration
Declare MCP servers in YAML workflows

