Cursor set up

    Store Your MLS API Key in Cursor

    Where Cursor keeps secrets, how your project's server code reads the key, and how to check it never reaches the page.

    Part of the Cursor MLS API Integration guide · Last reviewed 2026-11-20

    Storing an MLS API key in Cursor secrets

    With Cursor, the key lives in two places. While you build, put it in a .env file at the project root and add .env to .gitignore, so it never reaches your Git repository. When the site goes live, put it in your host's secret settings. On Cloudflare Workers, for example, run npx wrangler secret put SAIGE_MLS_API_KEY, and the Worker reads it from its environment at run time.

    Key takeaways

    • Create .env with SAIGE_MLS_API_KEY and SAIGE_MLS_API_URL.
    • Add .env to .gitignore before your first commit.
    • Set the same names as host secrets for the live site.
    • Only server code reads them.

    Need the data feed for this? Saige is an approved MLS data vendor in BC. Send a request and our team will contact you.

    Where Cursor keeps secrets

    Cursor has no secret store of its own: the project files are yours. That makes .gitignore the important step. A key committed to GitHub stays in its history even after you delete the file.

    • Create a file named .env at the project root with SAIGE_MLS_API_KEY=your-key and SAIGE_MLS_API_URL=feed-address.
    • Add the line .env to .gitignore.
    • For the live site on Cloudflare Workers: npx wrangler secret put SAIGE_MLS_API_KEY, then the same for SAIGE_MLS_API_URL.
    • Create .cursor/rules/mls-feed.mdc with the rule shown on Cursor Prompt to Build a Real Estate Site With MLS Listings.

    Reading the key in your project's server code

    On Cloudflare Workers, secrets arrive in the env object passed to your handler. In Node frameworks they are in process.env. Either way, only the server module reads them.

    Cloudflare Worker reading the key
    export default {
      async fetch(request, env) {
        const res = await fetch(
          `${env.SAIGE_MLS_API_URL}/Property?$filter=StandardStatus eq 'Active'&$top=24`,
          { headers: { Authorization: `Bearer ${env.SAIGE_MLS_API_KEY}` } }
        );
        return new Response(await res.text(), {
          headers: { "Content-Type": "application/json" },
        });
      },
    };

    Check before you publish

    Open the published Cursor site, view the page source, and search for the first characters of your key. It must not be there. Then use the search page with the browser's network panel open: requests should go to your own server code, not straight to the feed address. The full check list is at Keep Your MLS API Key Secret on an AI-Built Site.

    Frequently asked questions

    I committed the key by mistake. What now?

    Contact our team so the key can be replaced. Removing the file does not remove it from Git history.

    Does Cursor upload my .env file?

    Cursor's docs say files listed in a .cursorignore file at the project root are blocked from features such as Agent, and suggest it for secrets. The same docs say terminal and MCP tools used by Agent cannot be blocked this way, so keep the real key out of any command you ask the agent to run.

    Related pages in this guide

    Sources

    Every claim on this page that could be checked against a primary source is linked below. Where something is not publicly documented by a vendor, the page says so rather than filling the gap with an estimate.

    MLS API for BC

    Put live MLS listings on the site you are building

    Saige is an approved MLS data vendor for Greater Vancouver REALTORS, Fraser Valley Real Estate Board, Chilliwack and District Real Estate Board and BC Northern Real Estate Board. Send a request and our team will contact you to check what your board allows and how to connect your builder.

    Call 604.401.4849