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

# Cursor

> Configure Cursor to use ShadowGit for perfect AI memory

## Prerequisites

* Cursor installed ([Get Cursor](https://cursor.com))
* Node.js 18+ installed
* ShadowGit desktop app running with tracked repositories

## Quick Setup

1. **Install the MCP server**:
   ```bash theme={null}
   npm install -g shadowgit-mcp-server
   ```

2. **Open Cursor Settings**:
   * Press `Cmd + Shift + P` (Mac) or `Ctrl + Shift + P` (Windows/Linux)
   * Search for `Cursor Settings` in the search bar
   * Click on `Tools and Integrations`
   * Under `MCP Tools`, click on `Add Custom MCP`

3. **Add ShadowGit configuration**:
   ```json theme={null}
   {
     "mcpServers": {
       "shadowgit": {
         "command": "shadowgit-mcp-server"
       }
     }
   }
   ```

4. **Restart Cursor** to activate the MCP server

## Verify Installation

In Cursor's AI chat, type:

```
What ShadowGit repositories are available?
```

Cursor should list your tracked repositories. If not, see troubleshooting below.

## What Cursor can now do

### AI Session Intelligence

ShadowGit automatically tracks your coding sessions with Cursor, detecting when you're actively developing and maintaining context throughout your work. This gives Cursor deeper awareness of your coding patterns, recent changes, and development focus - making its suggestions more relevant and accurate.

### Instant debugging

```
Why is this function returning null? Check what changed in the last hour.
```

### Code archaeology

```
Find when this bug was introduced by checking the history of auth.ts
```

### Smart suggestions

```
Based on my recent changes, what's the best way to refactor this?
```

### Pattern recognition

```
Have I fixed similar issues before in this project?
```

## Using ShadowGit in Cursor

### In Chat (Cmd+K)

You can ask Cursor to analyze your code history:

```
@shadowgit show me recent changes to the login flow
```

```
@shadowgit when did the tests last pass?
```

```
@shadowgit what files changed together with api.ts?
```

### In Composer (Cmd+I)

When making larger changes, reference history:

```
Refactor this authentication flow. Check @shadowgit for what approaches 
I've tried before and avoid the patterns that didn't work.
```

### During debugging

Combine current code with history:

```
This error started appearing today. @shadowgit check what changed 
in the last 24 hours that could cause this.
```

## Advanced Configuration

### Custom installation path

If npm installed to a non-standard location:

```json theme={null}
{
  "mcpServers": {
    "shadowgit": {
      "command": "/usr/local/bin/shadowgit-mcp-server"
    }
  }
}
```

### With environment variables

```json theme={null}
{
  "mcpServers": {
    "shadowgit": {
      "command": "shadowgit-mcp-server",
      "env": {
        "NODE_ENV": "production"
      }
    }
  }
}
```

## Example Workflows

### Morning debugging session

1. **Check overnight changes**:
   ```
   @shadowgit what changed since yesterday evening?
   ```

2. **Find breaking changes**:
   ```
   @shadowgit when did the tests last pass? Show me the diff.
   ```

3. **Quick fix**:
   ```
   Based on @shadowgit history, revert just the breaking change
   ```

### Code review preparation

```
@shadowgit summarize all changes to the auth module this week
```

### Learning from history

```
@shadowgit show me all the different ways I've implemented this feature
```

## Troubleshooting

### Cursor doesn't see ShadowGit

1. **Confirm installation**:
   ```bash theme={null}
   which shadowgit-mcp-server
   ```

2. **Check Cursor logs**:
   * Help → Toggle Developer Tools
   * Check Console for MCP errors

3. **Restart Cursor completely**:
   * Quit Cursor (Cmd+Q / Alt+F4)
   * Start Cursor fresh

### "Command not found"

The MCP server isn't in PATH. Find it:

```bash theme={null}
npm list -g shadowgit-mcp-server --depth=0
```

Use the full path in settings:

```json theme={null}
"command": "/Users/you/.npm-global/bin/shadowgit-mcp-server"
```

### No repositories available

1. ShadowGit desktop app must be running
2. At least one repository must be tracked
3. Wait 3-5 minutes for first snapshots

### Permission denied

Grant Cursor full disk access (macOS):

1. System Preferences → Security & Privacy
2. Privacy → Full Disk Access
3. Add Cursor.app

## Best Practices

### 1. Context-aware queries

Instead of generic "show history", be specific:

```
@shadowgit show auth.ts changes that happened during failing tests
```

### 2. Time-box investigations

```
@shadowgit only show changes from the last 2 hours
```

### 3. Cross-file analysis

```
@shadowgit what other files usually change when I modify config.json?
```

### 4. Learn from patterns

```
@shadowgit how did I solve similar React rendering issues before?
```

## Security

* **Read-only access**: Can't modify your code or git history
* **Local processing**: Your code never leaves your machine
* **Safe operations**: Only non-destructive git commands allowed

## Tips & Tricks

### Quick history check

Create a Cursor shortcut for common queries:

* Settings → Keyboard Shortcuts
* Search for "AI Chat"
* Add custom binding for "@shadowgit log -10"

### Combine with Cursor's context

```
Looking at @file:src/api.ts and @shadowgit history, 
why might this endpoint be failing?
```

### Use for documentation

```
@shadowgit help me write docs by showing how this API evolved
```

## Next Steps

<CardGroup cols={2}>
  <Card title="Installation Guide" icon="download" href="/installation">
    General setup instructions
  </Card>

  <Card title="Claude Code Setup" icon="asterisk" href="/ai-tools/claude-code">
    Configure Claude Code with ShadowGit
  </Card>
</CardGroup>
