Skip to content

Support manual connect for configured MCP servers#2503

Merged
esengine merged 3 commits into
esengine:main-v2from
SivanCola:codex/mcp-manual-connect
Jun 1, 2026
Merged

Support manual connect for configured MCP servers#2503
esengine merged 3 commits into
esengine:main-v2from
SivanCola:codex/mcp-manual-connect

Conversation

@SivanCola
Copy link
Copy Markdown
Contributor

Summary

Adds explicit MCP auto-start control and a manual connect path:

  • [[plugins]].auto_start = false keeps a configured MCP server from connecting during session startup.
  • /mcp connect <name> connects a configured but currently disconnected server on demand.
  • reasonix mcp list shows [auto_start=false] for disabled startup entries.
  • Chat completion offers /mcp connect and suggests disconnected configured server names.
  • .mcp.json imports preserve auto_start when present.

Root Cause

Some MCP servers are useful but heavy, flaky, auth-bound, or only needed occasionally. Starting every configured server on every session makes startup slower and can introduce unnecessary provider-visible tool schema churn.

Technical Approach

  • Adds PluginEntry.AutoStart *bool so omitted values preserve historical auto-start behavior.
  • Adds PluginEntry.ShouldAutoStart() and Config.AutoStartPlugins().
  • Filters startup MCP specs in normal boot and ACP session boot through AutoStartPlugins().
  • Adds controller helpers for configured/disconnected MCP names and ConnectConfiguredMCPServer.
  • Extends /mcp connect chat handling and structured slash completion.
  • Extends TOML render/round-trip tests and .mcp.json parsing tests for auto_start=false.

Focused Optimization Points

  • auto_start is tri-state by using *bool: nil keeps current behavior, false opts out, true can be rendered/preserved.
  • Manual connect is an explicit user action; there is no automatic retry loop or per-turn dynamic reordering.
  • Configured plugin order remains unchanged.
  • No v1 frontend, attachment, autoscroll, or startup-resilience changes are included.

Cache / Tool Schema Notes

This PR intentionally lets users keep configured MCP servers out of the startup tool schema with auto_start=false. That can improve cache stability for heavy or rarely used servers, but connecting one manually changes the provider-visible tool set on the next model turn, matching existing live /mcp add behavior.

Verification

Passed:

  • go test ./internal/config ./internal/control ./internal/cli ./internal/acp ./internal/boot -run 'TestPlugin|TestAutoStart|TestMCP|TestSlashArg|TestBuildWithoutMemoryLeavesPromptUnchanged|TestRenderTOML|TestLoadMCP|TestMergeMCP|TestProtocol'
  • go test ./internal/agent -run TestPlanModeDoesNotMutateSystemOrTools

@github-actions github-actions Bot added the v2 Go rewrite (1.x) — main-v2 branch, active development label Jun 1, 2026
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: 5262ad81b2

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/control/slash.go
Comment thread internal/control/controller.go
@esengine esengine merged commit 5904043 into esengine:main-v2 Jun 1, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants