Panniantong/Agent-Reach · error · McporterConfigError
mcporter 配置查询失败
Error message
mcporter 配置查询失败
What it means
During the Exa setup flow, the CLI shells out to `mcporter config list --json` (10s timeout). If that subprocess exits non-zero, it raises McporterConfigError('mcporter 配置查询失败') — the mcporter tool is installed enough to invoke but its config listing failed. The message is Chinese: 'mcporter config query failed'.
Source
Thrown at agent_reach/cli.py:2029
print(" 安装:npm install -g mcporter")
print(" 然后:mcporter config add exa https://mcp.exa.ai/mcp --scope home")
print()
else:
try:
from agent_reach.channels.mcporter import (
McporterConfigError,
configured_server_names,
)
r = subprocess.run(
["mcporter", "config", "list", "--json"],
capture_output=True,
encoding="utf-8",
errors="replace",
timeout=10,
)
if r.returncode != 0:
raise McporterConfigError("mcporter 配置查询失败")
if "exa" in configured_server_names(r.stdout):
print(" 当前状态: ✅ 已配置")
else:
print(" 当前状态: -- 未配置")
setup_now = input(" 现在自动配置 Exa 吗?[Y/n]: ").strip().lower()
if setup_now in ("", "y", "yes"):
add_r = subprocess.run(
[
"mcporter",
"config",
"add",
"exa",
"https://mcp.exa.ai/mcp",
"--scope",
"home",
],
capture_output=True, encoding="utf-8", errors="replace", timeout=10,
)View on GitHub (pinned to 93ae1d18c3)
Solutions
- Run `mcporter config list --json` manually and read its stderr to find the real failure
- If the output shows a corrupt config, repair or remove mcporter's config file and re-initialize
- Upgrade/downgrade mcporter to a version whose CLI supports `config list --json`
- If mcporter is not needed, skip the Exa flow and configure the MCP server by other means (see config/mcporter.json)
Example fix
# before: blind interactive attempt agent-reach configure # choose Exa setup, hits 配置查询失败 # after: diagnose the underlying mcporter failure first mcporter config list --json; echo "exit=$?" # fix whatever it reports, then re-run the Exa setup
Defensive patterns
Strategy: try-catch
Validate before calling
import subprocess
def mcporter_list_ok() -> bool:
try:
r = subprocess.run(
["mcporter", "config", "list", "--json"],
capture_output=True, text=True, timeout=10,
)
return r.returncode == 0
except (OSError, subprocess.TimeoutExpired):
return False
if not mcporter_list_ok():
skip_exa_setup_with_warning() Try / catch
from agent_reach.cli import McporterConfigError # if importing the flow programmatically
try:
run_exa_setup()
except McporterConfigError:
log.warning("Exa setup skipped: mcporter config list failed; run `mcporter config list --json` to diagnose") Prevention
- Verify `mcporter config list --json` succeeds in CI before enabling Exa setup steps
- Pin the mcporter version so `config list --json` CLI support cannot silently disappear
- Keep a manual Exa configuration path documented as fallback
When it happens
Trigger: Running the interactive Exa configuration step (answering Y to '现在自动配置 Exa 吗?' path, or the status check preceding it) when `mcporter config list` errors: corrupt mcporter config file, incompatible mcporter version without --json support, or mcporter failing on startup env problems.
Common situations: mcporter installed via a different package manager with a stale/corrupt ~/.mcporter config; mcporter major-version change altering CLI flags; partial npm installs leaving a broken shim that exits non-zero.
Related errors
- mcporter 返回的 JSON 无法解析
- mcporter JSON 缺少 servers 列表
- mcporter 配置缺少 mcpServers 对象
- mcporter 配置包含无效的 server name
- mcporter server 定义必须是对象
AI-assisted analysis of Panniantong/Agent-Reach@93ae1d18c3 (2026-08-14).
Data as JSON: /api/errors/e917500cc75f80ff.
Report an issue: GitHub.