# Claude Desktop Configuration

This file shows how to configure the PDF MCP Server for use with Claude Desktop.

## Configuration File Location

### macOS
```
~/Library/Application Support/Claude/claude_desktop_config.json
```

### Windows
```
%APPDATA%\Claude\claude_desktop_config.json
```

### Linux
```
~/.config/Claude/claude_desktop_config.json
```

## Configuration Content

Add the following to your `claude_desktop_config.json` file:

```json
{
  "mcpServers": {
    "pdf-operations": {
      "command": "node",
      "args": [
        "/absolute/path/to/pdf-mcp-server/dist/index.js"
      ],
      "env": {}
    }
  }
}
```

## Important Notes

1. **Replace the path**: Change `/absolute/path/to/pdf-mcp-server` to the actual absolute path where you installed this project.

2. **Get absolute path**: To find the absolute path, run this in the project directory:
   ```bash
   pwd
   ```
   Then append `/dist/index.js` to the result.

3. **Example for macOS**:
   ```json
   {
     "mcpServers": {
       "pdf-operations": {
         "command": "node",
         "args": [
           "/Users/yourname/Documents/pdf-mcp-server/dist/index.js"
         ],
         "env": {}
       }
     }
   }
   ```

4. **Example for Windows**:
   ```json
   {
     "mcpServers": {
       "pdf-operations": {
         "command": "node",
         "args": [
           "C:\\Users\\yourname\\Documents\\pdf-mcp-server\\dist\\index.js"
         ],
         "env": {}
       }
     }
   }
   ```

## Multiple MCP Servers

If you already have other MCP servers configured, add the `pdf-operations` entry to the existing `mcpServers` object:

```json
{
  "mcpServers": {
    "existing-server": {
      "command": "...",
      "args": ["..."]
    },
    "pdf-operations": {
      "command": "node",
      "args": [
        "/absolute/path/to/pdf-mcp-server/dist/index.js"
      ],
      "env": {}
    }
  }
}
```

## Verification

After adding the configuration:

1. **Save the file**
2. **Restart Claude Desktop completely** (quit and reopen)
3. **Start a new conversation**
4. **Test with a PDF file**:
   ```
   How many pages are in /path/to/test.pdf?
   ```

If configured correctly, Claude will use the `count-pdf-pages` tool to answer.

## Troubleshooting

### Server not appearing

- **Check the path**: Ensure it's absolute and points to `dist/index.js`
- **Rebuild the project**: Run `npm run build` in the project directory
- **Check Node.js**: Ensure Node.js 18+ is installed: `node --version`
- **Check permissions**: Ensure the file is executable
- **View logs**: Open Claude Desktop Developer Tools to see error messages

### Tool calls failing

- **Check file paths**: Use absolute paths to PDF files
- **Check file permissions**: Ensure PDFs are readable
- **Check file size**: Default limit is 50MB
- **Check PDF format**: File must be a valid PDF (not password-protected)

## Advanced Configuration

### Custom environment variables

You can add environment variables if needed:

```json
{
  "mcpServers": {
    "pdf-operations": {
      "command": "node",
      "args": [
        "/absolute/path/to/pdf-mcp-server/dist/index.js"
      ],
      "env": {
        "NODE_ENV": "production",
        "DEBUG": "false"
      }
    }
  }
}
```

### Using npm/npx

Alternatively, you can run via npm:

```json
{
  "mcpServers": {
    "pdf-operations": {
      "command": "npm",
      "args": [
        "start",
        "--prefix",
        "/absolute/path/to/pdf-mcp-server"
      ],
      "env": {}
    }
  }
}
```

---

**Need help?** Check the main [README.md](README.md) for more information.
