Skip to content

fix(acpx): pass MCP server configuration to ACP sessions#39337

Closed
goodspeed-apps wants to merge 1 commit intoopenclaw:mainfrom
goodspeed-apps:fix/issue-39225-acpx-mcp-servers
Closed

fix(acpx): pass MCP server configuration to ACP sessions#39337
goodspeed-apps wants to merge 1 commit intoopenclaw:mainfrom
goodspeed-apps:fix/issue-39225-acpx-mcp-servers

Conversation

@goodspeed-apps
Copy link
Copy Markdown
Contributor

Problem

The ACPX runtime was ignoring MCP server configurations, always passing mcpServers: [] to the underlying acpx CLI. This prevented users from using external MCP servers like Canva's MCP with OpenClaw's ACP runtime.

Solution

This PR adds support for configuring MCP servers in the ACPX plugin configuration and passes them to the acpx CLI when creating new sessions.

Changes

  • Added McpServerConfig type and validation
  • Updated runtime to pass MCP servers to acpx CLI
  • Updated service logging
  • Added config schema for MCP servers
  • Added comprehensive tests

Testing

  • Added config.test.ts with tests for config validation
  • Verified that mcpServers are correctly passed to acpx

Fixes #39225

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 8, 2026

Greptile Summary

This PR fixes a bug where the ACPX runtime always passed an empty mcpServers array to the underlying acpx CLI, preventing users from configuring external MCP servers. The fix adds:

  • McpServerConfig type with thorough validation in config.ts
  • JSON schema for the plugin configuration UI with full MCP server structure
  • Proper passing of MCP server config to acpx CLI in runtime.ts (only when creating new sessions)
  • Service logging of configured MCP server count
  • Comprehensive test coverage

The implementation is correct and well-tested. One minor code quality issue: an unused destructured variable key in the env validation loop should be prefixed with underscore to suppress linter warnings.

Confidence Score: 4/5

  • Safe to merge after fixing the unused variable linting warning.
  • The PR correctly implements MCP server config passing with comprehensive validation and tests. The core logic is sound. One minor code quality issue—an unused variable that will trigger linter warnings—needs to be fixed before merge. This is a quick fix that doesn't affect functionality.
  • extensions/acpx/src/config.ts — Fix unused variable key by prefixing with underscore on line 93.

Last reviewed commit: 628ba1e

Comment on lines +93 to +95
for (const [key, val] of Object.entries(value.env)) {
if (typeof val !== "string") return false;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The variable key is destructured but never used. This will trigger TypeScript's noUnusedLocals (or ESLint equivalent) warnings. Prefix with an underscore to suppress:

Suggested change
for (const [key, val] of Object.entries(value.env)) {
if (typeof val !== "string") return false;
}
for (const [_key, val] of Object.entries(value.env)) {
if (typeof val !== "string") return false;
}
Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/acpx/src/config.ts
Line: 93-95

Comment:
The variable `key` is destructured but never used. This will trigger TypeScript's `noUnusedLocals` (or ESLint equivalent) warnings. Prefix with an underscore to suppress:

```suggestion
    for (const [_key, val] of Object.entries(value.env)) {
      if (typeof val !== "string") return false;
    }
```

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 628ba1eaad

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

}),
cwd,
fallbackCode: "ACP_SESSION_INIT_FAILED",
mcpServers: this.config.mcpServers,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Pass MCP server config on the main ensure-session path

mcpServers is only attached in the fallback sessions new branch, but ensureSession first calls sessions ensure and accepts that result whenever it already returns session IDs (the normal behavior). In that common path, the CLI never receives --mcpServers, so configured MCP servers are still not applied to sessions despite this change.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

@xkonjin xkonjin left a comment

Choose a reason for hiding this comment

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

Quick review pass:

  • Main risk area here is auth/session state and stale credential handling.
  • Good to see test coverage move with the code; I’d still make sure it exercises the unhappy path around auth/session state and stale credential handling rather than only the happy path.
  • Before merge, I’d smoke-test the behavior touched by openclaw.plugin.json, config.test.ts, config.ts (+2 more) with malformed input / retry / rollback cases, since that’s where this class of change usually breaks.
  • Cancellation paths are notoriously flaky; a deterministic test proving cleanup happens on abort/timeout would reduce regression risk.

@steipete
Copy link
Copy Markdown
Contributor

steipete commented Mar 8, 2026

Landed on main in 5659d7f.
Source PR head: 628ba1e.

The original PR direction exposed the right config surface, but bundled acpx 0.1.15 does not support a --mcpServers CLI flag and still hardcodes mcpServers: [] on session bootstrap. I landed a fix-up that keeps bundled acpx unchanged and routes MCP-configured sessions through a small ACP bootstrap proxy via --agent, so session/new, session/load, and session/fork receive the configured MCP servers while acpx auth/queue behavior stays intact.

Validated with:

  • pnpm lint
  • pnpm build
  • pnpm test

Landed commit:
5659d7f

Source commit:
628ba1e

Thanks @goodspeed-apps.

@steipete steipete closed this Mar 8, 2026
mrosmarin added a commit to mrosmarin/openclaw that referenced this pull request Mar 8, 2026
* main: (290 commits)
  test: stabilize exec resolver timeout fixture
  chore: add changelog and format fix for openclaw#39414
  fix(chat): preserve sender labels in dashboard history
  docs: clean up latest changelog sections
  docs: dedupe changelog contributor attribution
  fix(ci): resolve current gate regressions
  refactor(voice-call): share tts deep merge
  fix: land openclaw#39337 by @goodspeed-apps for acpx MCP bootstrap
  fix(ci): resolve type regressions on main
  fix: document discord agentComponents schema parity (openclaw#39378) (thanks @gambletan) (openclaw#39378)
  fix(discord): validate agentComponents config
  test: cover daemon probe auth seam
  refactor: preserve explicit mock voice-call values
  refactor: register gateway service adapters
  refactor: reuse shared gateway probe auth
  refactor: split daemon status gathering
  refactor: centralize strict numeric parsing
  refactor: normalize voice-call runtime defaults
  fix(ci): pin multi-arch docker base digests
  docs: add changelog for Telegram DM draft restore (openclaw#39398)
  ...
mcaxtr pushed a commit to mcaxtr/openclaw that referenced this pull request Mar 8, 2026
Saitop pushed a commit to NomiciAI/openclaw that referenced this pull request Mar 8, 2026
GordonSH-oss pushed a commit to GordonSH-oss/openclaw that referenced this pull request Mar 9, 2026
jenawant pushed a commit to jenawant/openclaw that referenced this pull request Mar 10, 2026
dhoman pushed a commit to dhoman/chrono-claw that referenced this pull request Mar 11, 2026
senw-developers pushed a commit to senw-developers/va-openclaw that referenced this pull request Mar 17, 2026
V-Gutierrez pushed a commit to V-Gutierrez/openclaw-vendor that referenced this pull request Mar 17, 2026
alexey-pelykh added a commit to remoteclaw/remoteclaw that referenced this pull request Mar 22, 2026
Co-authored-by: Goodspeed App Studio <[email protected]>
(cherry picked from commit 5659d7f)

# Conflicts:
#	extensions/acpx/openclaw.plugin.json
#	extensions/acpx/src/config.test.ts
#	extensions/acpx/src/config.ts
#	extensions/acpx/src/runtime-internals/test-fixtures.ts
#	extensions/acpx/src/runtime.test.ts
#	extensions/acpx/src/runtime.ts
#	extensions/acpx/src/service.ts
alexey-pelykh added a commit to remoteclaw/remoteclaw that referenced this pull request Mar 22, 2026
…r live test fixes (#1795)

* Changelog: credit openclaw#39328 to @vincentkoc

(cherry picked from commit 2ec478c)

* Changelog: move openclaw#39328 credit to section end

(cherry picked from commit 5b30c9d)

* Pi Runner: gate parallel_tool_calls to compatible APIs (openclaw#39356)

* Pi Runner: gate parallel_tool_calls payload injection

* Pi Runner: cover parallel_tool_calls alias precedence

* Changelog: note parallel_tool_calls compatibility fix

* Update CHANGELOG.md

* Pi Runner: clarify null parallel_tool_calls override logging

(cherry picked from commit daecd2d)

# Conflicts:
#	CHANGELOG.md
#	src/agents/pi-embedded-runner-extraparams.test.ts
#	src/agents/pi-embedded-runner/extra-params.ts

* docs: add changelog for Telegram DM draft restore (openclaw#39398)

(cherry picked from commit 722c5e5)

* fix: document discord agentComponents schema parity (openclaw#39378) (thanks @gambletan) (openclaw#39378)

Co-authored-by: Shadow <[email protected]>
(cherry picked from commit 9c8e34d)

* fix: land openclaw#39337 by @goodspeed-apps for acpx MCP bootstrap

Co-authored-by: Goodspeed App Studio <[email protected]>
(cherry picked from commit 5659d7f)

# Conflicts:
#	extensions/acpx/openclaw.plugin.json
#	extensions/acpx/src/config.test.ts
#	extensions/acpx/src/config.ts
#	extensions/acpx/src/runtime-internals/test-fixtures.ts
#	extensions/acpx/src/runtime.test.ts
#	extensions/acpx/src/runtime.ts
#	extensions/acpx/src/service.ts

* docs: clean up latest changelog sections

(cherry picked from commit c743fd9)

* fix: land contributor PR openclaw#39516 from @Imhermes1

macOS app/chat/browser/cron/permissions fixes.

Co-authored-by: ImHermes1 <[email protected]>
(cherry picked from commit d15b6af)

# Conflicts:
#	CHANGELOG.md
#	apps/macos/Sources/RemoteClaw/NodeMode/MacNodeBrowserProxy.swift
#	apps/macos/Sources/RemoteClaw/NodeMode/MacNodeModeCoordinator.swift
#	apps/macos/Sources/RemoteClaw/NodeMode/MacNodeRuntime.swift
#	apps/macos/Sources/RemoteClaw/PermissionsSettings.swift
#	apps/macos/Tests/RemoteClawIPCTests/MacNodeBrowserProxyTests.swift
#	apps/shared/RemoteClawKit/Sources/RemoteClawChatUI/ChatView.swift
#	apps/shared/RemoteClawKit/Sources/RemoteClawKit/BrowserCommands.swift
#	apps/shared/RemoteClawKit/Tests/RemoteClawKitTests/ChatComposerPasteSupportTests.swift

* fix: stage docker live tests from mounted source

(cherry picked from commit 21df014)

* fix: add minimal process shim for acpx mcp-agent-command

The upstream process.ts depends on gutted runtime-api, so provide a
minimal spawnAndCollect implementation that satisfies the import.

---------

Co-authored-by: Vincent Koc <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
Co-authored-by: gambletan <[email protected]>
Co-authored-by: Shadow <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ACPX runtime ignores MCP server config (mcpServers always empty), blocking Canva MCP

3 participants