{
  "markdown": "# @marocain/mcp-server\n\n[![npm](https://img.shields.io/npm/v/@marocain/mcp-server.svg)](https://www.npmjs.com/package/@marocain/mcp-server)\n[![ci](https://github.com/Hei33enberg/marocain-mcp-server/actions/workflows/ci.yml/badge.svg)](https://github.com/Hei33enberg/marocain-mcp-server/actions/workflows/ci.yml)\n[![license](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)\n[![node](https://img.shields.io/badge/node-%3E%3D18-green.svg)](./package.json)\n[![Glama MCP](https://glama.ai/mcp/servers/@marocain/mcp-server/badges/score.svg)](https://glama.ai/mcp/servers/@marocain/mcp-server)\n[![Smithery MCP](https://smithery.ai/badge/@marocain/mcp-server)](https://smithery.ai/server/@marocain/mcp-server)\n\nThe official **Model Context Protocol** server for [marocain.investments](https://marocain.investments) — bringing **{GIN}**, our authored real-estate intelligence for Morocco, into any MCP client (Claude Desktop, IDEs, agents).\n\nDiscover, score and analyse Moroccan luxury real estate — then submit an enquiry that's routed on-platform. All the analysis is free; contact with the agent is always intermediated by the platform.\n\n## What is {GIN}?\n\n{GIN} is the platform's proprietary scoring DNA. Instead of one blurry \"AI score\", it speaks with **two coherent pillars fused into one honest verdict**:\n\n- **{GIN} Quality** — how good the *asset* is (vision view/structural/condition + location + yield + WC 2030 catalyst + trust).\n- **{GIN} Deal** — how good the *buy* is (asking price vs. the M-Value AVM, adjusted for city momentum).\n- **Fused verdict** — one buy/hold/pass headline that can never disagree with the numbers (\"Prime asset, priced to buy\", \"Cheap — verify condition\", …).\n\nIt's the difference between a *good property* and a *good deal* — the question generic scores never answer. It's honest by design: an overpriced listing is told it's overpriced.\n\n## Install\n\nNo install needed — run it straight from npm:\n\n```bash\nnpx -y @marocain/mcp-server\n```\n\n### Claude Desktop\n\nAdd to `claude_desktop_config.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"marocain\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@marocain/mcp-server\"]\n    }\n  }\n}\n```\n\n## Tools\n\nFourteen tools — eleven read-only analysis tools (sale **and** rental), a moat-safe enquiry tool, and two commerce tools (discover + order paid services).\n\n### Analyse — sales (free)\n\n| Tool | What it does |\n|------|--------------|\n| `search_listings` | Search AI-graded Moroccan **for-sale** listings by city, typology, price, rooms, free-text. |\n| `get_listing` | Full detail for one listing — price (USD/MAD), AI scores, M-Value AVM, trust, {GIN} pillars + verdict. |\n| `get_gin_score` | The {GIN} verdict: Quality + Deal pillars + the fused buy/hold/pass headline. |\n| `get_market` | Macro market facts for a city or national scope (median price, supply, momentum, WC 2030 / TGV catalysts). |\n| `listing_derive` | AI-derived one-paragraph investment memo for a listing (6 languages). |\n| `semantic_search` | Conceptual / vector search across the catalogue **and** the authored guides (Foreign Buyer's Playbook, Morocco-vs-Dubai, AI-scoring methodology, residency, city theses). |\n| `gin_ask` | Ask **T{AI]GIN**, the agentic investment analyst, a one-shot question — it plans, searches, scores with the {GIN} pillars and answers with citations. |\n| `gin_deal_memo` | A structured, honest investor **deal memo** for one listing (verdict, M-Value, yield, strengths, risks, district read, next steps). |\n\n### Analyse — rentals (free)\n\n| Tool | What it does |\n|------|--------------|\n| `search_rentals` | Search AI-graded Moroccan **long-let rentals** (residential / commercial / student) by city, typology, monthly-rent band (MAD or USD) and tier. Rent in MAD/month; never returns landlord/agency contact. |\n| `rent_affordability` | How much monthly rent a net income comfortably supports — the same **rent ≤ 33% of net income** rule as [/finance](https://marocain.investments/finance). Income in MAD or USD. |\n| `rent_vs_buy` | Compare the monthly cost of **buying vs renting** a property — same mortgage annuity engine as /finance (30% down · 20y · 5.2% defaults, all overridable). Principal + interest only. |\n\n### Enquire & transact\n\n| Tool | What it does |\n|------|--------------|\n| `request_service` | Submit a buyer **enquiry** / request a viewing — routed on-platform to the listing's verified agent. Returns a reference, **never** any contact. |\n| `list_services` | The transactable **service catalogue** + EUR prices — buyer services (AI staging, viral content, reservation, appraiser, visitation — note the live API `product_type` id is spelled `visaitation` — the €199 AI business plan, lawyer / financing / commercialization) and agent services (listing boost, photo relight). |\n| `order_service` | **Order** any service. Instant products return a Stripe `checkout_url` (pay on-platform); request-only products return a tracked `order_id`. Never returns contact. |\n\n> **Payments:** card checkout for *instant* products may be briefly unavailable while the platform reconnects its payment processor — request-based services and buyer enquiries work regardless. `order_service` reports this cleanly.\n\n## Discover → analyse → enquire\n\nThe model is simple and the same for everyone: **all the intelligence is free** (it's lead-gen), and **the only way to make contact is through the platform** (that's the moat, and how agents are billed).\n\n1. **Discover & score** with `search_listings` / `get_gin_score` / `semantic_search`.\n2. **Go deep** with `get_listing` / `gin_deal_memo` / `gin_ask`.\n3. **Enquire** with `request_service` — it routes the buyer's interest to the listing's verified agent and returns a reference. You never receive the agent's phone, email or WhatsApp; the platform intermediates contact.\n\n> Most of the catalogue is still being onboarded by agents. `request_service` routes to a listing's **claimed, verified agent**; for a listing without one yet it returns a clear note instead of routing.\n\n## Example response shapes\n\n`get_gin_score({ id })` → the authored verdict:\n\n```json\n{\n  \"id\": \"…\",\n  \"title\": \"…\",\n  \"price_usd\": 9630000,\n  \"gin_verdict\": { \"key\": \"prime_value\", \"label\": \"Prime asset, priced to buy\", \"tone\": \"strong\" },\n  \"gin_quality\": 76,\n  \"gin_deal\": 64,\n  \"m_value_usd\": 9100000,\n  \"trust\": { \"title_verified\": false, \"fcr_status\": \"unknown\" }\n}\n```\n\n`request_service({ listing_id, buyer_name, buyer_email, message })` → an on-platform reference, no contact:\n\n```json\n{ \"ok\": true, \"kind\": \"lead\", \"lead_id\": \"…\", \"status\": \"requested\", \"routed\": true }\n```\n\n## Moat-safe by design\n\nNo tool ever returns an agent's, landlord's or seller's contact. On top of the public API hiding the phone, this server **redacts the origin-portal deep link** (`source_url` / `source_listing_id`) and the **agent / agency name** from listing payloads — so a downstream agent can't route a user off-platform to the seller. Rentals (`search_rentals`) are read through the site's public, anon-granted `rental_browse` RPC, which is `SECURITY DEFINER`, scrubs PII in SQL and whose return signature carries **no** contact / source fields at all; the result still passes through the same central `stripMoat()` as every other tool. The single conversion path is `request_service`, which routes a buyer enquiry through marocain's own lead flow and returns a reference, never any contact. Discover, score and analyse freely; **contact is always intermediated by the platform.**\n\n## Troubleshooting\n\n| Symptom | Cause | Fix |\n|---|---|---|\n| `request timed out after 30000ms` | Upstream slow or unreachable. | Retry. Bump `MAROCAIN_TIMEOUT_MS` if your network is high-latency. |\n| `The Marocain API returned an error (403)` | Rare — Vercel platform-level anti-bot on very bursty traffic. | Back off and retry. |\n| `valid buyer_email required` (from `request_service`) | A buyer name + valid email are mandatory so the agent can reply. | Supply both. |\n| `listing_unclaimed` (from `request_service`) | The listing has no claimed agent yet, so the enquiry can't be routed. | Try a claimed/verified listing; check back as agents onboard. |\n| `ignoring disallowed MAROCAIN_API_BASE` | You set `MAROCAIN_API_BASE` to a non-HTTPS or non-allowlisted host. | Leave it unset (the default is correct). |\n\n## Configuration\n\n| Env var | Default | Purpose |\n|---------|---------|---------|\n| `MAROCAIN_API_BASE` | `https://marocain.investments` | Override the API origin (testing only; must be HTTPS + allowlisted). |\n| `MAROCAIN_TIMEOUT_MS` | `30000` | Per-request upstream timeout. |\n\n## Related\n\n- Skills catalog: [`@hei33enberg/luxury-skills`](https://www.npmjs.com/package/@hei33enberg/luxury-skills) (npm) — the machine-readable capability catalog this server draws from.\n- Live API: `https://marocain.investments/api/public/*` · AEO manifest: [`/llms.txt`](https://marocain.investments/llms.txt).\n\n## Releasing\n\nPublishing to npm is automated by a GitHub Action (`publish-mcp`) in the platform repo:\n\n```bash\n# bump the version, commit, push — the Action publishes @marocain/mcp-server\nnpm version patch        # or minor / major  (edits package.json)\ngit push --follow-tags\n```\n\nLocal `npm test` runs the unit tests (CI runs them on Node 18/20/22); CI additionally runs the black-box MCP handshake smoke (`node test/smoke.mjs`) on Node 20.\n\n## License\n\nMIT © marocain.investments\n",
  "bytes": 9384,
  "sha": "e31c1e15612e34a4c85a1585474f0419d71ddb04fc945b619d1aed4bbf176484",
  "repo_slug": "hei33enberg/marocain-mcp-server",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_hei33enberg_marocain_mcp_serve_7372823d/readme"
}