Skip to content

fix(acp): clean up session mcp servers#32377

Open
hereswilson wants to merge 1 commit into
anomalyco:devfrom
hereswilson:mcp-cleanup
Open

fix(acp): clean up session mcp servers#32377
hereswilson wants to merge 1 commit into
anomalyco:devfrom
hereswilson:mcp-cleanup

Conversation

@hereswilson

@hereswilson hereswilson commented Jun 15, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #32371

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

ACP sessions can register MCP servers through mcpServers, but closing the ACP session only removed ACP bookkeeping. The dynamically added MCP server stayed registered on the instance.

This adds a matching dynamic MCP remove path and uses it when ACP sessions close. Session-owned MCP servers are removed when their last owner closes, shared registrations stay active, and static MCP config is preserved or restored when a dynamic server had overridden it.

How did you verify your code works?

From packages/opencode:

  • bun test --timeout 60000 test/mcp/lifecycle.test.ts test/server/httpapi-mcp.test.ts test/acp/service-session.test.ts
  • bun test --timeout 90000 test/server/httpapi-public-openapi.test.ts test/session/snapshot-tool-race.test.ts
  • bun run script/httpapi-exercise.ts --mode coverage --fail-on-missing --fail-on-skip
  • bun typecheck

From packages/sdk/js:

  • bun typecheck

The pre-push hook also ran bun turbo typecheck successfully.

Screenshots / recordings

N/A

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

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.

ACP sessions can leave supplied MCP servers registered after close

1 participant