Skip to content

feat(local-agent): add MCP server install/uninstall via HTTP sync channel - #290

Merged
jeff-r2026 merged 2 commits into
Tencent:mainfrom
m0Nst3r873:worktree-feat-mcp-sync
Aug 26, 2026
Merged

jeff-r2026 merged 2 commits into
Tencent:mainfrom
m0Nst3r873:worktree-feat-mcp-sync

Conversation

@m0Nst3r873

Copy link
Copy Markdown
Collaborator

Summary

  • Add install_mcp / uninstall_mcp command support to the HTTP local-agent sync channel, enabling Hatchery to distribute MCP servers (e.g. ClawPro) to AI coding tools
  • Add MCP reporting: user_level.mcps and workspaces[].mcps in the report payload, scanning from managed-mcp.json
  • Reuse existing MCP rendering (renderJsonEntry, renderCodexBlock) and I/O primitives (readJsonDoc, spliceCodexBlock) — no changes to the git-based reconcile engine

Key design decisions

  • Single-tool targeting: HTTP install targets only the current tool (context.tool), unlike git-based reconcile which writes to all tools
  • Manifest-first writes: Manifest is written before tool config to ensure idempotent retry on partial failure
  • Transport validation: Runtime check rejects unsupported transport types before config write
  • Ownership protection: Refuses to overwrite user-owned servers not tracked in managed-mcp.json

Protocol reference

See clawpro/hatchery-teamai-mcp-protocol.md for the full Hatchery ↔ TeamAI MCP protocol spec.

Test plan

  • npx tsc --noEmit — type check passes
  • npx vitest run — 148 test files, 1952 tests pass (0 failures)
  • New test file src/__tests__/local-agent-mcp.test.ts with 13 e2e test cases:
    • install_mcp: HTTP transport, stdio transport, idempotent overwrite, user-owned rejection, invalid transport rejection, workspace scope, missing mcp_config, claude tool format
    • uninstall_mcp: normal removal, idempotent on nonexistent, user-owned protection
    • report: mcps array in buildReportPayload
    • batch: install + uninstall in same sync response

🤖 Generated with Claude Code

@m0Nst3r873
m0Nst3r873 force-pushed the worktree-feat-mcp-sync branch from a42e663 to ceb81fb Compare August 24, 2026 09:33
HTTP-mode teams have no repo tree: their MCP servers are delivered
through the local-agent install_mcp channel and recorded in the same
managed-mcp.json that reconcileMcpForConfig prunes against. On every
session-start sync the desired set was therefore always empty, so the
prune loop deleted every HTTP-installed server on the second sync.

Guard the reconcile with `kind === 'http' && !removeAll` so the
session-start path is a no-op for HTTP teams, while the explicit
removeAll teardown (teamai uninstall) still cleans them up.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@jeff-r2026
jeff-r2026 merged commit a44a2a3 into Tencent:main Aug 26, 2026
7 checks passed
@jeff-r2026
jeff-r2026 self-requested a review August 26, 2026 10:33
Walternater pushed a commit to Walternater/teamai-cli that referenced this pull request Nov 2, 2026
…nnel (Tencent#290)

* feat(local-agent): add MCP server install/uninstall via HTTP sync channel

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

* fix(mcp-reconcile): skip desired-set prune for http-mode teams

HTTP-mode teams have no repo tree: their MCP servers are delivered
through the local-agent install_mcp channel and recorded in the same
managed-mcp.json that reconcileMcpForConfig prunes against. On every
session-start sync the desired set was therefore always empty, so the
prune loop deleted every HTTP-installed server on the second sync.

Guard the reconcile with `kind === 'http' && !removeAll` so the
session-start path is a no-op for HTTP teams, while the explicit
removeAll teardown (teamai uninstall) still cleans them up.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
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