MCP Ecosystem Operations Tools

Design specification for the MCP ecosystem operations tools -- architecture overview, tool schemas, conversational intents mapping, and error handling.

Architecture Overview

MCP Client (Cursor / Claude Desktop)
    │
    ▼
MCP Server (stdio transport)
    │
    ├── Read-only tools ────► Direct Python calls
    │   (list, describe,       (get_available_ecosystems, eco_mgr,
    │    status, validate)      state.py, YAML parsing)
    │
    └── Async action tools ──► RunManager + subprocess
        (install, sync,         (build_*_command → run_subprocess_task)
         push, deploy, etc.)
CategorySafetyMode RequiredPattern
Info/Queryread-onlyaskDirect function call, immediate JSON
Safe Writesafe-writeplanRunManager subprocess, run_id for polling
Dangerous Writedangerous-writeexecuteRunManager subprocess + confirmation

Tool Schemas

amof_list_ecosystems

Category: Info/Query. Integration: get_available_ecosystems() + EcosystemManager.get_ecosystem_summary().

{
  "ecosystems": [
    {
      "name": "amof-platform",
      "path": "ecosystems/amof-platform",
      "repos_count": 3,
      "repos": ["amof", "amof-ui", "amof-backend"],
      "kb_files_count": 1,
      "journal_files_count": 45,
      "active_tasks": 0
    }
  ]
}

amof_get_ecosystem_status

Category: Async action (read-only). Integration: build_status_command() via subprocess.

{
  "workspace": {
    "ecosystem": "amof-platform",
    "workspace_branch": "workspace/amof-platform",
    "active_ticket": "PROJ-123",
    "ticket_count": 2
  },
  "repos": [
    {
      "name": "amof",
      "branch": "feat/amof-cloud",
      "commit": "abc1234",
      "mode": "RW",
      "status": "OK",
      "dirty": false,
      "unpushed": false
    }
  ]
}

amof_push_ecosystem

Category: Async action, dangerous-write. Requires confirmation. Integration: build_push_command() via subprocess.

// Confirmation gate (if confirm=false):
{
  "error": "confirmation_required",
  "message": "Push will modify remote state. Set confirm=true.",
  "repos_affected": ["amof", "amof-ui", "amof-backend"]
}

amof_spin_destroy

Category: Async action, dangerous-write. Requires type-to-confirm. Integration: build_spin_destroy_command() via subprocess.

// Type-to-confirm gate:
{
  "error": "type_to_confirm_failed",
  "message": "To destroy 'amof-platform', set confirm_name='amof-platform'."
}

Common Conversational Intents

User SaysToolNotes
"What ecosystems do I have?"amof_list_ecosystems
"Show me repo status"amof_get_ecosystem_statusNeeds ecosystem context
"Set up the workspace"amof_install_ecosystemDangerous-write, confirm
"Get latest code"amof_sync_ecosystemSafe-write
"Push everything"amof_push_ecosystemDangerous-write, confirm
"Deploy the cluster"amof_spin_deployDangerous-write, preview-then-confirm
"Start working on PROJ-123"amof_ticket_startSafe-write
"What am I working on?"amof_ticket_listRead-only
"Archive this workspace"amof_archive_ecosystemDangerous-write, confirm
"Delete everything"amof_discard_ecosystemDangerous-write, type-to-confirm

Error Handling

Error Categories

CategoryHTTP CodeRendering
Ecosystem not found404Show available ecosystems, suggest amof_list_ecosystems
Run not found404Suggest amof_list_runs
Confirmation required403Return required fields + instructions
Mode insufficient403Explain required mode, show mode-switch hint
Subprocess failed500Return exit code + last 10 log lines
Manifest invalid422Return validation errors