> ## 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.

# ChatGPT

> Connect CodeAlive with ChatGPT using a custom MCP app

## Overview

Connect ChatGPT to CodeAlive's remote MCP server with browser OAuth. The older Custom GPT Actions integration remains available as an API-key fallback.

## Prerequisites

* ChatGPT Business, Enterprise, or Edu workspace with custom MCP apps enabled
* CodeAlive account ([Sign up here](https://app.codealive.ai))
* Indexed repositories in your CodeAlive dashboard

## Integration Methods

<Tabs>
  <Tab title="Custom MCP app (Recommended)">
    ## Create a CodeAlive app in ChatGPT

    <Steps>
      <Step title="Enable developer mode">
        A workspace admin enables **Developer mode / Create custom MCP connectors** under **Workspace Settings → Permissions & Roles → Connected Data**. Enterprise and Edu workspaces can grant this through RBAC.
      </Step>

      <Step title="Create the app">
        In **Settings → Apps → Create**, enter the CodeAlive MCP endpoint:

        ```text theme={null}
        https://mcp.codealive.ai/api
        ```

        Choose OAuth when ChatGPT asks for the authentication mechanism.
      </Step>

      <Step title="Authenticate and scan tools">
        Click **Scan Tools**, complete the CodeAlive browser sign-in and consent screen, then wait for ChatGPT to finish scanning. The app exposes read-only CodeAlive tools such as `get_data_sources`, `semantic_search`, `grep_search`, and `read_file`.
      </Step>

      <Step title="Test and publish">
        Select the draft app in a new chat and ask, “What CodeAlive repositories are available?” Workspace admins can publish the tested app and control access through ChatGPT's app settings.
      </Step>
    </Steps>

    <Info>Each user authorizes their own CodeAlive access. Do not configure a shared API key for the MCP app.</Info>
  </Tab>

  <Tab title="Custom GPT Action (API key)">
    ## Create a Custom GPT with CodeAlive

    Custom GPTs allow you to create a specialized version of ChatGPT that connects to CodeAlive.

    <Steps>
      <Step title="Create a New GPT">
        1. Go to [chat.openai.com](https://chat.openai.com)
        2. Click on "Explore GPTs" in the sidebar
        3. Click "Create" to build a new GPT
      </Step>

      <Step title="Configure GPT Instructions">
        Set up your GPT with these instructions:

        ```
        You are a code assistant with access to CodeAlive, which provides
        semantic search and analysis of entire codebases. You can:

        1. Search for code implementations across repositories
        2. Understand project architecture and patterns
        3. Find related code and dependencies
        4. Generate code following existing patterns

        Always use CodeAlive to:
        - Search for existing implementations before writing new code
        - Understand the codebase context
        - Follow established patterns and conventions
        ```
      </Step>

      <Step title="Add CodeAlive Action">
        1. Click on "Configure" → "Add Actions"
        2. Import the CodeAlive OpenAPI schema:

        ```json theme={null}
        {
          "openapi": "3.1.1",
          "info": {
            "title": "CodeAlive Tool API",
            "version": "3.0.0"
          },
          "servers": [
            {
              "url": "https://app.codealive.ai"
            }
          ],
          "paths": {
            "/api/tools/get_data_sources": {
              "post": {
                "operationId": "ToolApiGetDataSources",
                "summary": "List available repositories",
                "requestBody": {
                  "required": true,
                  "content": {
                    "application/json": {
                      "schema": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "query": {"type": "string"},
                          "ready_only": {"type": "boolean"},
                          "output_format": {"type": "string", "enum": ["json", "agentic"]}
                        }
                      }
                    }
                  }
                },
                "security": [{"bearerAuth": []}]
              }
            },
            "/api/tools/semantic_search": {
              "post": {
                "operationId": "ToolApiSemanticSearch",
                "summary": "Search code semantically",
                "requestBody": {
                  "required": true,
                  "content": {
                    "application/json": {
                      "schema": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": ["question"],
                        "properties": {
                          "question": {"type": "string"},
                          "data_sources": {
                            "type": "array",
                            "items": {"type": "string"}
                          },
                          "paths": {"type": "array", "items": {"type": "string"}},
                          "extensions": {"type": "array", "items": {"type": "string"}},
                          "max_results": {"type": "integer"},
                          "output_format": {"type": "string", "enum": ["json", "agentic"]}
                        }
                      }
                    }
                  }
                },
                "security": [{"bearerAuth": []}]
              }
            },
            "/api/tools/chat": {
              "post": {
                "operationId": "ToolApiChat",
                "summary": "Ask a stateless question about code",
                "requestBody": {
                  "required": true,
                  "content": {
                    "application/json": {
                      "schema": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": ["question"],
                        "properties": {
                          "question": {"type": "string"},
                          "data_sources": {
                            "type": "array",
                            "items": {"type": "string"}
                          },
                          "output_format": {"type": "string", "enum": ["json", "agentic"]}
                        }
                      }
                    }
                  }
                },
                "security": [{"bearerAuth": []}]
              }
            }
          },
          "components": {
            "securitySchemes": {
              "bearerAuth": {
                "type": "http",
                "scheme": "bearer"
              }
            }
          }
        }
        ```
      </Step>

      <Step title="Add Authentication">
        1. In the Actions configuration, click "Authentication"
        2. Select "API Key"
        3. Auth Type: "Bearer"
        4. Add your CodeAlive API key
      </Step>

      <Step title="Test Your GPT">
        Test with queries like:

        * "What repositories are available in CodeAlive?"
        * "Search for authentication implementations"
        * "Explain the user service architecture"
      </Step>
    </Steps>
  </Tab>

  <Tab title="Direct API Calls">
    ## Use CodeAlive API Directly in ChatGPT

    You can also manually provide API responses to ChatGPT for analysis.

    <Steps>
      <Step title="Make API Request">
        Use curl or any HTTP client to query CodeAlive:

        ```bash theme={null}
        curl -X POST https://app.codealive.ai/api/tools/semantic_search \
          -H "Authorization: Bearer YOUR_API_KEY" \
          -H "Content-Type: application/json" \
          -d '{"question": "Where is authentication implemented?", "data_sources": ["your-repo-name"], "output_format": "agentic"}'
        ```
      </Step>

      <Step title="Share with ChatGPT">
        Copy the API response and paste it into ChatGPT with context:

        ```
        Here's the code search result from my codebase.
        Please analyze this authentication implementation:

        [Paste API response]
        ```
      </Step>
    </Steps>
  </Tab>
</Tabs>

## Usage Examples

### Code Search

```
User: "Search my codebase for payment processing logic"

ChatGPT: [Uses CodeAlive action to search]
        Found payment processing in:
        - /services/payment/processor.js
        - /api/routes/checkout.js
        - /lib/payment-gateway.js
```

### Architecture Analysis

```
User: "Explain how the authentication flow works"

ChatGPT: [Searches for auth code via CodeAlive]
        [Analyzes the flow across multiple files]
        [Provides detailed explanation with code references]
```

### Code Generation

```
User: "Create a new API endpoint following our patterns"

ChatGPT: [Searches for existing endpoints]
        [Identifies patterns and conventions]
        [Generates code matching your style]
```

## Advanced Configuration

### Custom GPT Capabilities

Configure your GPT with specific capabilities:

```json theme={null}
{
  "capabilities": {
    "web_browsing": false,
    "dall_e_image_generation": false,
    "code_interpreter": true
  },
  "actions": ["codealive"],
  "conversation_starters": [
    "Search for implementations of...",
    "Explain the architecture of...",
    "Find all references to...",
    "Generate code similar to..."
  ]
}
```

### Rate Limiting

Be aware of rate limits:

* ChatGPT has limits on Actions calls per conversation
* CodeAlive API has rate limits based on your plan
* Use specific queries to minimize API calls

### Privacy Settings

For team/enterprise accounts:

1. Control data sharing in GPT settings
2. Set action permissions (private, team, public)
3. Configure audit logging if required

## Sharing Your GPT

### Make it Public

1. Go to GPT settings
2. Click "Publish" → "Public"
3. Share the GPT link with others
4. Users will need their own CodeAlive API key

### Team Sharing

For ChatGPT Team/Enterprise:

1. Set visibility to "Anyone at \[Your Organization]"
2. Team members can use shared authentication
3. Centrally manage API keys

## Best Practices

<CardGroup cols={2}>
  <Card title="Specific Queries" icon="magnifying-glass">
    Use precise search terms to get relevant results
  </Card>

  <Card title="Context Windows" icon="window">
    Be mindful of token limits when searching large codebases
  </Card>

  <Card title="Caching" icon="database">
    Reuse search results within the same conversation
  </Card>

  <Card title="Security" icon="shield">
    Never share API keys in conversation
  </Card>
</CardGroup>

## Troubleshooting

<AccordionGroup>
  <Accordion title="Action fails with authentication error">
    **Solutions:**

    1. Verify API key is correct
    2. Check key hasn't expired
    3. Ensure Bearer prefix is included
    4. Regenerate key if needed
  </Accordion>

  <Accordion title="No results from searches">
    **Solutions:**

    1. Verify repositories are indexed
    2. Check search query syntax
    3. Test API directly with curl
    4. Check rate limits
  </Accordion>

  <Accordion title="GPT not using CodeAlive action">
    **Solutions:**

    1. Explicitly ask to "use CodeAlive"
    2. Check action is enabled
    3. Verify OpenAPI schema is valid
    4. Review GPT instructions
  </Accordion>

  <Accordion title="Rate limit exceeded">
    **Solutions:**

    1. Reduce frequency of searches
    2. Use more specific queries
    3. Upgrade CodeAlive plan
    4. Cache results when possible
  </Accordion>
</AccordionGroup>

<Tip>
  For more solutions, see the [Troubleshooting Guide](/troubleshooting).
</Tip>

## Limitations

<Warning>
  **Current Limitations:**

  * ChatGPT can't maintain persistent connections
  * Actions have timeout limits (30 seconds)
  * Token limits may truncate large responses
  * No real-time code updates
</Warning>

## Alternatives

If ChatGPT doesn't meet your needs, consider:

<CardGroup cols={2}>
  <Card title="Claude Code" icon="robot" href="/integrations/mcp/claude-code">
    Native MCP support with real-time updates
  </Card>

  <Card title="Cursor" icon="code" href="/integrations/mcp/cursor">
    IDE-integrated AI with MCP
  </Card>

  <Card title="Continue" icon="forward-fast" href="/integrations/mcp/continue">
    Open-source alternative with MCP
  </Card>

  <Card title="API Direct" icon="code" href="/api-reference/toolapi/list-visible-data-sources">
    Build custom integration
  </Card>
</CardGroup>

## Related Resources

* [OpenAI GPTs Documentation](https://help.openai.com/en/articles/8554397-gpts)
* [ChatGPT Actions Guide](https://platform.openai.com/docs/actions)
* [CodeAlive API Reference](/api-reference/toolapi/list-visible-data-sources)
* [MCP Overview](/integrations/mcp)

## 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).
