{
  "$schema": "https://raw.githubusercontent.com/modelcontextprotocol/specification/main/schema/schema.json",
  "name": "ashlr-stack",
  "description": "Ashlr Stack as an MCP server. Exposes the `stack` CLI as callable tools for any MCP-capable LLM editor (Claude Code, Cursor, Windsurf, Zed). Includes an AI-assisted composition layer: `stack_recommend` picks providers from a free-text brief, `stack_apply` replays a saved recipe end-to-end with Phantom rotation pre-wired. Install: `bunx ashlr-stack-mcp` (or `npx ashlr-stack-mcp`).",
  "version": "0.2.0",
  "homepage": "https://stack.ashlr.ai",
  "repository": "https://github.com/ashlrai/ashlr-stack",
  "license": "MIT",
  "install": {
    "command": "bunx",
    "args": ["ashlr-stack-mcp"],
    "mcpConfigSnippet": {
      "mcpServers": {
        "stack": {
          "command": "bunx",
          "args": ["ashlr-stack-mcp"]
        }
      }
    }
  },
  "tools": [
    {
      "name": "stack_init",
      "description": "Scaffold a new .stack.toml in the current directory.",
      "cli": "stack init --noInteractive [--template <name>] [--force]",
      "inputSchema": {
        "type": "object",
        "properties": {
          "template": { "type": "string", "description": "Optional starter template name." },
          "force": { "type": "boolean", "description": "Overwrite an existing .stack.toml." }
        },
        "required": []
      }
    },
    {
      "name": "stack_import",
      "description": "Import an existing .env file into Phantom + .stack.toml.",
      "cli": "stack import [--from <path>] [--dryRun]",
      "inputSchema": {
        "type": "object",
        "properties": {
          "from": { "type": "string", "description": "Path to the .env file (default: .env)." },
          "dryRun": { "type": "boolean", "description": "Preview without writing." }
        },
        "required": []
      }
    },
    {
      "name": "stack_scan",
      "description": "Detect providers this repo uses by reading package.json / requirements.txt / config files.",
      "cli": "stack scan [--path <dir>] [--confidence low|medium|high]",
      "inputSchema": {
        "type": "object",
        "properties": {
          "path": { "type": "string", "description": "Directory to scan (default: cwd)." },
          "confidence": { "type": "string", "enum": ["low", "medium", "high"], "description": "Minimum confidence (default: medium)." }
        },
        "required": []
      }
    },
    {
      "name": "stack_add",
      "description": "Provision a service and wire its secrets + MCP entry.",
      "cli": "stack add <service> [--use <id>]",
      "inputSchema": {
        "type": "object",
        "properties": {
          "service": { "type": "string", "description": "Service name (e.g. supabase, neon, vercel)." },
          "use": { "type": "string", "description": "Existing resource id to attach to." }
        },
        "required": ["service"]
      }
    },
    {
      "name": "stack_remove",
      "description": "Remove a service from the stack (vault entries and MCP config).",
      "cli": "stack remove <service> [--keepRemote]",
      "inputSchema": {
        "type": "object",
        "properties": {
          "service": { "type": "string", "description": "Service name." },
          "keepRemote": { "type": "boolean", "description": "Leave the provider-side resource untouched." }
        },
        "required": ["service"]
      }
    },
    {
      "name": "stack_list",
      "description": "List services configured in this stack.",
      "cli": "stack list",
      "inputSchema": { "type": "object", "properties": {}, "required": [] }
    },
    {
      "name": "stack_info",
      "description": "Deep-dive on a single service: resource, region, auth, secrets, MCP wiring, health.",
      "cli": "stack info <service>",
      "inputSchema": {
        "type": "object",
        "properties": {
          "service": { "type": "string", "description": "Service name." }
        },
        "required": ["service"]
      }
    },
    {
      "name": "stack_status",
      "description": "Show Phantom + services + config at a glance.",
      "cli": "stack status",
      "inputSchema": { "type": "object", "properties": {}, "required": [] }
    },
    {
      "name": "stack_env_show",
      "description": "Show which declared secrets are present in the Phantom vault (masked).",
      "cli": "stack env show",
      "inputSchema": { "type": "object", "properties": {}, "required": [] }
    },
    {
      "name": "stack_env_diff",
      "description": "Report which declared secrets are missing from the Phantom vault.",
      "cli": "stack env diff",
      "inputSchema": { "type": "object", "properties": {}, "required": [] }
    },
    {
      "name": "stack_doctor",
      "description": "Verify every service is reachable and credentials are valid.",
      "cli": "stack doctor [--fix] [--all] [--json]",
      "inputSchema": {
        "type": "object",
        "properties": {
          "fix": { "type": "boolean", "description": "Attempt auto-remediation." },
          "all": { "type": "boolean", "description": "Run across every registered project." },
          "json": { "type": "boolean", "description": "Machine-readable JSON output." }
        },
        "required": []
      }
    },
    {
      "name": "stack_sync",
      "description": "Push secrets to a deployment platform (via phantom sync).",
      "cli": "stack sync --platform <name>",
      "inputSchema": {
        "type": "object",
        "properties": {
          "platform": { "type": "string", "enum": ["vercel", "railway", "fly"] }
        },
        "required": ["platform"]
      }
    },
    {
      "name": "stack_providers",
      "description": "List every curated provider Stack can wire up (grouped by category).",
      "cli": "stack providers",
      "inputSchema": { "type": "object", "properties": {}, "required": [] }
    },
    {
      "name": "stack_projects_list",
      "description": "List every Stack-enabled project on this machine.",
      "cli": "stack projects list",
      "inputSchema": { "type": "object", "properties": {}, "required": [] }
    },
    {
      "name": "stack_deps",
      "description": "Show the service dependency graph for the current stack.",
      "cli": "stack deps",
      "inputSchema": { "type": "object", "properties": {}, "required": [] }
    },
    {
      "name": "stack_templates_list",
      "description": "List available starter stack templates.",
      "cli": "stack templates list",
      "inputSchema": { "type": "object", "properties": {}, "required": [] }
    },
    {
      "name": "stack_upgrade",
      "description": "Check npm for a newer @ashlr/stack release.",
      "cli": "stack upgrade",
      "inputSchema": { "type": "object", "properties": {}, "required": [] }
    },
    {
      "name": "stack_recommend",
      "description": "Given a free-text description of what the user is building (e.g. 'B2B SaaS with auth, AI, and payments'), return a structured list of the most relevant curated providers with scores, matched terms, and per-category ranking. Pass save:true to also persist a Recipe to .stack/recipes/<id>.toml so you (Claude) can follow up with stack_apply. Retrieval-only — no LLM inference happens here.",
      "cli": "stack recommend \"<query>\" --json [--k <n>] [--category <name>] [--save]",
      "inputSchema": {
        "type": "object",
        "properties": {
          "query": {
            "type": "string",
            "description": "Natural-language description of the project / stack need."
          },
          "k": {
            "type": "number",
            "description": "Max top-level hits to return (default 6)."
          },
          "category": {
            "type": "string",
            "description": "Optional filter to a single category: Database, Deploy, Cloud, AI, Analytics, Errors, Payments, Code, Tickets, Email, Auth."
          },
          "save": {
            "type": "boolean",
            "description": "When true, also freeze the result to .stack/recipes/<id>.toml so you can run stack_apply. Returns the recipe id in the response."
          }
        },
        "required": ["query"]
      }
    },
    {
      "name": "stack_apply",
      "description": "Apply a saved Recipe: replay `stack add` for each provider, then pre-wire Phantom rotation envelopes + webhook stubs. Set `no_wire: true` to opt out of the Phantom-wire layer (stays pure-provisioning).",
      "cli": "stack apply <recipe_id> [--noWire]",
      "inputSchema": {
        "type": "object",
        "properties": {
          "recipe_id": {
            "type": "string",
            "description": "Recipe id (filename stem in .stack/recipes/)."
          },
          "no_wire": {
            "type": "boolean",
            "description": "Skip Phantom envelope + webhook pre-wiring."
          }
        },
        "required": ["recipe_id"]
      }
    }
  ],
  "resources": [
    {
      "uri": "stack://current/.stack.toml",
      "name": ".stack.toml (this project)",
      "description": "Committed shape of the current project's stack.",
      "mimeType": "application/toml"
    },
    {
      "uri": "stack://current/.stack.local.toml",
      "name": ".stack.local.toml (local instance)",
      "description": "Local instance data (resource ids, project_id). Gitignored.",
      "mimeType": "application/toml"
    },
    {
      "uri": "stack://current/.mcp.json",
      "name": ".mcp.json (MCP wiring)",
      "description": "Currently-wired MCP servers.",
      "mimeType": "application/json"
    }
  ]
}
