# Cursor Integration Setup

This guide shows how to integrate `flash-tool-oss` with Cursor so you can use "using oss" commands in chat.

## Prerequisites

1. **Install flash-tool-oss:**
   ```bash
   npm install flash-tool-oss
   ```

2. **Install Python dependencies:**
   ```bash
   pip install cerebras-cloud-sdk
   ```

## Setup MCP Server

### 1. Create MCP Configuration

Create a file called `mcp-config.json` in your home directory:

**On macOS/Linux:**
```bash
touch ~/.cursor/mcp-config.json
```

**On Windows:**
```bash
type nul > %USERPROFILE%\.cursor\mcp-config.json
```

### 2. Add MCP Configuration

Add this content to your `mcp-config.json`:

```json
{
  "mcpServers": {
    "flash-tool-oss": {
      "command": "node",
      "args": ["node_modules/flash-tool-oss/src/mcp-server.js"],
      "env": {}
    }
  }
}
```

### 3. Restart Cursor

Restart Cursor for the MCP configuration to take effect.

## Usage

Once set up, you can use "using oss" commands in Cursor chat:

### Examples:

1. **Code Generation:**
   ```
   using oss create a React component that displays a todo list
   ```

2. **Code Completion:**
   ```
   using oss complete this function: function sortArray
   ```

3. **Debugging Help:**
   ```
   using oss I'm getting a TypeError in my React app, how do I debug it?
   ```

4. **Code Review:**
   ```
   using oss review this code: function add(a, b) { return a + b; }
   ```

## How It Works

1. **User types "using oss"** in Cursor chat
2. **Cursor detects** the command and calls the MCP server
3. **MCP server** processes the prompt through Cerebras API
4. **Response is returned** to Cursor
5. **Cursor applies** the code suggestions automatically
6. **User can accept/reject** the suggestions

## Troubleshooting

### MCP Server Not Found
- Ensure `flash-tool-oss` is installed globally or in your project
- Check that the path in `mcp-config.json` is correct
- Verify Python and `cerebras-cloud-sdk` are installed

### API Errors
- Check your internet connection
- The tool uses a pre-configured API key - no setup required
- If you get rate limit errors, wait a moment and try again

### Cursor Not Responding
- Restart Cursor after adding MCP configuration
- Check Cursor's developer console for errors
- Ensure the MCP server is running correctly

## Advanced Configuration

### Custom Python Path
If you have a custom Python installation, update the MCP server:

```json
{
  "mcpServers": {
    "flash-tool-oss": {
      "command": "node",
      "args": ["node_modules/flash-tool-oss/src/mcp-server.js"],
      "env": {
        "PYTHON_PATH": "/path/to/your/python"
      }
    }
  }
}
```

### Multiple MCP Servers
You can run multiple MCP servers alongside flash-tool-oss:

```json
{
  "mcpServers": {
    "flash-tool-oss": {
      "command": "node",
      "args": ["node_modules/flash-tool-oss/src/mcp-server.js"],
      "env": {}
    },
    "other-server": {
      "command": "other-command",
      "args": ["other-args"],
      "env": {}
    }
  }
}
```

## Benefits

- ✅ **Seamless Integration** with Cursor chat
- ✅ **Automatic Code Application** - no copy/paste needed
- ✅ **Fast AI Responses** using Cerebras gpt-oss-120b
- ✅ **Zero Configuration** - works out of the box
- ✅ **Multi-language Support** for all programming languages 