mcp-manager
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseManage Codex MCP servers with explicit scope and conflict handling.
通过明确的作用域和冲突处理来管理Codex MCP服务器。
Command Reference
命令参考
Use Codex CLI as the primary interface:
bash
codex mcp list
codex mcp list --json
codex mcp get <name>
codex mcp add <name> -- <command> [args...]
codex mcp add <name> --url <url> [--bearer-token-env-var <ENV_VAR>]
codex mcp remove <name>Use these config table shapes when editing TOML directly:
toml
[mcp_servers.example]
command = "npx"
args = ["-y", "@upstash/context7-mcp"]
[mcp_servers.example.env]
API_KEY = "value"toml
[mcp_servers.example]
url = "https://example.com/mcp"
bearer_token_env_var = "MCP_TOKEN"将Codex CLI作为主要交互接口:
bash
codex mcp list
codex mcp list --json
codex mcp get <name>
codex mcp add <name> -- <command> [args...]
codex mcp add <name> --url <url> [--bearer-token-env-var <ENV_VAR>]
codex mcp remove <name>直接编辑TOML文件时,请使用以下配置表格式:
toml
[mcp_servers.example]
command = "npx"
args = ["-y", "@upstash/context7-mcp"]
[mcp_servers.example.env]
API_KEY = "value"toml
[mcp_servers.example]
url = "https://example.com/mcp"
bearer_token_env_var = "MCP_TOKEN"Required Decision Flow
必备决策流程
Follow this sequence for every install/update request.
- Resolve target server details by input type (URL vs name).
- Present a short MCP summary to the user before install.
- Ask for install scope.
- Check whether server already exists in the chosen scope.
- Ask for conflict action if it exists.
- Ask for options before writing config (required + optional env vars, bearer token env var, server name).
- Ask for final installation confirmation.
- Apply change and verify.
Do not skip user choices when ambiguity exists.
Do not write config until step 7 is explicitly completed.
针对每一次安装/更新请求,都需遵循以下步骤:
- 根据输入类型(URL或名称)解析目标服务器的详细信息。
- 在安装前向用户展示简短的MCP摘要。
- 询问用户选择安装作用域。
- 检查所选作用域中是否已存在该服务器条目。
- 若条目已存在,询问用户选择冲突处理方式。
- 在写入配置前,询问用户选择所需选项(必填及可选环境变量、Bearer令牌环境变量、服务器名称)。
- 向用户确认最终安装操作。
- 执行更改并进行验证。
存在歧义时,不得跳过用户选择步骤。
在完成第7步前,不得写入配置。
Source Validation By Input Type
按输入类型进行源验证
Always validate MCP details before deciding command/url config:
- If user provides a URL:
- Open/fetch that URL directly and read the install section.
- Confirm repository/package/server name, transport type, launch command or endpoint, and auth/env requirements from the source.
- Do not rely on memory-only fast path without opening the provided URL.
- If user provides only a name:
- Search for the MCP first, then open the most relevant official source (repo/docs/registry page).
- Confirm the same fields (name, transport, launch method, auth/env requirements) from that source.
- If multiple candidates exist, present concise options and ask user to choose before install.
If verification is incomplete or conflicting, ask a clarification question and wait.
在确定命令/URL配置前,务必先验证MCP的详细信息:
- 若用户提供URL:
- 直接打开/获取该URL并读取安装部分内容。
- 从源内容中确认仓库/包/服务器名称、传输类型、启动命令或端点,以及认证/环境要求。
- 不得仅依赖记忆的快捷路径,必须打开用户提供的URL。
- 若用户仅提供名称:
- 先搜索该MCP,然后打开最相关的官方源(仓库/文档/注册表页面)。
- 从该源中确认相同的字段(名称、传输方式、启动方法、认证/环境要求)。
- 若存在多个候选结果,需向用户展示简洁的选项并让用户选择后再进行安装。
若验证不完整或存在冲突,请提出澄清问题并等待用户回复。
Pre-Install MCP Summary
安装前的MCP摘要
Before any scope/conflict/env questions, provide a brief MCP summary from validated sources:
- what the MCP does (1 line)
- official install/launch method to be used
- auth/env expectations (required vs optional)
- chosen server name (or proposed default name)
Only after this summary, proceed with structured install prompts.
在询问作用域/冲突/环境相关问题前,需从已验证的源中提供简短的MCP摘要:
- MCP的功能(1句话)
- 将使用的官方安装/启动方法
- 认证/环境预期(必填 vs 可选)
- 选定的服务器名称(或建议的默认名称)
只有在展示此摘要后,才能继续进行结构化的安装提示。
Non-Skippable Prompt Gate
不可跳过的提示关卡
Before any or config edit, the assistant must collect an explicit user answer for each applicable prompt:
codex mcp add- Scope selected (or
project) unless already specified by user.global - Conflict action selected if server name already exists.
- Env/auth options prompt asked with available options and defaults.
- Final install confirmation received.
If any gate is unanswered, stop and ask. Do not proceed with a "minimal default" install.
在执行任何命令或编辑配置前,助手必须收集用户对每个适用提示的明确答复:
codex mcp add- 选定作用域(或
project),除非用户已明确指定。global - 若服务器名称已存在,选定冲突处理方式。
- 询问环境/认证选项提示,提供可用选项及默认值。
- 收到最终的安装确认。
若有任何一个关卡未得到答复,需停止操作并询问用户。不得进行“最小默认值”安装。
Questioning Mode Policy
提问模式规则
Collect user choices with this mode-specific policy:
- If tool is available, use it first.
request_user_input - If unavailable (for example Default mode), ask in normal chat.
In both cases, ask once in a single structured prompt that covers all applicable fields:
- scope (or
project)global - conflict action (only if existing server name is found)
- env/auth options with defaults, and which values user wants to set
- server name (only if needed)
- final confirmation (or
install now)cancel
Do not split these into multiple back-and-forth prompts unless the user answer is incomplete.
需遵循以下模式特定规则收集用户选择:
- 若工具可用,优先使用该工具。
request_user_input - 若不可用(例如默认模式),则在普通聊天中提问。
在两种情况下,都需在一个结构化提示中一次性询问所有适用字段:
- 作用域(或
project)global - 冲突处理方式(仅在发现现有服务器名称时询问)
- 带默认值的环境/认证选项,以及用户想要设置的值
- 服务器名称(仅在需要时询问)
- 最终确认(或
install now)cancel
除非用户的答复不完整,否则不得将这些问题拆分为多次来回提问。
Env Option Prompting Rules
环境选项提问规则
For env/auth, do not ask a binary yes/no question.
- List available options and describe each briefly.
- Show default behavior/value for each option when user does not provide one.
- Ask user which options to set and what values to use.
- Apply only values explicitly provided by the user.
- If user provides nothing, proceed with documented defaults.
对于环境/认证问题,不得使用二元的是/否提问。
- 列出可用选项并简要描述每个选项。
- 展示用户未提供值时每个选项的默认行为/值。
- 询问用户想要设置哪些选项及其对应的值。
- 仅应用用户明确提供的值。
- 若用户未提供任何值,则使用文档中记录的默认值。
Scope Selection
作用域选择
Always ask this first unless user already specified scope:
- : write to
Project scopein current repository../.codex/config.toml - : write to
Global scope.~/.codex/config.toml
Prefer project scope for repo-specific tools; prefer global scope for reusable personal tools.
除非用户已明确指定,否则必须首先询问作用域:
- :写入当前仓库中的
Project scope。./.codex/config.toml - :写入
Global scope。~/.codex/config.toml
针对仓库专属工具,优先选择项目级作用域;针对可复用的个人工具,优先选择全局级作用域。
Existing Server Handling
现有服务器处理
If the same server name exists in chosen scope, ask user to choose:
- (no change).
Keep existing - (replace command/url/options for same name).
Update in place - .
Remove and re-add - .
Use a new name
Never overwrite existing entries silently.
若所选作用域中已存在相同的服务器名称,需让用户选择:
- (保留现有条目,不做更改)。
Keep existing - (替换现有条目的命令/URL/选项)。
Update in place - (删除现有条目后重新添加)。
Remove and re-add - (使用新的服务器名称)。
Use a new name
不得静默覆盖现有条目。
Install from GitHub URL
从GitHub URL安装
When user gives a GitHub repo URL:
- Inspect repo docs quickly to find the official MCP launch method.
- Infer transport type:
- if docs provide executable command (
stdio,npx, binary, docker command).uvx - if docs provide MCP endpoint URL.
streamable HTTP
- Extract required options:
- : executable command, args, optional env vars.
stdio - : URL, optional bearer token env var.
HTTP
- If still ambiguous, ask a focused clarification question before writing config.
Known fast path:
- ->
https://github.com/upstash/context7npx -y @upstash/context7-mcp
Fast path only resolves command/args. It does not skip the decision flow or prompt gate.
当用户提供GitHub仓库URL时:
- 快速查看仓库文档,找到官方的MCP启动方法。
- 推断传输类型:
- 若文档提供可执行命令(、
npx、二进制文件、Docker命令),则为uvx类型。stdio - 若文档提供MCP端点URL,则为类型。
streamable HTTP
- 提取所需选项:
- :可执行命令、参数、可选环境变量。
stdio - :URL、可选Bearer令牌环境变量。
HTTP
- 若仍存在歧义,在写入配置前需提出明确的澄清问题。
已知快捷路径:
- ->
https://github.com/upstash/context7npx -y @upstash/context7-mcp
快捷路径仅用于解析命令/参数,不得跳过决策流程或提示关卡。
Apply Changes
执行更改
Use this implementation strategy:
- Global scope:
- Prefer .
codex mcp add/remove/get/list - Project scope:
- Edit directly with
./.codex/config.tomlblocks.[mcp_servers.<name>] - Create if missing.
./.codex/config.toml
When adding stdio server in project scope, write:
toml
[mcp_servers.context7]
command = "npx"
args = ["-y", "@upstash/context7-mcp"]When adding HTTP server in project scope, write:
toml
[mcp_servers.<name>]
url = "https://host/path"
bearer_token_env_var = "TOKEN_ENV_VAR"使用以下实现策略:
- 全局级作用域:
- 优先使用命令。
codex mcp add/remove/get/list - 项目级作用域:
- 直接编辑文件,添加
./.codex/config.toml块。[mcp_servers.<name>] - 若文件不存在,需创建该文件。
./.codex/config.toml
在项目级作用域中添加stdio服务器时,需写入:
toml
[mcp_servers.context7]
command = "npx"
args = ["-y", "@upstash/context7-mcp"]在项目级作用域中添加HTTP服务器时,需写入:
toml
[mcp_servers.<name>]
url = "https://host/path"
bearer_token_env_var = "TOKEN_ENV_VAR"Verification Checklist
验证清单
After changes:
- Confirm config file changed in expected scope.
- Confirm entry shape is valid (+
command, orargs).url - Run scope-appropriate check:
- Global: or
codex mcp get <name>.codex mcp list --json - Project: inspect and verify table values.
./.codex/config.toml
- Report what was installed, where, and any env vars user must set.
执行更改后:
- 确认配置文件在预期的作用域中已更改。
- 确认条目格式有效(+
command,或args)。url - 执行与作用域对应的检查:
- 全局级:或
codex mcp get <name>。codex mcp list --json - 项目级:检查文件并验证表中的值。
./.codex/config.toml
- 向用户报告已安装的内容、安装位置,以及用户必须设置的任何环境变量。
User Interaction Templates
用户交互模板
Use concise prompts like:
Choose install scope: project (./.codex/config.toml) or global (~/.codex/config.toml)?Server "context7" already exists in project scope. Choose: keep, update, remove+re-add, or new name?Available env/auth options: API_KEY (default: not set, lower rate limits). Provide only the values you want to set; unspecified options will use defaults.Final check: proceed with installation using the resolved settings? (install now/cancel)
Keep questions short and only ask what is required to proceed safely.
Single structured prompt template (preferred):
Please answer these in one message: (1) scope: project/global, (2) if server exists: keep/update/remove+re-add/new name, (3) env/auth options you want to set from the list below and their values (unspecified options use defaults), (4) final confirmation: install now/cancel.使用简洁的提示语,例如:
选择安装作用域:project (./.codex/config.toml) 或 global (~/.codex/config.toml)?服务器"context7"已存在于项目级作用域中。请选择:保留、更新、删除后重新添加,或使用新名称?可用的环境/认证选项:API_KEY(默认:未设置,速率限制较低)。请仅提供您想要设置的值;未指定的选项将使用默认值。最终确认:是否使用已确定的设置进行安装?(install now/cancel)
问题需保持简短,仅询问继续操作所需的必要内容。
首选的结构化提示模板:
请在一条消息中回复以下内容:(1) 作用域:project/global,(2) 若服务器已存在:保留/更新/删除后重新添加/使用新名称,(3) 您想要从以下列表中设置的环境/认证选项及其对应的值(未指定的选项将使用默认值),(4) 最终确认:install now/cancel。