night-margin-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@night-margin-mcp Where is my portfolio leaking money?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
night-margin-mcp — Margin Engine
Wheelhouse optimizes what guests pay. night-margin protects what you keep.
Built by a property manager who runs 73 listings in Lapland — for operators like us.
An MCP server that shows every pricing decision for a short-term rental portfolio net of turnover costs — the margin guard for Wheelhouse pricing, the profit layer underneath its revenue optimization (ADR, RevPAR). The key metric: net per available night.
Quick start
claude mcp add margin -- npx -y night-margin-mcpThat's it — works with zero config on synthetic demo data. Open Claude and ask:
Where is my portfolio leaking money in June 2026?
You'll get the leak figure, the net-per-night metric, and your best and worst properties in under a minute. When you're ready to run the analysis against your own Wheelhouse portfolio, see Wheelhouse API key below.
On live data the first call is slower: one request per listing, serial, to stay inside Wheelhouse's 60 req/min limit — 3 listings ≈ 5 s, 73 listings ≈ 90 s. Results are then cached for 10 minutes.
Related MCP server: tokencost-mcp-server
What you get
The first line is the pain, in euros — this is actual zero-config output (June 2026, demo data):
€132 is leaking from 8 bookings that don't cover their own turnover cost. (4.0% of booked nights are net-negative) Net per available night: €74.7 Occupancy 72.9% (175 booked, 65 gap nights) Gross €22,821 − turnover costs €4,900 = net €17,921
Property | Net/night | Booked nights | Gap nights | Net € |
demo-1br-03 | €21.4 | 15 | 15 | €643 |
demo-1br-01 | €32 | 18 | 12 | €960 |
demo-3br-08 | €178.1 | 30 | 0 | €5,344 |
Same math, your numbers: set WHEELHOUSE_API_KEY and the analysis runs on your live portfolio.
Live demo
Want to see the output before installing anything? https://mikki321.github.io/night-margin-mcp/ — portfolio KPIs, a per-property heatmap of net per available night, and a triage table of net-negative bookings, generated by this server from the synthetic demo portfolio that ships with the package.
Example prompts
The server provides ten tools: three read-only analysis tools, a four-tool decision loop (see The decision loop), a proactive alerts tool (see Proactive alerts), review_history — a read-only mirror of your own past months net of estimated turnover cost (a description of what happened, never a forecast) — and margin_copilot, which ranks the below-floor gap nights into money-moves, weighs the options for each and marks the recommended one (read-only; staging routes through propose_decisions → apply_decision). No dates needed — analyze_portfolio and compare_strategies default to the last 30 + next 90 days (recent turnovers + your booking horizon), propose_decisions to the next 30 days; pass from/to to change. Try these directly in Claude:
analyze_portfolio— where is the money leaking?Where is my portfolio leaking money?
compare_strategies— gross vs. net in the same picture:Compare two strategies for June 2026: (A) fill gap nights at a 40% discount and (B) raise the minimum stay to three nights with a 10% price increase. Which one delivers the better net per night?
gap_night_check— is a single gap night worth filling?Property demo-1br-01 has a gap night on 2026-06-23. What's the floor price, and is the night worth filling?
propose_decisions— which upcoming nights are at risk of selling below cost?Which gap nights are about to sell below my cost floor?
apply_decision— act on a proposal:Apply decision d3
Without explicit confirmation this is a dry run: it prints the exact rate payload that would be written and changes nothing. Prices change only when you confirm the write, and every applied decision can be undone with
revert_decision.Risk presets —
propose_decisionsandgap_night_checkboth take an optionalriskparameter (conservative|recommended|aggressive, defaultrecommended) that scales the floor's minimum margin — Wheelhouse's own CON/REC/AGG language:What should I do this week? Use the aggressive risk preset.
check_alerts— proactive check for gap-floor breaches and new bookings (see Proactive alerts):Check for any pricing alerts.
The core message of the demo: filling gaps at a discount can grow revenue while shrinking profit — a 2-night and a 7-night booking consume the same cleaning.
The decision loop
New in 0.3.0 — analysis turns into safe, reversible action:
propose_decisionsfinds upcoming gap nights (next 30 days by default) where the current price recommendation sits below your cost floor (turnover + travel +MIN_MARGIN, scaled by an optionalriskpreset — see Example prompts) and proposes fixing those nights at the floor so they can't sell below cost. Proposals go into a local decision log — proposing never touches prices.apply_decisionwrites one proposal to Wheelhouse as fixed custom rates — but only with explicitconfirm: true. The default is a dry run showing the exact payload without writing anything. Before the first real write, the prior custom rates are snapshotted to the decision log, sorevert_decisioncan always delete what was written and restore what was there before.set_targetstores a monthly gross revenue target per property;analyze_portfoliothen reports progress toward any targets whose month overlaps the analysis window.
The safety model in one line: the analysis tools (analyze_portfolio, compare_strategies, gap_night_check) and propose_decisions never change any prices; writes happen only through apply_decision/revert_decision with an explicit confirm: true, always target the listing's own channel, and every write is revertible. Without a WHEELHOUSE_API_KEY you can run the whole loop up to the dry run on demo data — real writes require the key and a fresh propose against your own portfolio. The decision log and targets live locally in NM_STATE_DIR (default ~/.night-margin).
Proactive alerts (watch mode)
check_alerts is read-only and checks two things: (1) upcoming gap nights priced below your cost floor (same data as propose_decisions, always the recommended risk preset, but this tool never saves proposals to the decision log), and (2) new bookings since the last check, each shown net of turnover costs — the same twist as the rest of the server, now in a booking notification. The first run establishes a baseline (records existing bookings without alerting on them); later runs alert on bookings that were not present in the previous check. The Wheelhouse reservation payload carries no creation timestamp, so a booking made earlier will surface the first time its dates enter the 120-day horizon — "new to this check", not "booked since yesterday".
By default check_alerts is silent — it just returns the report as text, same as every other tool. To get pushed notifications, configure a channel:
Variable | Description |
| Send alerts via a Telegram bot (checked first). |
| Send alerts to a generic incoming webhook (Slack-compatible |
Neither is required — without either, check_alerts still works and simply says no channel is configured. Notifications are off unless you set one of these — nothing is ever sent by default, and the token/URL are never logged or echoed back in error messages.
For unattended checks (e.g. a daily cron job), run the server with --watch: it runs check_alerts once (sending a notification if a channel is configured), prints the report to stdout, and exits — no MCP server, no stdio transport:
0 8 * * * WHEELHOUSE_API_KEY=... NM_TELEGRAM_BOT_TOKEN=... NM_TELEGRAM_CHAT_ID=... npx -y night-margin-mcp --watchConfiguration (env)
Every setting is optional — without them, the server runs the manual cost model on synthetic demo data. Environment variables are passed via claude mcp add's -e flags:
claude mcp add margin -e WHEELHOUSE_API_KEY=xxx -e COST_SOURCE=csv -e CSV_PATH=/path/to/costs.csv -- npx -y night-margin-mcpVariable | Default | Description |
| – | Your own Wheelhouse integration key. When set, bookings are fetched from the Wheelhouse RM API; without it, synthetic demo data is used. |
| – | Optional override for the |
|
| Source of turnover costs: |
|
| Manual mode: € per turnover (cleaning). Also serves as the fallback in CSV mode when a booking has no cost row. |
| – | Optional tiering, e.g. |
| – | CSV mode: path to the cost CSV (required when |
| – | CleanHub mode: actual turnover costs from the CleanHub field-operations platform over HTTP (both required when |
|
| Minimum margin € for the gap-night floor: floor = turnover + travel + |
|
| Local state directory for the decision log, monthly targets, and the seen-bookings set (used by |
| – | Optional: send |
| – | Optional: send |
CSV mode
If you know your actual turnover costs per booking, a CSV gives you the most accurate analysis. Schema (header row required):
reservation_id,property_id,checkin,checkout,nights,gross_revenue,cleaning_cost,travel_cost,laundry_cost,turnover_date,is_sunday_or_holiday
demo-1br-01-r1,demo-1br-01,2026-06-03,2026-06-10,7,571,56,16,9,2026-06-10,falseA synthetic sample file (887 rows, covering the full 2026 calendar year of the demo data) ships with the package at examples/sample-costs.csv, and can be downloaded directly:
https://raw.githubusercontent.com/mikki321/night-margin-mcp/main/examples/sample-costs.csvUsage:
curl -o costs.csv "https://raw.githubusercontent.com/mikki321/night-margin-mcp/main/examples/sample-costs.csv"
claude mcp add margin -e COST_SOURCE=csv -e CSV_PATH="$PWD/costs.csv" -- npx -y night-margin-mcpCost rows are matched to bookings primarily by reservation_id, and secondarily by the composite key property_id|checkin|checkout. The tool response reports the attribution quality — e.g. "Cost attribution: 289/289 bookings matched by reservation_id", or with mixed sources "Cost attribution: 41 by reservation_id, 6 by composite key, 3 by average fallback (50 total)". If a row is missing and no AVG_TURNOVER_COST fallback is set, you get a clear error listing the affected bookings.
Wheelhouse API key
Without a key, the server runs on synthetic demo data (and says so in every response). With a key, you get your real bookings from the Wheelhouse RM API: the server fetches your listings and reservations, and every metric is computed from your own portfolio.
The key is your own Wheelhouse integration key (the API's
X-Integration-Api-Keyheader). Get it from your Wheelhouse account's integration settings or from Wheelhouse support — API documentation: https://api.usewheelhouse.com/wheelhouse_rm_api.Pass it as an environment variable:
claude mcp add margin -e WHEELHOUSE_API_KEY=xxx -- npx -y night-margin-mcp.Never commit the key to git — not in a
.envfile in the repo, not in README examples, not in commits. The key travels only as an environment variable.
If the key is invalid or the network flakes, the server returns a clear error with instructions — it does not silently fall back to demo data, so you'll never mistake mock numbers for your own.
For developers
Local development:
npm install
npm test
npm run build
claude mcp add margin -- node "<repo path>/dist/index.js"If the npm package doesn't work for any reason, the same server installs directly from GitHub:
claude mcp add margin -- npx -y github:mikki321/night-margin-mcpExploring the Wheelhouse API with curl
Use these commands to verify auth and inspect response shapes (redact guest names/emails before sharing; field names and formats are preserved):
# 1) Listings — confirms auth + provides listing_id and channel
curl -s -H "X-Integration-Api-Key: $WHEELHOUSE_API_KEY" \
"https://api.usewheelhouse.com/ss_api/v1/listings?per_page=5&page=1" | head -c 4000
# 2) Reservations — THE blocking one (full JSON for 2–3 reservations)
curl -s -H "X-Integration-Api-Key: $WHEELHOUSE_API_KEY" \
"https://api.usewheelhouse.com/ss_api/v1/listings/<LISTING_ID>/reservations?channel=<CHANNEL>" | head -c 6000
# 3) Price recommendations — for gap_night_check, lower priority
curl -s -H "X-Integration-Api-Key: $WHEELHOUSE_API_KEY" \
"https://api.usewheelhouse.com/ss_api/v1/listings/<LISTING_ID>/price_recommendations?channel=<CHANNEL>" | head -c 4000The rate limit is 60 requests/min — the server runs requests serially and backs off on 429 responses (2 s / 4 s / 8 s).
Core math
net_per_night = (gross − cleaning − laundry − travel) / available nights
available = booked nights + gap nights in the analysis window
gap_floor = turnover cost + travel + MIN_MARGIN
leak = Σ(€ of net-negative bookings) and % of booked nightsAll data shipped with the repo and the package is synthetic — no real customer or property data is included.
Available Tools
10 toolsanalyze_portfolioAnalyze portfolio net per available nightA
The margin guard for Wheelhouse pricing. Computes a short-term rental portfolio's net after turnover costs (cleaning, laundry, travel): net per available night, leak (net-negative bookings), and the best and worst properties. Read-only — never changes any prices. from/to are optional — without them the window defaults to the last 30 + next 90 days.
Inputs: to, from, avg_turnover_cost.
apply_decisionApply a pricing decision to WheelhouseA
Applies a proposed pricing decision to Wheelhouse for real (writes fixed custom rates for the decision's gap nights). This tool DOES change prices — but only with explicit confirm=true; it defaults to a dry run that shows the exact payload without writing anything. The prior custom rates are snapshotted to the decision log before writing, so every applied decision can be undone with revert_decision. Requires WHEELHOUSE_API_KEY.
Inputs: decision_id (required), confirm, dry_run.
check_alertsCheck for gap-floor and new-booking alertsA
Read-only proactive check: (1) upcoming gap nights priced below your cost floor (recommended risk preset — same data as propose_decisions, but this tool never saves proposals to the decision log), and (2) new bookings since the last check, each shown net of turnover costs. Never writes prices. Sends a notification if a channel is configured (NM_TELEGRAM_BOT_TOKEN + NM_TELEGRAM_CHAT_ID, or NM_WEBHOOK_URL) and send is not false — without a channel configured, nothing is sent and the text report is returned as usual. Also available as night-margin-mcp --watch for cron.
Inputs: send.
compare_strategiesCompare pricing strategies on netA
Simulates two pricing strategies and compares them to the baseline on net after turnover costs: A fills gap nights at a discount (default 40% off the property's ADR), B drops bookings below a minimum stay and raises the remaining prices (default min 3 nights, +10%). Shows gross, net, net/night, occupancy, turnovers, and leak per scenario — revealing when gross-optimizing fill is a net loss. Strategy A assumes every gap night sells at the discounted price — an upper bound, not a forecast. Read-only simulation — never changes any prices. from/to are optional — without them the window defaults to the last 30 + next 90 days.
Inputs: to, from, min_stay, uplift_pct, +1 more.
gap_night_checkCheck gap night fill (FILL/SKIP)A
Checks whether filling a single gap night is worth it: computes the floor price (turnover cost + travel + minimum margin MIN_MARGIN, adjustable with the risk preset) from the median of the property's actual cost rows and compares the candidate price against it → FILL if price ≥ floor, otherwise SKIP. The verdict reports both the floor clearance and the actual net after turnover costs. If the date is already booked, reports which booking covers it. Read-only — never changes any prices.
Inputs: date (required), property_id (required), risk, candidate_price.
margin_copilotRank where money moves and weigh the options (read-only)A
Margin Copilot: reads the same figures as propose_decisions, groups the gap nights priced below your cost floor into per-property money-moves, ranks them by below-floor exposure (biggest first), and weighs the options for each — Hold, Guard the floor (recommended), and where it applies, raise the minimum stay — with one marked recommended. The only euro figures are computed (below-floor exposure, floor levels); it does NOT invent a '30-day net' or option deltas that would require guessing fill probability, and it never claims an unsold night as a gain. Read-only — it never writes prices or state. Staging a recommended move routes to propose_decisions → apply_decision, where every write is previewed and needs an explicit confirm. Requires WHEELHOUSE_API_KEY (uses live price recommendations).
Inputs: to, from, risk.
propose_decisionsPropose pricing decisions (gap night floors)A
Proposes concrete pricing decisions in euros: finds upcoming gap nights where the current price recommendation is below your cost floor (turnover + travel + MIN_MARGIN, adjustable with the risk preset) and proposes fixing those nights at the floor so they can't sell below cost. Proposals are saved to the local decision log (NM_STATE_DIR, default ~/.night-margin). Window defaults to the next 30 days. Proposing never changes prices — prices change only when a decision is applied with apply_decision and explicit confirmation.
Inputs: to, from, risk.
revert_decisionRevert an applied pricing decisionA
Reverts an applied pricing decision: deletes the custom rates it wrote in Wheelhouse and restores any prior custom rates from the snapshot taken before the write. This tool DOES change prices — but only with explicit confirm=true; without it you get a preview. Requires WHEELHOUSE_API_KEY.
Inputs: decision_id (required), confirm.
review_historyReview your own past months (net of estimated turnover cost)A
Season review: mirrors your OWN past monthly Wheelhouse KPIs back at you — per month, your revenue, an ESTIMATED turnover cost, estimated net, and what fraction of gross the cleaning ate (turnover share), plus occupancy and ADR. Turnover cost is estimated from monthly averages (occupied nights ÷ average length of stay × AVG_TURNOVER_COST), not measured per booking, and is labeled as an estimate. It describes what already happened over your real history; it does NOT forecast, does NOT recommend or rank strategies, and does NOT say what you 'should have' done or what another strategy 'would have' earned. Window defaults to all available history (usually only a handful of months per listing — it states the real span, never 'last year' or '5 years' unless the data actually covers it). Read-only — never changes any prices and never writes any state. Requires WHEELHOUSE_API_KEY.
Inputs: to, from, avg_turnover_cost.
set_targetSet a monthly gross revenue targetA
Sets a monthly gross revenue target for a property (saved locally to NM_STATE_DIR, default ~/.night-margin). Shows the month's booked gross so far when it can be computed. analyze_portfolio then reports progress toward any targets whose month overlaps the analysis window.
Inputs: month (required), property_id (required), gross_target (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
Every tool has a clearly distinct purpose: analysis, target setting, alerts, history review, strategy comparison, gap evaluation, proposal creation, application, reversion, and a copilot for recommendations. Despite some conceptual overlap (e.g., gap_night_check and propose_decisions both deal with gap nights), their scope and output are well-differentiated.
Most tools follow a consistent verb_noun pattern (e.g., analyze_portfolio, set_target, check_alerts). However, 'margin_copilot' deviates as a noun phrase, breaking the pattern slightly. The rest are uniformly snake_case with a clear verb.
With 10 tools, the set is well-scoped for the domain of short-term rental pricing management. Each tool contributes a specific, necessary function without redundancy, making the API lean yet comprehensive.
The tools cover the full price decision workflow: analysis, proposal, application, reversion, and monitoring. Missing are operational tools like notification configuration or historical alert logs, but these are secondary. The core lifecycle is complete, with safety features (dry runs, snapshots) included.
Maintenance
Related MCP Connectors
Airbnb MCP server for short-term rental data: occupancy, ADR, RevPAR, revenue, comps, live rates
MCP server with quote and live cryptocurrency price tools, local and cloud-deployed transports.
MCP server for VC pitch-deck scoring, thesis-fit matching, and deal-flow management.
A hosted MCP server for planning, scheduling, media, analytics, and social publishing.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceAn MCP server designed to automate tender and RFQ pricing by extracting requirements from documents and building structured pricing models. It enables users to calculate final costs, compare market rates, and generate styled HTML pricing reports for PDF export.-
- AlicenseAqualityDmaintenanceAn MCP (Model Context Protocol) server that provides real-time LLM token pricing data for 60+ AI models across 15 providers.624 npm2MIT
- FlicenseAqualityDmaintenanceMCP server for the Rizerve direct booking platform. Enables managing properties, bookings, availability, iCal sync, analytics, and webhooks through AI assistants.191-
- FlicenseNot gradedqualityDmaintenanceMCP server for reading, aggregating, suggesting, and applying price rules (floors) from ActiveView with a confirmation flow, designed for AI agents to analyze and adjust monetization.-