Skip to main content

qca-mcp-proxy

把 Qoder Cloud Agents(QCA)的远程 MCP 服务包一层 MCP 服务:只转发 session 相关工具,外加 list_agents / list_environments / list_vaults 三个只读查询和 list_files / get_file 两个文件元数据查询。其余工具(agent / environment / vault / skill / deployment 的写操作、session 资源等)既不列出也不可调用。

  • 上游:QCA 远程 MCP,Streamable HTTP + Authorization: Bearer <PAT>
  • 下游:只提供 stdio,给 Qoder / Claude Desktop 这类拉起子进程的客户端
  • 实现用 MCP Python SDK v2(mcp>=2,<3)
  • 工具列表每次 5 分钟内缓存一次,避免每次 tools/list 都打上游

暴露的工具(13 个)

分组 工具
session 生命周期 create_session get_session list_sessions update_session cancel_session
session 事件 send_session_events list_session_event_summaries list_session_events
只读查询 list_agents list_environments list_vaults
文件元数据 list_files(传 scope_id=<session_id> 查会话产出)get_file

工具名与参数 schema 全部原样透传上游,不做改写;返回的 content / structured_content / is_error 也原样返回。

刻意不在白名单里(tools/list 不返回,tools/call 也拒绝):

  • session 资源四件套 add_session_resource / get_session_resource / list_session_resources / delete_session_resource:文件、GitHub 仓库、memory store 只能在 create_session 的 resources 里一次性挂上,会话中途不能再挂
  • archive_session / delete_session:只能 cancel_session 停掉会话,清理交给控制台或 QCA_EXTRA_TOOLS 追加
  • agent / environment / vault / skill / deployment 的写操作全部隐藏,只留三个 list_*

安装

# 1) 直接跑源码(推荐本地开发)
uvx --from /Users/wbc/Desktop/ascend_adapter/qca-mcp-proxy qca-mcp-proxy --check

# 2) 从 git 安装
uvx --from git+https://github.com/<you>/qca-mcp-proxy qca-mcp-proxy

# 3) 装成常驻命令行
uv tool install /Users/wbc/Desktop/ascend_adapter/qca-mcp-proxy
qca-mcp-proxy --check

--check 会用当前 PAT 连一次上游,打印「上游工具数 / 已暴露 / 被隐藏」后退出,用来确认 PAT 和区域对不对。

配置

Qoder / 兼容 mcpServers 的客户端

args 里的 --from 有两种来源,按安装方式二选一。

从 git 安装(推荐,换机器不用改路径):

{
  "mcpServers": {
    "qca": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/xiaochus/qca_mcp_proxy", "qca-mcp-proxy"],
      "env": {
        "QCA_PAT": "<你的 PAT>",
        "QCA_REGION": "cn"
      }
    }
  }
}

从本机源码安装(改代码即时生效):

{
  "mcpServers": {
    "qca": {
      "command": "uvx",
      "args": ["--from", "/Users/wbc/Desktop/ascend_adapter/qca-mcp-proxy", "qca-mcp-proxy"],
      "env": {
        "QCA_PAT": "<你的 PAT>",
        "QCA_REGION": "cn"
      }
    }
  }
}

等价命令行(先在终端验证能不能起):

uvx --from git+https://github.com/xiaochus/qca_mcp_proxy qca-mcp-proxy --check

# 固定到某个 commit / tag,避免每次拉到不一样的代码
uvx --from git+https://github.com/xiaochus/qca_mcp_proxy@v0.1.0 qca-mcp-proxy --check

uvx 会把该仓库缓存到本地 ~/.cache/uv,改了远端代码后需要 --refresh 或清缓存才会更新。

环境变量

变量 必填 默认 说明
QCA_PAT 是 – 个人访问令牌;也接受 QODER_PAT / QCA_TOKEN,带不带 Bearer 前缀都可以
QCA_REGION 否 cn cn → https://mcp.qoder.cn/api/v1/mcp/servers/qca;global → https://mcp.qoder.com/api/v1/mcp/servers/qca
QCA_MCP_URL 否 由 region 决定 直接指定上游 MCP 地址,优先于 region
QCA_EXTRA_TOOLS 否 空 在默认白名单上追加工具(逗号分隔),例如 list_accessible_workspaces
QCA_ALLOWED_TOOLS 否 默认白名单 整体替换默认白名单(逗号分隔)
QCA_TOOLS_TTL 否 300 工具列表缓存秒数
QCA_CONNECT_TIMEOUT 否 30 连接上游超时(秒)
QCA_READ_TIMEOUT 否 300 上游单次读取超时(秒)
QCA_DEBUG 否 关 1 打开 DEBUG 日志(含 SDK 与 HTTP 层)

常用扩展例子:

# 需要工作区选择能力时
QCA_EXTRA_TOOLS=list_accessible_workspaces

# 只要读,不要写
QCA_ALLOWED_TOOLS=get_session,list_sessions,list_session_event_summaries,list_session_events,list_agents,list_environments,list_vaults,list_files,get_file

典型用法

  1. list_agents / list_environments / list_vaults 拿到 agent_xxx / env_xxx / vault_xxx
  2. create_session 传 agent + environment_id(需要凭证时再传 vault_ids,需要挂载文件/仓库/记忆库时传 resources)
  3. send_session_events 发一条 user.message 事件
  4. list_session_event_summaries 轮询进度(不带载荷,省 token),需要内容时再用 list_session_events 加 types 过滤、limit 调小
  5. 取产物:list_files 传 scope_id=<session_id> 拿到 file_id,再用 get_file 看元数据;真正下载要走 QCA 的 HTTP API GET /files/{id}/content,上游 MCP 与本代理都不提供
  6. 结束:cancel_session(没有归档/删除权限)

行为约定

  • 启动即连上游:生命周期里建立一条长连接,PAT 无效或区域不匹配时启动直接失败,stderr 会给出换区域的提示(日志只走 stderr,stdout 留给协议)。这样也避免了在请求处理任务里创建 MCP 客户端任务组导致的 cancel scope 破坏。
  • 写操作不重试:create_session / send_session_events 等调用失败不再自动重放,避免上游重复执行;失败以 is_error=true 的工具结果返回,模型可自行决定下一步。
  • 未授权工具双重拦截:tools/list 不返回,tools/call 也直接拒绝并给出可调用的工具名。
  • 不暴露 resources / prompts:上游只有 tools,本代理也只声明 tools 能力。

Metadata

Release files for qca-mcp-proxy 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qca-mcp-proxy 0.2.0
File Size Uploaded Provenance Actions
qca_mcp_proxy-0.2.0.tar.gz 14.8 kB Without provenance Details for qca_mcp_proxy-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for qca-mcp-proxy 0.2.0
File Interpreter ABI Platform Actions
qca_mcp_proxy-0.2.0-py3-none-any.whl Python 3 none any Details for qca_mcp_proxy-0.2.0-py3-none-any.whl

Total release size: 27.2 kB

Release files / qca_mcp_proxy-0.2.0.tar.gz

Download URL qca_mcp_proxy-0.2.0.tar.gz
Size 14.8 kB
Tags Source
SHA-256 checksum
How to use checksums
eb8154d1751718e8d5fc68a5f85f19b60ac098243175423656a5628613b7cfbe
BLAKE2b-256 checksum
How to use checksums
d3b1d25dc815a23bd20ceb88638ba61a0a1d99cf0880c339645604c8ad3f59a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / qca_mcp_proxy-0.2.0-py3-none-any.whl

Download URL qca_mcp_proxy-0.2.0-py3-none-any.whl
Size 12.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f6579458906703ae09ace09ef8c09efae9ac4b78a88b510fb8c0bbb8572df666
BLAKE2b-256 checksum
How to use checksums
8cabcbe13fbdb334d978b70ead34beaac6173dc764ff3690fad7d8c5d7f12145
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Security for qca-mcp-proxy 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page