Skip to content

feat: mcp subcommand for managing MCP servers independently #346

@christso

Description

@christso

Summary

Add an `allagents mcp` subcommand surface for managing MCP servers independently of full plugin installs, mirroring the `claude mcp` command surface.

Motivation

Currently, MCP servers are synced as part of plugin install/update. Users may want to:

  • Install only MCP servers from a plugin without syncing skills/agents/hooks
  • List which MCP servers AllAgents has synced across clients
  • Remove specific MCP servers
  • Update MCP configs without running a full workspace update

AllAgents already syncs MCP servers during `plugin install` — this issue adds a dedicated subcommand for MCP-only workflows.

Proposed Commands

Command Description
`allagents mcp add [args...]` Add an MCP server across configured clients
`allagents mcp list` List MCP servers managed by AllAgents (with per-client status)
`allagents mcp remove ` Remove a synced MCP server from all clients
`allagents mcp update` Sync MCP servers from plugins without syncing other artifacts
`allagents mcp get ` Show details of a specific MCP server (config, which clients have it)

Consistency Notes

  • `mcp update` is consistent with `workspace update` (which supersedes the old sync command)
  • Command surface mirrors `claude mcp` (`add`, `list`, `remove`, `get`) for familiarity
  • Respects existing ownership tracking — only manages servers AllAgents added, never touches user-managed servers

Implementation Notes

Key source files

  • MCP sync per client:
    • `src/core/claude-mcp.ts` — syncs to `.mcp.json`, tracks owned servers via `trackedServers`
    • `src/core/vscode-mcp.ts` — syncs to `.vscode/settings.json` MCP section
    • `src/core/codex-mcp.ts` — project-scoped MCP config
  • Sync state: `src/core/sync-state.ts` — `getPreviouslySyncedMcpServers()` returns what AllAgents owns
  • CLI commands: `src/cli/commands/` — add new `mcp.ts` command file
  • Sync output formatting: `src/cli/format-sync.ts` — reuse for `mcp list` display

Ownership model

AllAgents tracks which MCP servers it installed via `trackedServers` in sync state. This is critical:

  • `mcp add` must add the server to `trackedServers` so AllAgents owns it
  • `mcp remove` must only remove servers in `trackedServers`, never user-managed ones
  • `mcp list` should show ownership status (AllAgents-managed vs user-managed)
  • See CLAUDE.md "MCP Server Sync" section for the ownership rule

`mcp add` behavior

Should mirror `claude mcp add` flags where applicable:

  • `--transport http|stdio` (default: infer from URL vs command)
  • `-e KEY=VALUE` for environment variables
  • `--client claude,copilot` to target specific clients (default: all configured)
  • Writes to each client's MCP config file using existing per-client sync logic

`mcp update` behavior

Runs only the MCP portion of the sync pipeline:

  1. Collect `.mcp.json` configs from all plugins in workspace
  2. Sync to each client's MCP config (using existing `claude-mcp.ts`, `vscode-mcp.ts`, etc.)
  3. Purge servers no longer provided by plugins
  4. Skip skill/agent/hook/command sync entirely

Acceptance Criteria

  • `allagents mcp add ` adds an MCP server to all configured clients
  • `allagents mcp add --client claude,copilot` targets specific clients
  • `allagents mcp list` shows all AllAgents-managed MCP servers with per-client sync status
  • `allagents mcp remove ` removes server from all clients and sync state
  • `allagents mcp update` syncs MCP servers from plugins without touching other artifacts
  • `allagents mcp get ` shows server config and which clients have it
  • Respects ownership model — never modifies user-managed servers
  • New servers added via `mcp add` are tracked in sync state

Context

From analysis of enterprise adoption — some teams primarily need MCP server distribution (e.g., connecting AI assistants to internal APIs) and don't need full plugin artifact sync. An MCP-focused entry point lowers the barrier.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions