{
  "markdown": "# AgentStack MCP\n\n**One deterministic reasoning stack for AI agents** — behind a single\n[Model Context Protocol (MCP)](https://modelcontextprotocol.io) endpoint and one\nAPI key:\n\n> **simulate** (ScenarioSim) → **decide** (DecisionMatrix) → **compute** (PrecisionCalc)\n\nplus **cross-domain composite tools** that chain the three. Every number runs\nthrough [`decimal.js`](https://github.com/MikeMcl/decimal.js) at 40-digit precision\n(**never floats**), so identical inputs always produce **byte-identical output**.\nThe server is **stateless** — no database, no sessions.\n\nAgentStack bundles three standalone MCP servers so an agent installs **one**\nserver, uses **one** key, and can run reasoning that spans all three domains. It\nimports the same engines directly (no HTTP proxying) — zero added latency, no\ncascading failure.\n\n## 🌐 Live hosted server (free, no install)\n\n```\nhttps://agentstack-mcp.pages.dev/mcp\n```\n\n```json\n{ \"mcpServers\": { \"agentstack\": {\n    \"type\": \"http\", \"url\": \"https://agentstack-mcp.pages.dev/mcp\" } } }\n```\n\nFree tier: no key, 20 calls/day per IP. Paid plans (**Starter $19/mo · 8,000/day**,\n**Pro $59/mo · 80,000/day**) return an API key sent as `X-API-Key`. One key covers\nall three products and the composites — about half the cost of subscribing to them\nseparately. Landing page: <https://agentstack-mcp.pages.dev>.\n\n---\n\n## The three namespaces (24 tools)\n\n| namespace | engine | tools |\n|-----------|--------|-------|\n| `sim_*` | **ScenarioSim** — what-if / scenario simulation | `sim_run`, `sim_sensitivity`, `sim_break_even`, `sim_compare`, `sim_list_templates` |\n| `decide_*` | **DecisionMatrix** — multi-criteria decision analysis | `decide`, `decide_score`, `decide_sensitivity`, `decide_compare_two`, `decide_list_methods` |\n| `calc_*` | **PrecisionCalc** — exact finance/business math | `calc_metric`, `calc_list_metrics`, `calc_currency_convert`, `calc_business_days`, `calc_compound_growth`, `calc_npv`, `calc_irr`, `calc_loan_amortization`, `calc_depreciation` |\n| meta | — | `list_capabilities`, `health_check` |\n\n> **Note on two deliberately-namespaced collisions:** `sim_sensitivity` varies\n> *scenario inputs*; `decide_sensitivity` varies *criteria weights*. They are\n> different operations — the prefix disambiguates them for the agent.\n\n## Composite tools — the reason to use the stack\n\nDeterministic end-to-end; each chains engines that no single server bundles:\n\n| Tool | Pipeline | What it does |\n|------|----------|--------------|\n| `plan_to_valuation` | simulate → compute | Project a scenario, take a per-period cash-flow line (`cashflow_metric`), and value it: **NPV** at a discount `rate`, **IRR**, undiscounted total. `initial_investment` becomes the period-0 outflow (needed for IRR). |\n| `evaluate_options_with_scenarios` | simulate → decide | Project each option as its own scenario, then **rank** the options against weighted criteria drawn from the scenario **outcomes** (`key_results`). |\n| `stress_test_decision` | simulate × decide | Stress one scenario assumption across **every** option and report how often the baseline winner survives (**robustness**) and where it flips. |\n\nComposite responses report the `pipeline` they ran and carry each stage's\nstructured output, so an agent can drill into any step.\n\n## Profiles — fight tool-selection noise\n\nAppend `?profile=` to the endpoint to load only a subset:\n\n| profile | tools |\n|---------|-------|\n| `all` *(default)* | every tool (24) |\n| `finance` | `calc_*` + `plan_to_valuation` + meta |\n| `decision` | `decide_*` + `evaluate_options_with_scenarios` + `stress_test_decision` + meta |\n| `simulation` | `sim_*` + all composites + meta |\n\n```json\n{ \"mcpServers\": { \"agentstack\": {\n    \"url\": \"https://agentstack-mcp.pages.dev/mcp?profile=finance\" } } }\n```\n\n---\n\n## Response envelope\n\nNamespaced tools return the exact envelope of their underlying product. Composite\ntools add `composite`, `pipeline`, per-stage blocks, `methodology`, `notes`, and a\nplain-language `explanation`. Errors are always structured data:\n\n```json\n{ \"status\": \"error\", \"error\": { \"type\": \"unknown_metric\", \"message\": \"...\", \"hint\": \"...\" } }\n```\n\nExample — `plan_to_valuation` (trimmed):\n\n```json\n{\n  \"status\": \"success\",\n  \"composite\": \"plan_to_valuation\",\n  \"pipeline\": [\"scenariosim.run_scenario\", \"precisioncalc.net_present_value\", \"precisioncalc.internal_rate_of_return\"],\n  \"scenario\": { \"template\": \"saas_growth\", \"horizon\": 12, \"key_results\": { \"ending_mrr\": 26982.1 } },\n  \"cashflow_metric\": \"mrr\",\n  \"cashflows\": [-150000, 14040, 15600, \"...\"],\n  \"valuation\": { \"discount_rate\": 0.01, \"npv\": 11157.386023, \"irr\": 0.02504, \"value_creating\": true },\n  \"explanation\": \"Projecting 'saas_growth' over 12 month(s) and valuing the 'mrr' stream at 1%/period gives an NPV of ...\"\n}\n```\n\n---\n\n## Project structure\n\n```\nagentstack-mcp/\n├── worker-src/\n│   ├── index.mjs           # Cloudflare Pages Function: MCP transport, namespacing, profiles, billing\n│   ├── composites.mjs      # the 3 cross-domain tools (simulate -> decide -> compute)\n│   ├── billing.mjs         # Stripe + KV: one key / one quota for the whole stack\n│   └── engines/            # vendored, unmodified product engines (100% deterministic)\n│       ├── scenariosim.mjs\n│       ├── decisionmatrix.mjs\n│       └── precisioncalc.mjs\n├── server.mjs              # local stdio MCP server (same engines + composites; AGENTSTACK_PROFILE env)\n├── site/                   # landing page + mcp.json + llms.txt + _worker.js (built)\n├── tests/composites.test.mjs\n├── examples/agent_example.mjs\n├── scripts/sync-engines.sh # re-vendor engines from the sibling repos\n├── package.json · wrangler.toml · server.json · smithery.yaml · Dockerfile · LICENSE\n└── README.md\n```\n\n**Why vendor the engines?** So this repo is self-contained and reproducible. The\nengines are the *same* deterministic modules that power the three standalone\nservers; `npm run sync-engines` re-copies them from the sibling repos when an\nupstream change lands.\n\n---\n\n## Run it locally\n\n```bash\ngit clone <your-fork> agentstack-mcp && cd agentstack-mcp\nnpm install\nnpm test                      # composite-logic tests (no network)\nnpm run dev                   # -> http://127.0.0.1:8788/mcp\nnode examples/agent_example.mjs            # hosted demo\nnode examples/agent_example.mjs http://127.0.0.1:8788\nnode server.mjs               # dependency-light stdio server (AGENTSTACK_PROFILE=finance to subset)\n```\n\nQuick manual call:\n\n```bash\ncurl -s http://127.0.0.1:8788/mcp \\\n  -H 'content-type: application/json' -H 'accept: application/json, text/event-stream' \\\n  -d '{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"tools/call\",\"params\":{\"name\":\"list_capabilities\",\"arguments\":{}}}'\n```\n\n---\n\n## Install via npm (stdio, no hosting)\n\nRun the server locally over stdio with a single command — nothing to deploy:\n\n```bash\nnpx -y agentstack-mcp\n```\n\nClaude Desktop / any stdio MCP client (`claude_desktop_config.json`):\n\n```json\n{ \"mcpServers\": { \"agentstack\": { \"command\": \"npx\", \"args\": [\"-y\", \"agentstack-mcp\"] } } }\n```\n\nThis is the same deterministic engine as the hosted server, running on your machine.\n\n## Client configuration\n\n### Cursor — `~/.cursor/mcp.json`\n```json\n{ \"mcpServers\": { \"agentstack\": { \"url\": \"https://agentstack-mcp.pages.dev/mcp\" } } }\n```\n### Claude Desktop — `claude_desktop_config.json` (via `mcp-remote`)\n```json\n{ \"mcpServers\": { \"agentstack\": { \"command\": \"npx\", \"args\": [\"-y\", \"mcp-remote\", \"https://agentstack-mcp.pages.dev/mcp\"] } } }\n```\n### VS Code — `.vscode/mcp.json`\n```json\n{ \"servers\": { \"agentstack\": { \"type\": \"http\", \"url\": \"https://agentstack-mcp.pages.dev/mcp\" } } }\n```\n### Windsurf — `~/.codeium/windsurf/mcp_config.json`\n```json\n{ \"mcpServers\": { \"agentstack\": { \"serverUrl\": \"https://agentstack-mcp.pages.dev/mcp\" } } }\n```\nAdd `\"headers\": { \"X-API-Key\": \"ssak_live_...\" }` once you have a key.\n\n---\n\n## Example composite payloads\n\nRank growth strategies on their projected outcomes:\n```json\n{ \"name\": \"evaluate_options_with_scenarios\", \"arguments\": {\n  \"template\": \"saas_growth\", \"horizon\": 12,\n  \"options\": [\n    { \"name\": \"Aggressive\", \"inputs\": { \"new_customers_per_period\": 60, \"churn_rate\": 0.05 } },\n    { \"name\": \"Lean\",       \"inputs\": { \"new_customers_per_period\": 20, \"churn_rate\": 0.02 } }\n  ],\n  \"criteria\": [\n    { \"metric\": \"ending_mrr\", \"weight\": 3, \"direction\": \"benefit\" },\n    { \"metric\": \"total_churned_customers\", \"weight\": 1, \"direction\": \"cost\" }\n  ]\n} }\n```\n\nValue a plan's MRR stream:\n```json\n{ \"name\": \"plan_to_valuation\", \"arguments\": {\n  \"template\": \"saas_growth\", \"horizon\": 12,\n  \"inputs\": { \"new_customers_per_period\": 60, \"churn_rate\": 0.05, \"arpu\": 60 },\n  \"cashflow_metric\": \"mrr\", \"rate\": 0.01, \"initial_investment\": 150000\n} }\n```\n\nStress-test the decision:\n```json\n{ \"name\": \"stress_test_decision\", \"arguments\": {\n  \"template\": \"saas_growth\", \"horizon\": 12,\n  \"options\": [ { \"name\": \"Aggressive\", \"inputs\": { \"churn_rate\": 0.05 } },\n               { \"name\": \"Lean\", \"inputs\": { \"churn_rate\": 0.02 } } ],\n  \"criteria\": [ { \"metric\": \"ending_mrr\", \"weight\": 3 } ],\n  \"stress\": { \"variable\": \"churn_rate\", \"variation\": 0.5, \"steps\": 5 }\n} }\n```\n\n---\n\n## Deploy on Cloudflare Pages\n\n```bash\nnpm install\nnpx wrangler login\nnpm run deploy      # esbuild -> site/_worker.js, then wrangler pages deploy\n```\n\nRuns **fully free / private** with no bindings or secrets (fails open on the free\ntier). For billing: bind a KV namespace `AGENTSTACK_KV`, set `PRICE_STARTER` /\n`PRICE_PRO` in `[vars]`, and add Stripe secrets:\n\n```bash\nwrangler pages secret put STRIPE_SECRET_KEY    --project-name agentstack-mcp\nwrangler pages secret put STRIPE_WEBHOOK_SECRET --project-name agentstack-mcp\n```\n\nRoutes: `/mcp` (Streamable HTTP), `/checkout`, `/success`, `/portal`, `/webhook`, `/metrics`.\n\n## Auth & rate limiting\n\nEnforced in `worker-src/billing.mjs`: `identify()` reads `X-API-Key` /\n`Authorization: Bearer` and falls back to per-IP free tier; `consumeQuota()` is a\nKV daily counter (the single gating point). One key / one quota spans the whole\nstack. Marked `NOTE (auth)` / `NOTE (rate limiting)` seams show where to swap in\nJWT/mTLS or a token-bucket. None of it touches the deterministic math.\n\n## Relationship to the standalone servers\n\nAgentStack is **additive**, not a replacement. The three products keep running on\ntheir own for single-domain use:\n\n- ScenarioSim — <https://scenariosim-mcp.pages.dev/mcp>\n- DecisionMatrix — <https://decisionmatrix-mcp.pages.dev/mcp>\n- PrecisionCalc — <https://precisioncalc-mcp.pages.dev/mcp>\n\n## License\n\nMIT — see [LICENSE](./LICENSE).\n",
  "bytes": 10563,
  "sha": "8552e0e0ecf1aa968ccd0d2260a4e92a3b15e45ef6a5da00ea9da1f5cce5b4cc",
  "repo_slug": "inity13/agentstack-mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_inity13_agentstack_mcp_b8a1dd22/readme"
}