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

# MCP Setup

> Install and configure the SafeFetch MCP server for Claude Desktop.

## 1) Install and prepare

<CodeGroup>
  ```bash theme={null}
  git clone https://github.com/jayhickey/SafeFetch.git
  cd SafeFetch/packages/server
  npm install
  cp .env.example .env
  # edit .env — set DATABASE_URL and MCP_ACCOUNT_ID
  npm run migrate
  ```
</CodeGroup>

Required environment variables:

* `DATABASE_URL` — your database connection string
* `MCP_ACCOUNT_ID`

Optional:

* `PORT`
* `RATE_LIMIT_PER_SECOND`
* `DISPATCH_TIMEOUT_MS`

## 2) Claude Desktop config

Add a server entry to Claude Desktop config.

<CodeGroup>
  ```json macOS theme={null}
  {
    "mcpServers": {
      "safefetch": {
        "command": "npm",
        "args": ["run", "mcp"],
        "cwd": "/absolute/path/to/SafeFetch/packages/server",
        "env": {
          "DATABASE_URL": "<your-database-connection-url>",
          "MCP_ACCOUNT_ID": "acct_..."
        }
      }
    }
  }
  ```

  ```json direct-tsx theme={null}
  {
    "mcpServers": {
      "safefetch": {
        "command": "npx",
        "args": ["tsx", "src/mcp/server.ts"],
        "cwd": "/absolute/path/to/SafeFetch/packages/server",
        "env": {
          "DATABASE_URL": "<your-database-connection-url>",
          "MCP_ACCOUNT_ID": "acct_..."
        }
      }
    }
  }
  ```
</CodeGroup>

## 3) Test with Claude

Ask Claude to run a tool call, for example:

* "Send an action that POSTs `{\"ping\":true}` to `https://httpbin.org/post`."
* "Check action `act_...` and summarize result."

<Tip>
  If tool calls fail immediately, verify `MCP_ACCOUNT_ID` belongs to an existing account row and that the database connection is reachable.
</Tip>
