The Fredy MCP Server exposes your real estate jobs and listings data to LLM clients. It supports two transports:
- Stdio: for local LLM clients (Claude Desktop, LM Studio, llm-cli, mcp-cli, etc.)
- Streamable HTTP: for remote LLM clients (ChatGPT, cloud-hosted agents, etc.)
All MCP access is token-based based. Every Fredy user is automatically assigned a permanent, non-expiring MCP token when their account is created. This token is a secret and should be treated like a password.
MCP tokens are displayed in the User Management list (Admin → Users). Each user's token is shown in the "MCP Token" column.
Important: MCP tokens never expire. They are permanent secrets tied to each user account. If a token is compromised, you must change the token! If you chose to use a token from an admin account, the LLM can query information from ALL jobs/listings.
Remote connectors cannot be handed a static token, so the HTTP transport also speaks OAuth 2.1 with dynamic client registration (PKCE S256, tokens bound to <baseUrl>/api/mcp per RFC 8707). Requirements and behaviour:
baseUrlmust be set to the public HTTPS URL of your Fredy instance. Tokens are bound to that URL, not to whateverHostheader a request carries.- Add
<baseUrl>/api/mcpas a remote MCP server in the client; it discovers/.well-known/oauth-protected-resource/api/mcp, registers itself at/api/oauth/register, and sends you to Fredy to sign in and approve access. - Access tokens live for one hour and are refreshed automatically; refresh tokens rotate on every use and a replayed refresh token revokes the whole grant.
- Every user sees and revokes their connected apps under Settings → Connections, where each one shows whether it was approved for reading or for reading and writing. Revoking takes effect immediately.
- Expired codes and tokens, and registrations that never completed an authorization, are swept hourly. Unauthenticated registration is rate-limited per address.
Manually issued MCP tokens keep working alongside OAuth.
| Tool | Description |
|---|---|
list_jobs |
List real estate search jobs with pagination and text filtering |
get_job |
Get detailed information about a specific job |
list_listings |
Search and list real estate listings with pagination, text search, and filters |
get_listing |
Get full details of a single listing |
calculate_financing |
Work out whether a property is affordable, using a German mortgage model |
get_current_date_time |
Gets the current date/time for the llm to be used |
These change something. Each is annotated so a client can warn before calling it, and each goes through the same ownership, sharing and channel-permission rules as the web UI.
| Tool | Description | Destructive |
|---|---|---|
add_listing_note |
Append a note to a listing, keeping what is already there | no |
set_listing_notes |
Replace a listing's notes outright; an empty string clears them | yes |
watch_listing |
Put a listing on the watchlist. Repeating it is not an error | no |
unwatch_listing |
Take it off again. Repeating it is not an error | no |
start_job_draft |
Begin the interview that creates a search job | no |
update_job_draft |
Record one answer and get the next question | no |
create_job_from_draft |
Create the job, once the user has confirmed the summary | no |
discard_job_draft |
Throw the interview away | no |
Only tools that can overwrite or delete something the user wrote beyond recovery are marked destructive, and the rule is narrow on purpose: destructive means this can overwrite or delete something the user wrote. A watch flag and an in-memory draft are neither, and marking them destructive would train people to click straight through the prompt that guards the one that is.
Two note tools rather than one with a mode parameter, because the annotations are per tool: a single tool would have to be marked destructive, and Claude.ai would then confirm every harmless append.
Watching uses ensureWatch / deleteWatch, never a toggle - a client that retries a failed watch_listing must not silently unwatch the listing.
Jobs, notification channels, listings and the user's own core settings can be administered over MCP. Each tool calls the same service the matching web route calls - lib/services/jobs/jobService.js, lib/services/channels/channelService.js, lib/services/listings/listingActionService.js, lib/services/settings/userSettingsService.js (with homeAddressService.js) and manualListingService.js - so every rule a change is held to, from ownership to the demo-mode locks, is written once and applies to both. What the tools add is only what a model needs: confirmation before a destructive call, merging where a model cannot read back what it would replace, and answers that say what to do next. Not covered: restoring hidden listings, scam verdicts, address corrections and detail refetches, bulk deletes, attachments, application templates, the smaller display preferences, and everything admin-only (general settings, users, backups) - those stay in the web UI.
A rule that runs through all of them: a model can only change what it can read back. Every replacing list (providerUrls, homeAddresses) is shown in full by the matching read tool, and what a model cannot be shown (channel secrets) or would only ever want to change a part of (the two profiles) is merged rather than replaced.
Jobs
| Tool | Description | Destructive |
|---|---|---|
run_job |
Run one job now, in the background | no |
run_all_jobs |
Run every job the user is allowed to run | no |
set_job_enabled |
Switch a job on or off | no |
update_job |
Edit a job: read it with get_job first, pass only what changes, every list is the complete list (get_job shows each search URL, so one can be added by resending the rest) |
no |
delete_job |
Remove a job and all its listings, after confirmed: true |
yes |
Runs are carried out by the running Fredy server; the standalone stdio process refuses and says so, because it has no scheduler attached. Editing re-uses the interview's validation (URL resolution, channel permissions, currency agreement), which words a problem for a model, and refuses anything that would leave the job without a name, search, deal type or channel. The job is then stored through the web form's own save, which checks it again, and the job's drawn area filter is never touched.
Notification channels
| Tool | Description | Destructive |
|---|---|---|
list_channels |
The channels this user may attach to a job, with usage counts | read-only |
list_adapters |
The notification types and the field definitions they take | read-only |
create_channel |
Create a channel; field values are stored but never shown back | no |
update_channel |
Rename or reconfigure; only the fields sent change, null removes an optional one | no |
delete_channel |
Remove a channel no job uses, after confirmed: true |
yes |
test_channel |
Send one test listing through a stored channel | no |
Channel secrets (tokens, feed urls) are never serialised back - not masked, simply never sent. Because a model never sees them, update_channel merges where the web form replaces: changing a chat id never needs the token again. Everything else is the web form's save: a field name the adapter does not have is refused (under a merge, a typo would otherwise be stored beside the real field and change nothing), and so is a channel left without a field it needs. A channel still used by a job cannot be deleted, and the answer names the jobs - before the user is asked to confirm, since no answer would change it.
Creating a channel does mean the user hands its credentials to the model - a bot token pasted into the chat sits in the model provider's history. Anyone who would rather not can create the channel in the web UI and attach it over MCP.
Listings and settings
| Tool | Description | Destructive |
|---|---|---|
set_listing_status |
Mark a listing applied, rejected or accepted (which also watches it, as in the web UI), or clear it | no |
add_listing_by_url |
Store a single pasted advert under a job the user names | no |
delete_listing |
Hide a listing (default) or remove it permanently with hard: true, hidden or not |
yes |
get_user_settings |
Read language, theme, addresses, and both profiles in full | read-only |
update_user_settings |
Change any of those; the profiles are merged key by key, null on a key removes it | no |
A search job needs four things a model cannot invent - a name, at least one search URL from a supported portal, a deal type, and a notification channel - plus a handful of optional filters. Rather than one create_job tool with a large payload, the server holds a draft and computes the next question:
- name - up to 40 characters, the same limit the web form enforces.
- providerUrls - the portal is worked out from the URL's host, so the user is never asked to name it. A URL that is only the portal's homepage is refused: it saves cleanly, runs on schedule and quietly finds nothing.
- dealType - renting or buying. The URLs usually give it away, and the draft offers that reading, but the question is still asked.
- channelIds - one or more of the user's own channels. A user with none is told where to create one; the draft waits.
- refinements - price, size, rooms, blacklist words, excluded locations matched against listing addresses for this job, travel-time limits, sharing, and whether the job starts switched on. Asked once, and answerable with "skip".
- ready - the summary is read back to the user, and only then does
create_job_from_draftwithconfirmed=truecreate anything.
Why the server keeps the state: putting the interview inside the model works with Claude and does not work with the local models this server is mostly pointed at. They send one guessed payload, or forget an answer given two turns ago.
Details worth knowing:
- The draft lives in memory, keyed by user, for 30 minutes after the last answer. A restart loses it, which costs one re-interview. A client that reconnects mid-interview picks up where it left off;
start_job_draftresumes rather than restarts unlessreplace: trueis passed. - Every list field is the complete list, replacing the previous one. An LLM asked to "add one more" reliably resends the whole list and much less reliably works out a delta.
- An update that gets one field wrong applies none of it and reports every problem at once.
- Everything is re-validated from scratch at creation time. A channel can be made private, an address renamed or a shared user deleted while the interview is running; the interview is not an authorization.
- Out of scope, deliberately: area filters (a polygon is drawn, not described - the created-job response and every edit say where to add one). Everything else the web UI does to a job, a channel, a listing or the user's settings has a tool; see "Administering Fredy through MCP" above.
Example prompts:
"Create a new search for two-bedroom flats to rent in Cologne on ImmoScout, notify me on Telegram."
"Add a note to listing abc123: viewing on Tuesday at 6, agent said pets are fine."
Every user decides for their own account under Settings → MCP server. The server is on by default, with every tool.
- The server switch. Turned off,
/api/mcpanswers this user with403on every request, sessions that are already open included, and the stdio transport refuses to start for their token. Nothing is deleted: tokens and OAuth connections keep existing and work again once the switch is back on. - One switch per tool. A tool turned off is left out of
tools/list, and a client with an open session getsnotifications/tools/list_changed. A call that still names it is refused. - Where it is enforced.
authenticateToolCall(mcpAuthentication.js) refuses both cases, for every transport, so nothing depends on a client honouring the trimmed list. The list itself is trimmed byapplyMcpToolSettings(mcpAdapter.js), which the HTTP route runs on every request and the stdio transport on every message. - What the page shows. The tools come from the server:
GET /api/user/mcp-serveranswers with every registered tool, its title, its description and itsreadOnlyHint, read off the same registrations clients see. The UI keeps no list of its own, so a new tool shows up on the page as it is added here. - How it is stored. One user setting,
mcp_server, holding{ enabled, disabledTools }. The tools turned off are stored, not the ones that are on, so a tool added in a later release starts out on.
page(number, optional) - Page number (default: 1)pageSize(number, optional) - Results per page (default: 50, max: 1000). Use pagination to fetch more.filter(string, optional) - Free-text filter on job name
Response: markdown table with columns ID, Name, Enabled, Active Listings. Includes summary and pagination info.
jobId(string, required) - The job ID to retrieve
page(number, optional) - Page number (default: 1)pageSize(number, optional) - Results per page (default: 50, max: 1000). Use pagination to fetch more.filter(string, optional) - Free-text search across title, address, provider, linkjobId(string, optional) - Filter listings by job IDactiveOnly(boolean, optional) - When true, only show active listingsprovider(string, optional) - Filter by provider namecreatedAfter(number, optional) - Only include listings created at or after this unix timestamp in milliseconds (e.g.1772008362564). Useful for queries like "give me all listings from today".createdBefore(number, optional) - Only include listings created at or before this unix timestamp in milliseconds (e.g.1772008362564).minPrice(number, optional) - Only include listings with price >= this value (e.g.500). Numeric, no currency symbol.maxPrice(number, optional) - Only include listings with price <= this value (e.g.1500). Numeric, no currency symbol.sortField(string, optional) - Sort by: created_at, price, size, provider, title, is_activesortDir(string, optional) - Sort direction: asc or desc
Response: markdown table with columns ID, Title, Address, Price, Size, Provider, Active, Created, Job. Includes summary and pagination info. Use get_listing for full details.
Note: All timestamps are unix timestamps in milliseconds (e.g.
1772008362564), not seconds.
listingId(string, required) - The listing ID to retrieve
Prices up a property as a German Annuitätendarlehen and judges it against the 35 % rule.
Every parameter is optional and falls back to the finance profile saved in the UI, so
calculate_financing({ listingId: "abc" }) is usually all you need.
listingId(string) - Listing to price up. Its price overridespurchasePrice.purchasePrice(number) - Purchase price in EUR, when not using a listingequity(number) - Eigenkapital in EURbundesland(string) - Two-letter code (BW,BY,BE,BB,HB,HH,HE,MV,NI,NW,RP,SL,SN,ST,SH,TH), sets the GrunderwerbsteuerannualRate(number) - Sollzins in percent, e.g.3.8tilgung(number) - Anfängliche Tilgung in percent per year, e.g.2fixedYears(number) - Zinsbindung in years, e.g.10monthlyPayment(number) - Monthly instalment in EUR. Overridestilgung; the two are the same quantity from opposite endsmaklerPct(number) - Buyer's agent commission in percent;0for a private salenetIncome(number) - Combined monthly net income, overriding the saved profilelivingCosts(number) - Monthly living costs excluding rent
Response: markdown with the verdict (affordable / a stretch / out of reach), the monthly rate and what share of net income it is, the Kaufnebenkosten breakdown, the loan amount, the years to payoff, the Restschuld at the end of the Zinsbindung, the debt-free age, and a comparison table when several rate scenarios are configured.
Listings are user-scoped exactly as in the other tools: asking for a listing that belongs to someone else returns "Listing not found".
Note: The result is an estimate based on standard German purchase costs. It is not financial advice, and the Grunderwerbsteuer table ships as an editable default.
The stdio transport communicates over stdin/stdout and is ideal for local LLM tools.
MCP_TOKEN=fredy_<your-token> node mcp/stdio.js
# or
MCP_TOKEN=fredy_<your-token> yarn mcp:stdioThe MCP Inspector lets you interactively test your MCP server in a browser UI.
npx @modelcontextprotocol/inspector -e MCP_TOKEN=fredy_<your-token> -- node mcp/stdio.jsOnce the inspector is running, open the URL shown in your terminal (usually http://localhost:6274). You can then:
- Click Connect to establish the stdio connection
- Go to the Tools tab to see all available tools
- Select a tool, fill in parameters, and click Run to test it
LM Studio supports MCP servers natively, allowing your local LLM to access Fredy's jobs and listings data.
-
Open LM Studio and load a model that supports tool use (e.g., Qwen 2.5, Llama 3.1, Mistral, etc.)
-
In the right side under Integrations click on "# install" and "edit mcp.json"
-
Edit the LM Studio MCP config file directly (
~/.lmstudio/config/mcp.jsonor via the UI export):{ "mcpServers": { "fredy": { "command": "node", "args": ["/absolute/path/to/fredy/mcp/stdio.js"], "env": { "MCP_TOKEN": "fredy_<your-token>" } } } } -
Toggle the server on: LM Studio will spawn the stdio process and connect
-
You should see the Fredy tools appear as available tools
After testing numerous LLM's, I got the best results with Qwen 3.5 or Qwen 2.5.. E.g. Qwen2.5-14B-Instruct-1M-8bit.
Once connected, simply ask your LLM about your real estate data in natural language:
- "Show me all my active search jobs"
- "List the latest listings from my Berlin apartment search"
- "Get details for listing XYZ"
- "What are the cheapest listings across all my jobs?"
The LLM will automatically call the appropriate Fredy MCP tools and present the results.
Tip: Make sure Fredy is running and the database is accessible before starting the MCP server in LM Studio. The stdio transport initializes its own database connection, so Fredy's main process does not need to be running, but the database file must exist and be up-to-date (migrations applied).
Claude Desktop supports MCP servers natively via its developer settings.
-
Open Claude Desktop
-
Go to Settings → Developer → Edit Config - this opens the
claude_desktop_config.jsonfile -
Add the
fredyserver to themcpServersobject:{ "mcpServers": { "fredy": { "command": "/opt/homebrew/opt/node@22/bin/node", "args": ["/absolute/path/to/fredy/lib/mcp/stdio.js"], "env": { "MCP_TOKEN": "fredy_<your-token>" } } } }Replace
/absolute/path/to/fredywith the actual path on your machine (e.g./Users/you/dev/fredy).Important: Claude Desktop launches with a restricted
PATHand often cannot findnodeby name. Always use the full absolute path to the node binary. Find yours by runningwhich nodein a terminal. Common locations:- Homebrew (default):
/opt/homebrew/bin/node - Homebrew (versioned, e.g. node@22):
/opt/homebrew/opt/node@22/bin/node - nvm:
/Users/<you>/.nvm/versions/node/<version>/bin/node
- Homebrew (default):
-
Save the file and restart Claude Desktop
-
You should see a hammer icon (🔨) in the chat input - click it to confirm the Fredy tools are listed
Once connected, simply ask Claude about your real estate data:
- "Show me all my active search jobs"
- "List the latest listings from my Berlin apartment search"
- "What are the cheapest apartments added this week?"
Claude will automatically call the appropriate Fredy MCP tools.
Note: Fredy's main web process does not need to be running - the stdio transport opens its own database connection directly. But the SQLite database file must exist and migrations must have been applied.
The HTTP transport is automatically available when Fredy is running. It uses the MCP Streamable HTTP protocol at:
POST /api/mcp - JSON-RPC messages (initialize, tool calls)
GET /api/mcp - SSE stream for server-initiated notifications
DELETE /api/mcp - Terminate session
All requests must include the token as a Bearer token:
Authorization: Bearer fredy_<your-token>
curl -X POST http://localhost:9998/api/mcp \
-H "Content-Type: application/json" \
-H "Authorization: Bearer fredy_<your-token>" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2025-03-26",
"capabilities": {},
"clientInfo": { "name": "test-client", "version": "1.0.0" }
}
}'curl -X POST http://localhost:9998/api/mcp \
-H "Content-Type: application/json" \
-H "Authorization: Bearer fredy_<your-token>" \
-H "Mcp-Session-Id: <session-id-from-init-response>" \
-d '{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "list_jobs",
"arguments": { "page": 1, "pageSize": 10 }
}
}'- Every user is automatically assigned a permanent MCP token at account creation - tokens never expire
- Tokens are cryptographically random (256-bit) and prefixed with
fredy_ - Each token is scoped to a single user - the LLM can only access that user's data
- Non-admin users only see their own jobs and jobs shared with them
- Tokens are stored in the
mcp_tokencolumn of theuserstable - Tokens are deleted automatically when the owning user is removed
- The
/api/mcpendpoint uses Bearer token auth (independent of cookie-session) - Treat MCP tokens like passwords - do not share them publicly
- Write tools go through the same services as the web UI, so they enforce the same rules: a listing must be one the user can already see, a notification channel must be one they are allowed to send through, and a job can only be shared with a non-admin other user
- Channel credentials are never returned. The interview is handed a channel list stripped of its
fieldsbefore it reaches the adapter, so a bot token cannot reach an LLM transcript even by accident - While demo mode is on, every write tool refuses non-admin users. The public demo is read-only over MCP
- Each user can switch the server off for their account, or turn single tools off, under Settings → MCP server. Both are enforced on every tool call, not only in the tool list (see Turning the server or single tools off)
All tool responses use markdown instead of JSON for maximum LLM readability and token efficiency:
- List responses (list_jobs, list_listings) use markdown tables with a summary line and pagination footer
- Detail responses (get_job, get_listing) use markdown key-value lists
- Error responses include the tool name and error message
Example list response:
**Tool:** list_listings | **Status:** OK
Found **85** listing(s). Showing page 1 of 2 (50 on this page). More pages available - use page=2 to continue.
| ID | Title | Address | Price | Size | Provider | Active | Created | Job |
|----|-------|---------|-------|------|----------|--------|---------|-----|
| abc123 | Nice flat | Berlin | 1200 | 70 | immoscout | yes | 2026-02-25 10:30:00 | My Search |
| ... | ... | ... | ... | ... | ... | ... | ... | ... |
Use **get_listing** with an ID for full details (description, link, image).
**Page:** 1/2 | **Has more:** yes
Example detail response:
**Tool:** get_listing | **Status:** OK
### Listing: Nice flat
- **ID:** abc123
- **Title:** Nice flat
- **Address:** Berlin
- **Price:** 1200
- **Size:** 70
- **Provider:** immoscout
- **Link:** https://...
- **Active:** yes
- **Created:** 2026-02-25 10:30:00
Markdown is used because it is significantly more token-efficient than JSON (~40-60% fewer tokens for tabular data) and natively understood by all LLMs.
┌─────────────────┐ stdio ┌──────────────┐
│ Local LLM │◄──────────────►│ mcp/stdio.js│
│ (LM Studio, │ │ (transport) │
│ Claude, etc.) │ │ │
└─────────────────┘ └──────┬───────┘
│
┌─────────────────┐ Streamable HTTP ┌────┴────────┐
│ Remote LLM │◄───────────────►│ /api/mcp │
│ │ (Bearer token) │ (transport) │
└─────────────────┘ └──────┬───────┘
│
┌──────────┴──────────┐
│ mcpAuthentication │
│ (token validation, │
│ access control) │
└──────────┬──────────┘
│
┌────────┴────────┐
│ mcpAdapter.js │
│ (tool routing │
│ + data fetch) │
└────────┬────────┘
│
┌────────┴────────┐
│ mcpNormalizer.js│
│ (markdown │
│ formatting) │
└────────┬────────┘
│
┌──────┴───────┐
│ Fredy DB │
│ (SQLite) │
└──────────────┘