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

# Cline

> Connect CodeAlive with Cline autonomous coding agent

## Overview

Integrate CodeAlive with Cline - the open-source AI coding agent used by millions of developers. Cline can autonomously create and extend its capabilities through MCP tools. With 30k+ GitHub stars, Cline offers complete transparency and zero vendor lock-in.

> [!TIP]
>
> **Quick install:** Run `npx @codealive/installer` to automatically configure CodeAlive for Cline.
> See the [Installation Guide](https://docs.codealive.ai/installation.md) for details.

## Prerequisites

* [Cline](https://marketplace.visualstudio.com/items?itemName=saoudrizwan.claude-dev) extension installed in VS Code
* CodeAlive account with API key ([Sign up here](https://app.codealive.ai))
* Indexed repositories in your CodeAlive dashboard

## Connecting to CodeAlive

**1. Open Cline Settings**

Access Cline's MCP configuration:

1. Click on the Cline icon in the VS Code sidebar
2. Click the settings gear icon
3. Navigate to "MCP Servers" section

Or use Command Palette:

* Cmd/Ctrl+Shift+P → "Cline: Configure MCP Servers"

**2. Add CodeAlive MCP**

Configure CodeAlive as an MCP server:

```json theme={null}
{
  "mcpServers": {
    "codealive": {
      "url": "https://mcp.codealive.ai/api",
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY_HERE"
      }
    }
  }
}
```

> [!NOTE]
>
> **Cline's Unique Feature:** Ask Cline to "add a tool" and it will create and install custom MCP servers tailored to your workflow - no manual configuration needed!

> [!WARNING]
>
> Replace `YOUR_API_KEY_HERE` with your actual CodeAlive API key

**3. Enable MCP in Cline**

Ensure MCP is enabled in Cline settings:

```json theme={null}
{
  "cline.enableMCP": true,
  "cline.mcpAutoConnect": true
}
```

**4. Restart VS Code**

Restart VS Code to ensure all changes take effect

**5. Verify Integration**

Test by asking Cline:

* "Use CodeAlive to show me all available repositories"
* "Search the codebase for authentication logic"
* "Analyze the project architecture using CodeAlive"

## Configuration Options

### Advanced Settings

```json theme={null}
{
  "mcpServers": {
    "codealive": {
      "url": "https://mcp.codealive.ai/api",
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY_HERE"
      }
    }
  }
}
```

### Docker Deployment

Run CodeAlive locally for better performance:

```json theme={null}
{
  "mcpServers": {
    "codealive": {
      "command": "docker",
      "args": [
        "run", "--rm", "-i",
        "-e", "CODEALIVE_API_KEY=YOUR_API_KEY_HERE",
        "ghcr.io/codealive-ai/codealive-mcp:main"
      ]
    }
  }
}
```

## Usage Patterns

> [tab] Autonomous Tasks
>
> Let Cline use CodeAlive automatically:
>
> ```
> "Refactor the user service to match our microservices pattern"
>
> Cline will:
> 1. Use CodeAlive to find existing patterns
> 2. Analyze the current implementation
> 3. Generate refactored code
> 4. Update related files
> ```

> [tab] Guided Development
>
> Direct Cline to use CodeAlive:
>
> ```
> "Use CodeAlive to find all payment processing code,
> then add retry logic following our existing patterns"
> ```

> [tab] Code Review
>
> Have Cline review code with context:
>
> ```
> "Use CodeAlive to review this PR for consistency
> with our codebase conventions"
> ```

## Cline Rules Configuration

Create `.cline/rules.md` in your project root:

```markdown theme={null}
# CodeAlive Integration Rules

## Always Use CodeAlive For:
- Finding existing implementations before writing new code
- Understanding project architecture and patterns
- Locating all files that might be affected by changes
- Searching for similar code patterns

## Code Generation Guidelines:
- Match the style found via CodeAlive search
- Follow conventions discovered in the codebase
- Reuse existing utilities and helpers
- Maintain consistency with existing patterns

## Before Making Changes:
1. Search with CodeAlive for related code
2. Analyze existing patterns
3. Consider impact on other parts of the system
4. Follow established conventions
```

## Advanced Features

### Task Planning

Configure Cline to use CodeAlive for planning:

```json theme={null}
{
  "cline.planning": {
    "enabled": true,
    "useCodeAlive": true,
    "steps": [
      "Search for similar implementations",
      "Analyze existing patterns",
      "Plan changes based on findings",
      "Execute implementation"
    ]
  }
}
```

### Custom Commands

Create Cline commands that leverage CodeAlive:

```json theme={null}
{
  "cline.customCommands": [
    {
      "name": "Analyze Architecture",
      "command": "Use CodeAlive to analyze and explain the project architecture"
    },
    {
      "name": "Find Security Issues",
      "command": "Use CodeAlive to search for potential security vulnerabilities"
    },
    {
      "name": "Generate Tests",
      "command": "Use CodeAlive to find the code, then generate comprehensive tests"
    }
  ]
}
```

### Model Configuration

Optimize Cline's model usage with CodeAlive:

```json theme={null}
{
  "cline.apiProvider": "anthropic",
  "cline.apiModel": "claude-3-opus-20240229",
  "cline.contextStrategy": "codealive-first",
  "cline.maxContextTokens": 100000
}
```

## Workspace Settings

### Project-Specific Configuration

`.vscode/settings.json`:

```json theme={null}
{
  "mcpServers": {
    "codealive": {
      "type": "http",
      "url": "https://mcp.codealive.ai/api",
      "headers": {
        "Authorization": "Bearer ${env:CODEALIVE_API_KEY}"
      },
      "repositories": ["backend", "frontend", "shared"]
    }
  },
  "cline.autoDetectTasks": true
}
```

### Team Collaboration

Share configuration without exposing API keys:

1. Add to `.vscode/settings.json`:

```json theme={null}
{
  "cline.mcpServers.codealive.headers.Authorization": "Bearer ${env:CODEALIVE_API_KEY}"
}
```

2. Team members set environment variable:

```bash theme={null}
export CODEALIVE_API_KEY="their_api_key"
```

## Performance Optimization

> [accordion] Caching
>
> Enable caching for repeated queries:
>
> ```json theme={null}
> {
>   "cline.cache": {
>     "enabled": true,
>     "codealiveQueries": true,
>     "ttl": 3600
>   }
> }
> ```

> [accordion] Context Management
>
> Optimize context window usage:
>
> ```json theme={null}
> {
>   "cline.contextOptimization": {
>     "useCodeAliveFirst": true,
>     "summarizeContext": true,
>     "maxFilesPerRequest": 10
>   }
> }
> ```

> [accordion] Parallel Processing
>
> Enable parallel CodeAlive queries:
>
> ```json theme={null}
> {
>   "cline.parallel": {
>     "enabled": true,
>     "maxConcurrent": 3
>   }
> }
> ```

## Troubleshooting

> [accordion] Cline not detecting CodeAlive
>
> **Solutions:**
>
> 1. Check MCP is enabled in Cline settings
> 2. Verify MCP server configuration
> 3. Restart VS Code completely
> 4. Check Cline output panel for errors

> [accordion] Slow autonomous operations
>
> **Solutions:**
>
> 1. Use Docker for local deployment
> 2. Limit repository scope in searches
> 3. Enable caching
> 4. Optimize context window usage

> [accordion] Authentication errors
>
> **Solutions:**
>
> 1. Regenerate API key
> 2. Check Bearer token format
> 3. Verify environment variables
> 4. Test connection manually

> [accordion] Context window exceeded
>
> **Solutions:**
>
> 1. Enable context optimization
> 2. Use CodeAlive for large file searches
> 3. Limit files per request
> 4. Use summarization features

> [!TIP]
>
> For more solutions, see the [Troubleshooting Guide](https://docs.codealive.ai/troubleshooting.md).

## Best Practices

> [card] Let Cline Plan
>
> Allow Cline to use CodeAlive for task planning

> [card] Review Changes
>
> Always review Cline's changes in context

> [card] Iterative Development
>
> Use CodeAlive to verify changes match patterns

> [card] Safety First
>
> Test Cline's changes in development first

## Tips for Effective Use

### Prompting Strategies

**Good Prompts:**

```
"Use CodeAlive to find our API endpoint patterns,
then create a new user profile endpoint"

"Search for our error handling patterns with CodeAlive,
then improve error handling in the payment service"
```

**Avoid:**

```
"Create a new endpoint" (too vague, won't use context)
"Fix the bug" (doesn't leverage CodeAlive)
```

### Task Delegation

Let Cline handle complex multi-file operations:

```
"Use CodeAlive to find all references to the old User model,
then update them to use the new UserProfile model"
```

## Related Resources

* [MCP Overview](https://docs.codealive.ai/integrations/mcp.md)
* [Cline Documentation](https://github.com/saoudrizwan/claude-dev)
* [Self-Hosting Guide](https://docs.codealive.ai/integrations/mcp/self-hosting.md)
* [VS Code Integration](https://docs.codealive.ai/integrations/mcp/vscode.md)

## Instruct Your Agent

Connecting CodeAlive makes its tools available, but the agent may still default to its built-in search. For reliable results, add a short instruction in the agent's native format telling it to prefer `semantic_search` and `grep_search` when exploring indexed code. See [Instructing Coding Agents](https://docs.codealive.ai/guides/instructing-agents.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.