# Use Casafari from Databricks

> **Casafari is the AI agent-native real estate data intelligence platform.** The most complete property index in Europe: a deduplicated, cleaned property graph of residential and commercial property, for sale and for rent, in 16 countries. Every property is one record with its full price and market history. [How the property graph is built](/docs/property-graph).

Casafari's MCP servers work in **Databricks** as external MCP servers in Unity Gateway: your agents, AI Playground and Agent Bricks then call Casafari's tools with the rest of your data. Each product is its own server; all speak Streamable HTTP. A short section for **Snowflake Cortex Agents** is at the end.

| Server URL | Base path | What it answers |
|---|---|---|
| `https://platform.casafari.com/mcp/locations` | `/mcp/locations` | Location Lookup: place names to location ids, which the other products take. Free (0 tokens) |
| `https://platform.casafari.com/mcp/comparables` | `/mcp/comparables` | Comparables: comparable properties and a price estimate for a subject property |
| `https://platform.casafari.com/mcp/area-insights` | `/mcp/area-insights` | Area Insights: asking price series, distributions and heatmaps for an area |
| `https://platform.casafari.com/mcp/claro` | `/mcp/claro` | Claro AI: commercial premises in Spain and commercial plots in Germany, from a brief in plain words |

Coverage: Comparables, Area Insights and Location Lookup cover Andorra, Austria, Belgium, France, Germany, Greece, Italy, Luxembourg, Monaco, Poland, Portugal, San Marino, Spain and Switzerland; [Claro AI](/docs/claro) covers Spain and Germany. Every tool only reads data. Calls spend tokens from your Casafari organisation's plan ([Limits and usage windows](/docs/limits)); Location Lookup is free.

## Databricks: register a server in Unity Gateway

You need a Casafari platform API key (`cf_sk_...`) from the console at https://platform.casafari.com/console, and in Databricks the rights to create a connection and a service in a schema (`CREATE CONNECTION`, `USE CATALOG`, `USE SCHEMA`, `CREATE SERVICE`).

1. Store the key as a Databricks secret, so it never appears in SQL or notebooks.
2. Create an HTTP connection for one server. In SQL:

```sql
CREATE CONNECTION casafari_comparables TYPE HTTPOPTIONS (
  host 'https://platform.casafari.com',
  port '443',
  base_path '/mcp/comparables',
  bearer_token secret ('casafari', 'api-key')
);
```

   Or in the UI: **Catalog → Add → Create a connection**, connection type **HTTP**, auth type **Bearer token**.
3. Open **Unity Gateway → MCPs → + MCP → Connect an existing MCP server**. Choose a catalog and schema, name the MCP, select the connection and click **Create & load tools**. Choose the tools to expose and click **Create MCP Service**.
4. Repeat for each product you want, one connection per base path.

### Use it

- **AI Playground:** pick a model with tools enabled, then **Tools → + Add tool → MCP Servers → External MCP servers** and select the Casafari server. Ask, for example: "What is a 2-bedroom flat of 85 m² near Avenida da Liberdade, Lisbon worth? Use comparables within 1 km."
- **Your own agents:** reference the service by `<catalog>.<schema>.<service>`. Clients that need a URL use `https://<workspace-hostname>/ai-gateway/mcp-services/<catalog>.<schema>.<service>`; Databricks proxies the call and adds the key.

### Per-person sign-in

Databricks also offers the **Dynamic Client Registration** auth type, where each person signs in to Casafari on first use and calls spend their own organisation's tokens. Casafari's servers support registration, but this path is not yet confirmed from a Databricks workspace; until it is, use the bearer key above. The key belongs to one Casafari organisation, so every call through the connection spends that organisation's tokens: grant `USE CONNECTION` only to the people that should.

## Snowflake: Cortex Agents MCP connector

Snowflake connects Cortex Agents to remote MCP servers with OAuth only, so a platform API key cannot be used there; each person signs in to Casafari. An account admin creates the integration and the server:

```sql
CREATE API INTEGRATION casafari_comparables_int
  API_PROVIDER = external_mcp
  API_ALLOWED_PREFIXES = ('https://platform.casafari.com/mcp/comparables')
  API_USER_AUTHENTICATION = (
    TYPE = OAUTH_DYNAMIC_CLIENT
    OAUTH_RESOURCE_URL = 'https://platform.casafari.com/mcp/comparables'
  )
  ENABLED = TRUE;

CREATE EXTERNAL MCP SERVER casafari_comparables
  WITH DISPLAY_NAME = 'Casafari Comparables'
  URL = 'https://platform.casafari.com/mcp/comparables'
  API_INTEGRATION = casafari_comparables_int;

ALTER AGENT my_agent ADD MCP_SERVER = 'my_db.my_schema.casafari_comparables';
```

Check the statement against [Snowflake's MCP connector documentation](https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-agents-mcp-connectors) for your account. If the registration step fails, write to platform@casafari.com: a fixed client for Snowflake can be set up.

## See also

- [Use Casafari from the OpenAI API and the Claude API](/docs/openai-and-claude-api): the same servers from a model provider's API
- [Connect an MCP client](/docs/connect): every other client
- [MCP authorization](/docs/authentication): the OAuth flow behind per-person sign-in
