> ## Documentation Index
> Fetch the complete documentation index at: https://docs.withfoundry.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Cursor setup

> Use Foundry from Cursor via the MCP server.

# Cursor setup

Foundry’s MCP server exposes Memory and Security tools inside Cursor. Once configured, the AI can read/write memory and run security scans from the IDE.

## Install the MCP server

The server is the npm package `@withfoundry/mcp-server`. Cursor loads it via its MCP settings.

## Configure Cursor

1. Open Cursor settings and go to **Features → MCP** (or edit the MCP config file directly).
2. Add a new server entry for Foundry.

**Config file location (typical):**

* macOS: `~/.cursor/mcp.json`
* Windows: `%USERPROFILE%\.cursor\mcp.json`

**Add this block:**

```json theme={null}
{
  "mcpServers": {
    "foundry": {
      "command": "npx",
      "args": ["-y", "@withfoundry/mcp-server"],
      "env": {
        "FOUNDRY_API_KEY": "key_your_api_key_here"
      }
    }
  }
}
```

Replace `key_your_api_key_here` with your real API key from the [Foundry dashboard](https://withfoundry.ai).

## Using a local API key (recommended)

Avoid hardcoding the key in the config. Use an env file or system env:

```json theme={null}
{
  "mcpServers": {
    "foundry": {
      "command": "npx",
      "args": ["-y", "@withfoundry/mcp-server"],
      "env": {
        "FOUNDRY_API_KEY": "${FOUNDRY_API_KEY}"
      }
    }
  }
}
```

Then set `FOUNDRY_API_KEY` in your shell or in Cursor’s environment. If your config doesn’t support `${...}`, set the variable in your profile (e.g. `~/.zshrc`) and restart Cursor so it inherits it.

## Verify

1. Restart Cursor (or reload the window).
2. Start a chat and check that Foundry tools are available (e.g. “foundry\_memory\_search”, “foundry\_memory\_write”).
3. Try: “Search my Foundry memory for authentication” or “Write to Foundry memory: we use Bearer API keys.”

## What you get

| Area     | Tools                                           |
| -------- | ----------------------------------------------- |
| Memory   | Write entries, search, get context for prompts. |
| Security | Start repo scan, get scan results.              |

Details: [Tools reference](/mcp/tools-reference).

Next: [Tools reference](/mcp/tools-reference) for parameters and behavior.
