﻿# Claude Desktop Configuration Template

This template shows how to configure KERNL MCP in your Claude Desktop configuration file.

## Location

**Windows:**
```
%APPDATA%\Claude\claude_desktop_config.json
```
Full path: `C:\Users\<YourName>\AppData\Roaming\Claude\claude_desktop_config.json`

**macOS:**
```
~/Library/Application Support/Claude/claude_desktop_config.json
```

**Linux:**
```
~/.config/Claude/claude_desktop_config.json
```

## Basic Configuration

```json
{
  "mcpServers": {
    "project-mind": {
      "command": "node",
      "args": [
        "D:/KERNL/kernl-mcp/dist/index.js"
      ]
    }
  }
}
```

## Configuration with Multiple MCP Servers

If you already have other MCP servers:

```json
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "C:/Projects"]
    },
    "project-mind": {
      "command": "node",
      "args": [
        "D:/KERNL/kernl-mcp/dist/index.js"
      ]
    },
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "<your-token>"
      }
    }
  }
}
```

## Configuration with Environment Variables

```json
{
  "mcpServers": {
    "project-mind": {
      "command": "node",
      "args": [
        "D:/KERNL/kernl-mcp/dist/index.js"
      ],
      "env": {
        "kernl_DB_PATH": "D:/KERNL/data/project-mind.db",
        "kernl_LOG_LEVEL": "info",
        "kernl_PROFILE": "false"
      }
    }
  }
}
```

## Important Notes

### Path Format
- ✅ Use forward slashes: `D:/KERNL/kernl-mcp/dist/index.js`
- ❌ Don't use backslashes: `D:\KERNL\kernl-mcp\dist\index.js`

### Absolute Paths
- ✅ Use absolute paths: `D:/KERNL/...`
- ❌ Don't use relative paths: `../kernl-mcp/...`

### JSON Syntax
- Ensure proper commas between entries
- No trailing commas before closing braces
- Proper quote usage (double quotes)

## Validation

You can validate your JSON configuration:

**Windows (PowerShell):**
```powershell
Get-Content "$env:APPDATA\Claude\claude_desktop_config.json" | ConvertFrom-Json
```

**macOS/Linux:**
```bash
cat ~/Library/Application\ Support/Claude/claude_desktop_config.json | jq .
```

**Node.js (any platform):**
```bash
node -e "console.log(JSON.parse(require('fs').readFileSync('path/to/config.json')))"
```

## Troubleshooting

### Invalid JSON
If Claude Desktop fails to start after configuration:

1. **Backup your config:**
   ```bash
   cp claude_desktop_config.json claude_desktop_config.json.backup
   ```

2. **Validate JSON syntax:**
   Use a JSON validator online or command line

3. **Common mistakes:**
   - Missing comma between server entries
   - Trailing comma before `}`
   - Backslashes in path (use forward slashes)
   - Missing quotes around strings

### Path Issues

If MCP server doesn't connect:

1. **Verify file exists:**
   ```bash
   ls "D:/KERNL/kernl-mcp/dist/index.js"
   ```

2. **Check Node.js works:**
   ```bash
   node "D:/KERNL/kernl-mcp/dist/index.js"
   ```

3. **Try absolute path:**
   Get absolute path: `node -e "console.log(require('path').resolve('./dist/index.js'))"`

## Quick Setup Script

Instead of manual configuration, you can use the automatic installer:

```bash
cd "D:/KERNL/kernl-mcp"
npm run install:claude
```

This will automatically:
- Locate your Claude Desktop config file
- Add KERNL MCP configuration
- Preserve existing MCP servers
- Validate JSON syntax

## After Configuration

1. **Restart Claude Desktop completely**
   - Quit from system tray/menu bar
   - Wait 5 seconds
   - Start Claude Desktop again

2. **Test connection**
   ```
   Use KERNL to check if we're connected
   ```

3. **Register your first project**
   ```
   Register a new project:
   - ID: "my-project"
   - Name: "My Project"  
   - Path: "C:/Projects/my-project"
   ```

## Full Integration Guide

For complete integration instructions, see:
- [Integration Guide](INTEGRATION.md)
- [Quick Start](../README.md#quick-start)
- [Troubleshooting](INTEGRATION.md#troubleshooting)
