Skip to content

fix: set MCPORTER_CONFIG env for all mcporter subprocess calls#74

Open
jygzyc wants to merge 1 commit intoPanniantong:mainfrom
jygzyc:bugfix
Open

fix: set MCPORTER_CONFIG env for all mcporter subprocess calls#74
jygzyc wants to merge 1 commit intoPanniantong:mainfrom
jygzyc:bugfix

Conversation

@jygzyc
Copy link
Contributor

@jygzyc jygzyc commented Mar 5, 2026

Summary

  • Add get_mcporter_env() static method to base Channel class to set MCPORTER_CONFIG environment variable
  • Update all mcporter subprocess calls to use this environment for consistent config path resolution
  • Update documentation to include export MCPORTER_CONFIG=~/.mcporter/mcporter.json instruction

Changes

  • base.py: Add get_mcporter_env() method
  • bosszhipin.py, douyin.py, exa_search.py, linkedin.py, xiaohongshu.py: Pass env=self.get_mcporter_env() to subprocess calls
  • setup-exa.md, setup-xiaohongshu.md, install.md: Add MCPORTER_CONFIG export instruction

This ensures all mcporter commands use the correct config file location.

Copy link
Owner

@Panniantong Panniantong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感谢 PR!想确认一下这个修改解决的具体场景是什么?

mcporter 默认会读取 ~/.mcporter/mcporter.json,正常安装流程(agent-reach install)不需要手动设置 MCPORTER_CONFIG 环境变量。

如果是特定环境下 mcporter 找不到配置文件的问题,能否补充一下复现步骤?这样我们可以判断是在 Agent Reach 层面修还是在 mcporter 层面修。

另外有个顾虑:硬编码 ~/.mcporter/mcporter.json 会影响配置文件不在默认路径的用户(比如 OpenClaw 用户的 mcporter 配置在 workspace 目录下),可能导致 doctor 误报。

@jygzyc
Copy link
Contributor Author

jygzyc commented Mar 5, 2026

感谢 PR!想确认一下这个修改解决的具体场景是什么?

mcporter 默认会读取 ~/.mcporter/mcporter.json,正常安装流程(agent-reach install)不需要手动设置 MCPORTER_CONFIG 环境变量。

如果是特定环境下 mcporter 找不到配置文件的问题,能否补充一下复现步骤?这样我们可以判断是在 Agent Reach 层面修还是在 mcporter 层面修。

另外有个顾虑:硬编码 ~/.mcporter/mcporter.json 会影响配置文件不在默认路径的用户(比如 OpenClaw 用户的 mcporter 配置在 workspace 目录下),可能导致 doctor 误报。

我这边经过正常安装流程之后,默认会在 $HOME 目录下新建一个 config 目录,所以我增加设置环境变量的部分

@Panniantong
Copy link
Owner

Hi @jygzyc 👋 Thanks for the PR!

Before we proceed, could you share what specific issue you ran into? Was mcporter unable to find its config file in certain environments?

A few thoughts on the current approach:

  1. agent-reach install already configures mcporter — during installation, mcporter config add writes to the default config path. So in most cases, mcporter should find its config without needing MCPORTER_CONFIG explicitly set.

  2. Adding env= to every subprocess call is quite invasive (9 files changed). If there's a specific scenario where mcporter can't find its config, we might be able to fix it more simply — e.g., ensuring the install step writes to the right default path, or setting the env var once at install time in the user's shell profile.

  3. Adding export MCPORTER_CONFIG=... to user-facing docs adds a manual step that ideally shouldn't be needed.

Could you describe the scenario where this breaks? For example:

  • Running as a different user than who installed?
  • Using a non-standard HOME?
  • Running inside a container?

Happy to work together on a targeted fix once we understand the root cause 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants