# Installation Guide

Quick guide to install and configure MCP Memory TypeScript for single-user Claude Desktop usage.

## Prerequisites

- Node.js >= 18.0.0
- npm
- Claude Desktop installed
- Turso database account (https://turso.tech)
- OpenAI API key (https://platform.openai.com)

## Installation Steps

### 1. Clone and Setup

```bash
cd /Users/masa/Projects/managed/mcp-memory-ts

# Install dependencies
npm install

# Build the project
npm run build-full

# Link CLI globally
npm link
```

### 2. Initialize Configuration

Run the interactive setup wizard:

```bash
mcp-memory init
```

You'll be prompted for:
- **User email**: Your email (default: bob@matsuoka.com)
- **Turso URL**: Your Turso database URL (e.g., libsql://your-db.turso.io)
- **Turso token**: Your Turso auth token
- **OpenAI key**: Your OpenAI API key

The wizard will validate your credentials and save them to `~/.mcp-memory/config.json`.

### 3. Install to Claude Desktop

```bash
mcp-memory claude-desktop install
```

This command will:
- Read your configuration from `~/.mcp-memory/config.json`
- Update Claude Desktop config at `~/Library/Application Support/Claude/claude_desktop_config.json`
- Create a backup of existing config
- Configure the MCP server with your credentials

### 4. Restart Claude Desktop

Close and reopen Claude Desktop to activate the MCP server.

### 5. Verify Installation

```bash
mcp-memory claude-desktop status
```

You should see all green checkmarks:
```
✅ User configuration: Found
✅ MCP Memory Server: Installed in Claude Desktop
✅ Server file: Found
✅ Environment variables set
```

## Quick Test

Open Claude Desktop and try asking:
```
Can you add a memory about this conversation?
```

Claude should now have access to the MCP memory tools.

## Troubleshooting

### Build Issues

If the build fails:
```bash
npm run clean
npm install
npm run build-full
```

### Configuration Issues

To reconfigure:
```bash
mcp-memory init
mcp-memory claude-desktop update
```

### Server Not Working

1. Check status:
   ```bash
   mcp-memory claude-desktop status
   ```

2. Verify build:
   ```bash
   npm run build-full
   ```

3. Update configuration:
   ```bash
   mcp-memory claude-desktop update
   ```

4. Restart Claude Desktop

### View Configuration

To see your current config (without sensitive data):
```bash
mcp-memory config
```

## Uninstall

To remove from Claude Desktop (keeps user config):
```bash
mcp-memory claude-desktop uninstall
```

To completely remove:
```bash
mcp-memory claude-desktop uninstall
rm -rf ~/.mcp-memory
npm unlink -g mcp-memory-ts
```

## Development Mode

For development, you can run the MCP server directly:

```bash
npm run mcp-server
```

This uses `.env` or `.env.local` instead of `~/.mcp-memory/config.json`.

## File Locations

- **User config**: `~/.mcp-memory/config.json`
- **Claude Desktop config**: `~/Library/Application Support/Claude/claude_desktop_config.json`
- **Config backup**: `~/Library/Application Support/Claude/claude_desktop_config.json.backup`
- **Server binary**: `dist/simple-mcp-server.js`

## Next Steps

See [CLI-GUIDE.md](./CLI-GUIDE.md) for complete CLI documentation.

## Support

For issues:
1. Check `mcp-memory claude-desktop status`
2. Review Claude Desktop logs
3. Verify environment variables are set
4. Ensure Turso and OpenAI credentials are valid
