Add an MCP server to both Claude Code and Codex configurations
Adds MCP servers to Claude Code and Codex configurations with validation and error handling.
/plugin marketplace add DuncanJurman/entropy-plugins/plugin install meta-unify@entropy-marketplaceYou are helping the user add an MCP server to their Claude Code and Codex configurations.
Parse $ARGUMENTS for MCP server details:
Check for these flags in $ARGUMENTS:
--claude-only: Only configure Claude Code--codex-only: Only configure Codex--project: Use project scope instead of user scope (default: user scope)If the user provided sufficient context (server name + command/URL), proceed to Step 2.
If missing required information, ask conversationally:
"I'll help you add an MCP server. I need a few details:
- What should this server be called? (e.g., 'context7', 'github')
- Is this a local server (runs a command) or remote server (connects to URL)?
- What command should start it / What URL should it connect to?
- Any environment variables needed (like API tokens)?"
Before configuring:
which npx)User Scope (default):
~/.claude.json (add to mcpServers object)~/.codex/config.toml (add [mcp_servers.NAME] section)Project Scope (--project flag):
.mcp.json in current directoryFor Claude (JSON format):
{
"mcpServers": {
"SERVER_NAME": {
"command": "command here",
"args": ["arg1", "arg2"],
"env": {
"KEY": "value"
}
}
}
}
For HTTP servers, use:
{
"mcpServers": {
"SERVER_NAME": {
"type": "http",
"url": "https://...",
"headers": {
"Authorization": "Bearer ${TOKEN_ENV_VAR}"
}
}
}
}
For Codex (TOML format):
[mcp_servers.SERVER_NAME]
command = "command here"
args = ["arg1", "arg2"]
[mcp_servers.SERVER_NAME.env]
KEY = "value"
For HTTP servers:
[mcp_servers.SERVER_NAME]
url = "https://..."
bearer_token_env_var = "TOKEN_ENV_VAR"
Report success with details:
"Added MCP server 'SERVER_NAME' to:
- Claude: ~/.claude.json
- Codex: ~/.codex/config.toml
Restart Claude Code and Codex to load the new server."
User input: "Add context7 using npx @upstash/context7-mcp"
User input: "Add the Figma MCP at https://mcp.figma.com with FIGMA_TOKEN"
For complete format specifications, invoke the meta-unify-core skill to access: