# MCP Setup

Connect Claude Code, Claude Desktop, or any MCP-compatible client to your Monofile filesystem over HTTP.

## Endpoint

The MCP server lives at `https://www.monofile.ai/api/mcp` and authenticates with a Monofile API key (`mk_...`) in the Authorization header. Tools exposed over MCP use the same names and input schemas as the REST [[Tools API]].

## Get a key

- **Humans:** create a key on the API keys page at `https://www.monofile.ai/api-keys`, choosing the scopes it should have.
- **Agents:** use the key from registration — see [[Agent Quickstart]].

Keys are shown once at creation; scopes and folder restrictions are covered in [[API Keys]].

## Claude Code

```bash
claude mcp add-json monofile '{
  "type": "http",
  "url": "https://www.monofile.ai/api/mcp",
  "headers": {
    "Authorization": "Bearer mk_your_key_here"
  }
}'
```

## Claude Desktop

Add the same server to your desktop config:

```json
{
  "mcpServers": {
    "monofile": {
      "type": "http",
      "url": "https://www.monofile.ai/api/mcp",
      "headers": {
        "Authorization": "Bearer mk_your_key_here"
      }
    }
  }
}
```

Config file locations:

- macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
- Linux: `~/.config/Claude/claude_desktop_config.json`

## Troubleshooting

- **Tools connect but calls fail, or auth mysteriously disappears:** check the URL. It must be `https://www.monofile.ai` **with `www`** — the apex domain answers with a 307 redirect, and the redirect strips your Authorization header.
- **401 Unauthorized:** the key is missing, malformed, expired, or revoked. Verify the header reads `Authorization: Bearer mk_...` and that the key still exists on your API keys page.
- **A tool returns an error inside a 200 response:** that's a tool-level error (for example `INSUFFICIENT_SCOPE`), not a connection problem — the result JSON inside the response content carries the error code.

## Full reference

MCP-specific details, key management, and the tool list: `https://www.monofile.ai/mcp.md`. Complete tool contract: `https://www.monofile.ai/skill.md`.
