{
  "markdown": "# BuyAPI CLI + MCP Server\n\n> Unbiased vendor intelligence for AI coding agents.\n\n[![Website](https://img.shields.io/badge/Website-buyapi.ai-blue)](https://buyapi.ai)\n[![NPM Version](https://img.shields.io/npm/v/buyapi?color=red)](https://www.npmjs.com/package/buyapi)\n[![smithery badge](https://smithery.ai/badge/buyapi/buyapi)](https://smithery.ai/servers/buyapi/buyapi)\n[![MIT licensed](https://img.shields.io/npm/l/buyapi)](./LICENSE)\n\nBuyAPI helps AI agents and developers make informed infrastructure decisions. When your agent needs to pick a database, auth provider, hosting platform, payment processor, email provider, or UI component system, BuyAPI provides current, structured, neutral vendor comparisons - not training data defaults.\n\n## Quick Start\n\n### Remote MCP (Recommended)\n\nThe hosted endpoint is the primary install path and exposes the current seven-tool contract.\n\n[![Install MCP Server in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=buyapi&config=eyJ1cmwiOiJodHRwczovL2J1eWFwaS5haS9hcGkvbWNwIn0=)\n\nAdd to your MCP client config:\n\n```json\n{\n  \"mcpServers\": {\n    \"buyapi\": {\n      \"url\": \"https://buyapi.ai/api/mcp\"\n    }\n  }\n}\n```\n\nThis is the easiest path: the client connects directly to BuyAPI over HTTP, with no local process and no npm install.\n\n### CLI Setup\n\nRun setup to install BuyAPI into your agent:\n\n```bash\nnpx buyapi\n```\n\nBare `npx buyapi` opens an interactive setup flow. It asks which coding agent you use, installs the hosted MCP config by default, can add the `/stack` planning skill where supported, and can log you in for higher limits and stack sync.\n\nOr target a client directly:\n\n```bash\nnpx buyapi setup cursor\nnpx buyapi setup claude-code\nnpx buyapi setup codex\nnpx buyapi setup windsurf\nnpx buyapi setup cline\n```\n\nBy default setup writes the hosted MCP URL. Use `--local` when a client needs a local stdio process:\n\n```bash\nnpx buyapi setup codex --local\n```\n\nClaude Code and Codex can also install the `/stack` planning workflow:\n\n```bash\nnpx buyapi setup claude-code --skill\nnpx buyapi setup-skill codex\n```\n\n`/stack` inspects the local repo, asks for missing constraints, calls BuyAPI MCP for current vendor data, and returns a sourced Stack Decision Record. It does not sync scan data unless you explicitly ask it to.\n\nIf you use the CLI often and do not want to type `npx`, install it globally:\n\n```bash\nnpm install -g buyapi\nbuyapi scan\n```\n\nIn an MCP client config, use the explicit `mcp` command. The client launches it as a local stdio server; you do not run it manually first:\n\n```json\n{\n  \"mcpServers\": {\n    \"buyapi\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"buyapi\", \"mcp\"]\n    }\n  }\n}\n```\n\nUse the local path when an agent client does not support remote MCP URLs, or when you want the open-source local transport. Hosted MCP is still the recommended default. The older `buyapi-mcp` package is deprecated on npm so new users see one canonical package name.\n\n### Stack Scan And Sync\n\nThe CLI has a stack scanner. Plain scan prints a local preview first, then asks\nwhether to save the private stack when the terminal is interactive:\n\n```bash\nnpx buyapi scan\n```\n\nRun it from the app, package, or monorepo root that contains project signals\nsuch as `package.json`, a lockfile, framework config, `convex/`, `prisma/`,\nPython manifests, or source imports. You can also point it at a public GitHub\nrepo URL:\n\n```bash\nnpx buyapi scan https://github.com/owner/repo\n```\n\nIf no project signals are found, the CLI prints wrong-folder guidance instead\nof silently returning an empty stack. Sync also skips stacks with zero known\nBuyAPI tools unless you pass `--allow-empty`.\n\nUse `--verbose` to see evidence and unknown package candidates found in\n`package.json`:\n\n```bash\nnpx buyapi scan --verbose\n```\n\nFor a guaranteed no-upload preview, use `--dry-run`. To save a private stack\nwithout prompts in automation, login once, then sync:\n\n```bash\nnpx buyapi login\nnpx buyapi scan --sync --yes\n```\n\nDetection uses BuyAPI's own registry of manifest, marker-file, env-key,\nconfig-content, import, framework, and language signals. Unknown runtime\npackages are kept as candidates so the public tool register can learn about new\nAI-native tools without copying third-party detection tables. Routine dev/build\ntooling is filtered out before it reaches the review queue.\n\n`buyapi login` opens the browser, signs in through the dashboard, creates a CLI API key, and stores it locally. You can still pass an existing key with `buyapi login ba_live_...` or use `BUYAPI_API_KEY` in CI. `buyapi whoami --quiet` exits 0 when a key is active and 1 when it is not. Sync uploads known detected tools plus filtered unknown package names, versions, and evidence so BuyAPI can review emerging tools. It does not upload source code, source file contents, or environment values.\n\n`scan` is a human-facing CLI command, not an MCP tool. The MCP server should stay quiet on stdout because stdout carries the MCP protocol.\n\n### Read-Only CLI\n\nThe local package can query BuyAPI without starting an MCP client:\n\n```bash\nnpx buyapi search \"realtime database with preview environments\" --category database\nnpx buyapi details /database/convex\nnpx buyapi compare /database/convex /database/supabase --query \"realtime SaaS\"\nnpx buyapi recommend \"B2B AI SaaS with teams and usage billing\" --users 1000\nnpx buyapi cost /email/ses --emails 50000\n```\n\nUse `--json` on read-only commands to print the raw structured response.\n\n## When To Use BuyAPI\n\nUse BuyAPI when the question is a vendor or stack decision:\n\n```txt\nShould I use Convex, Supabase, or Neon for a realtime B2B SaaS?\n```\n\n```txt\nEstimate the email cost for 50,000 transactional sends/month.\n```\n\n```txt\nWhat auth provider should I use for organizations, SSO later, and a generous free tier?\n```\n\nUse implementation docs tools such as Context7 after the decision is made and the agent needs exact APIs, code examples, or version-specific setup steps.\n\n## Tips For Better Answers\n\n- Use BuyAPI vendor IDs when you know them, e.g. `/database/convex`, `/database/supabase`, `/hosting/vercel`.\n- Include workload numbers when asking about cost: users, monthly active users, email sends, storage, bandwidth, or monthly orders.\n- Include constraints that matter: solo founder, B2B SaaS, HIPAA/SOC2 later, no credit card free tier, preview environments, realtime collaboration, or low lock-in.\n- Ask for alternatives when you want tradeoffs, not just a single recommendation.\n\nCommon launch-corpus IDs:\n\n```txt\n/database/convex\n/database/supabase\n/database/neon\n/auth/clerk\n/hosting/vercel\n/payments/stripe\n/email/resend\n/ui-components/shadcn-ui\n```\n\n## Available Tools\n\n### `vendors.resolve`\n\nSearch for vendors by query. Category is optional. Returns matching vendors with pricing summaries, positioning, confidence, and explicit unknown-corpus fallbacks.\n\n```\nQuery: \"I need a database for a real-time collaborative app\"\nCategory: \"database\"\n\n-> Returns: Convex, Supabase, Neon, PlanetScale, Firebase with comparison metadata\n```\n\n### `vendors.details`\n\nGet detailed vendor profile: concrete pricing numbers, free tier limits, scaling characteristics, known gotchas, source provenance, and head-to-head comparisons.\n\n```\nVendor ID: /database/supabase\nQuery: \"free tier limits for a side project\"\n\n-> Returns: Full pricing tiers, 500MB DB limit, 50K auth users, scaling triggers, and sources\n```\n\n### `vendors.evidence`\n\nFetch recent reviewed evidence rows for a vendor, category, stack, or comparison.\n\n```\nSubject type: \"vendor\"\nSubject ID: /database/supabase\n\n-> Returns: Evidence summaries with source URLs, stance, confidence, and observed dates\n```\n\n### `stacks.findSimilar`\n\nFind public stack profiles related to a vendor, or recent curated stack examples.\n\n```\nVendor ID: /database/convex\n\n-> Returns: Similar stack profiles with project summary, audience, stage, tools, and confidence\n```\n\n### `vendors.compare`\n\nCompare two or more specific vendors for a workload or decision.\n\n```\nVendor IDs: [\"/database/convex\", \"/database/supabase\", \"/database/neon\"]\nQuery: \"realtime TypeScript SaaS with preview environments\"\n\n-> Returns: Structured decision matrix with fit, capability-by-capability yes/no/unknown coverage, tradeoffs, estimated cost, confidence, and sources\n```\n\n### `vendors.estimateCost`\n\nRun deterministic cost estimates from explicit workload inputs instead of leaving math to the model.\n\n```\nVendor IDs: [\"/email/ses\"]\nWorkload: { \"emailSendsPerMonth\": 50000 }\n\n-> Returns: Amazon SES estimated at $5/month, basis, assumptions, unknowns, and sources\n```\n\n### `stacks.recommend`\n\nDescribe your project and get a complete stack recommendation with cost projections, a decision matrix, assumptions, unknowns, alternatives, and sources.\n\nUse this for stack/vendor/tool decisions, not local implementation questions like CSS layout, TypeScript compiler errors, or framework API usage.\n\n```\nProject: \"SaaS for restaurant inventory with real-time updates\"\nConstraints: \"Solo founder, under $50/month until 1000 users\"\nStack context: [{ \"vendorSlug\": \"/database/convex\", \"category\": \"database\", \"confidence\": \"high\" }]\n\n-> Returns: Full stack (hosting + DB + auth + payments + email) with structured cost and decision data\n```\n\n## Setup by Client\n\n<details>\n<summary><strong>Claude Code</strong></summary>\n\nAdd to your Claude Code MCP settings:\n\n```json\n{\n  \"mcpServers\": {\n    \"buyapi\": {\n      \"url\": \"https://buyapi.ai/api/mcp\"\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><strong>Cursor</strong></summary>\n\nIn Cursor Settings -> MCP Servers, add:\n\n```json\n{\n  \"mcpServers\": {\n    \"buyapi\": {\n      \"url\": \"https://buyapi.ai/api/mcp\"\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><strong>VS Code (Copilot)</strong></summary>\n\nAdd to `.vscode/mcp.json`:\n\n```json\n{\n  \"servers\": {\n    \"buyapi\": {\n      \"url\": \"https://buyapi.ai/api/mcp\"\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><strong>Windsurf</strong></summary>\n\nAdd to your Windsurf MCP config:\n\n```json\n{\n  \"mcpServers\": {\n    \"buyapi\": {\n      \"url\": \"https://buyapi.ai/api/mcp\"\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><strong>Local (stdio)</strong></summary>\n\n```json\n{\n  \"mcpServers\": {\n    \"buyapi\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"buyapi\", \"mcp\"]\n    }\n  }\n}\n```\n\n</details>\n\n## API Keys\n\nBuyAPI currently works without an API key at the anonymous rate limit. Signed-in users can create dashboard API keys for keyed access, usage analytics, and stack sync.\n\nThe local package reads either `BUYAPI_API_KEY` or the key stored by `buyapi login`:\n\n```json\n{\n  \"mcpServers\": {\n    \"buyapi\": {\n      \"url\": \"https://buyapi.ai/api/mcp\",\n      \"env\": {\n        \"BUYAPI_API_KEY\": \"ba_live_...\"\n      }\n    }\n  }\n}\n```\n\n## CLI Reference\n\n```bash\nbuyapi                             # Show setup guidance\nbuyapi setup <client>              # Install MCP config for an agent\nbuyapi setup <client> --skill      # Install MCP config and the /stack skill\nbuyapi setup-skill <client>        # Install the /stack skill only\nbuyapi mcp                         # Run the local MCP server over stdio\nbuyapi login                       # Browser login and local key storage\nbuyapi login <api-key>             # Store an existing API key\nbuyapi logout                      # Remove the stored API key\nbuyapi whoami                      # Verify the active local key\nbuyapi whoami --quiet              # Auth check for scripts\nbuyapi scan [dir]                  # Scan locally, then optionally save stack\nbuyapi scan https://github.com/x/y  # Scan a public GitHub repo\nbuyapi scan --sync --yes           # Save detected tools without prompts\nbuyapi search <query>              # Search vendors\nbuyapi details <vendorId>          # Fetch one vendor profile\nbuyapi compare <ids...>            # Compare vendors\nbuyapi recommend <prompt>          # Recommend a stack\nbuyapi cost <ids...>               # Estimate cost from workload flags\nbuyapi --version                   # Print the CLI version\n```\n\nCommon flags:\n\n```bash\n--category <name>       Limit search/cost to a category\n--query <text>          Add workload or decision context\n--client <name>         Setup target: claude-code, cursor, codex, windsurf, cline\n--local                 Write local stdio MCP config during setup\n--skill                 Also install the /stack planning skill during setup\n--print                 Print setup config instead of writing it\n--name <text>           Stack name for scan sync\n--stack-name <text>     Alias for --name\n--stack <slug>          Stable stack slug/name to update\n--summary <text>        Stack notes for scan sync\n--sync                  Save scan output to your dashboard\n--dry-run               Preview scan output without uploading\n--verbose               Include scanner evidence details\n--all                   Include lower-confidence supporting detections\n--allow-empty           Save even when no known tools were detected\n--force                 Alias for --allow-empty\n--yes                   Skip sync confirmation prompt\n--users <n>             Monthly active users\n--emails <n>            Email sends per month\n--orders <n>            Monthly orders\n--json                  Print raw structured JSON\n```\n\n## Covered Categories\n\n| Category | Vendors |\n|----------|---------|\n| Database | Supabase, Convex, Neon, PlanetScale, Firebase |\n| Auth | Supabase Auth, Clerk, Auth0, Auth.js |\n| Hosting | Vercel, Netlify, Railway, Fly.io |\n| Payments | Stripe, LemonSqueezy, Paddle, RevenueCat |\n| Email | Resend, SendGrid, Postmark, Amazon SES |\n| UI Components | shadcn/ui |\n\n## How It Works\n\nThis MCP server is a thin TypeScript client that calls the BuyAPI backend API. It contains no vendor data; lightweight comparison and cost formatting mirrors the hosted endpoint while vendor intelligence is served from [buyapi.ai](https://buyapi.ai).\n\nThe source is fully open so you can verify there's no prompt injection or hidden behavior. `scan` previews locally first and only uploads after explicit confirmation or `--sync`; `--dry-run` never uploads. Sync sends detected tool metadata, derived stack context, checked file names, repo URL metadata when provided, and filtered unknown package candidates for review. It does not send source code or environment values.\n\n## Data Transparency\n\n- All vendor data is publicly viewable at [buyapi.ai](https://buyapi.ai)\n- Every profile shows when it was last updated and data source\n- BuyAPI does not accept payment from vendors for ranking influence\n- Inaccurate-data reporting, suggested edits, reviews, and vendor-claim requests exist behind moderation; vendor self-service editing is not live.\n\n## Troubleshooting\n\n- If your MCP client supports remote MCP URLs, use `https://buyapi.ai/api/mcp` first.\n- If remote MCP is not supported, configure the local stdio server with `command: \"npx\"` and `args: [\"-y\", \"buyapi\", \"mcp\"]`.\n- Do not add banners or prompts to the stdio server command; stdout is reserved for MCP protocol messages.\n- If anonymous rate limits are hit, create an API key in the BuyAPI dashboard and pass it as `BUYAPI_API_KEY` where your client supports environment variables.\n- If a tool or vendor is missing, ask BuyAPI anyway. Unknown requests are treated as demand signals for future corpus expansion.\n\n## Disclaimer\n\nBuyAPI profiles combine first-party sources, manual review, public evidence, and structured estimates. Vendor data can become stale or incomplete, especially pricing and limits. Use BuyAPI as a decision-support layer, verify critical production commitments directly with the vendor, and report outdated facts through the website when the reporting flow is available.\n\n## License\n\nMIT\n",
  "bytes": 15699,
  "sha": "54c3f058ecee20873ec4af9bd89745d9dd0dc224dcf267da1d63fa555ad87419",
  "repo_slug": "thesnakefang/buyapi-mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_thesnakefang_buyapi_mcp_0b097e87/readme"
}