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

# Local Setup

> Deploy Cognee MCP server from source for development and customization

Build and run Cognee MCP from source to access advanced customization, multiple transport options, and the latest development features, including the current memory-oriented MCP tools.

## Advantages of Local Setup

* **Full Control**: Customize server configuration, add providers, and modify behavior
* **Latest Features**: Access development features before they reach Docker releases
* **Multiple Transports**: Choose stdio, SSE, or HTTP transport modes
* **Current Tool Surface**: Use `remember`, `recall`, `improve`, and `forget_memory` alongside compatibility tools
* **Development Ready**: Debug, modify, and contribute to the codebase

## Setup Steps

<Steps>
  <Step title="Clone Repository">
    ```bash theme={null}
    git clone https://github.com/topoteretes/cognee.git
    cd cognee
    ```
  </Step>

  <Step title="Create Environment File">
    Create a `.env` file with your configuration:

    ```bash theme={null}
    LLM_API_KEY="your-openai-api-key"
    ```
  </Step>

  <Step title="Install Dependencies">
    ```bash theme={null}
    # Install uv package manager
    brew install uv

    # Install project dependencies
    cd cognee-mcp
    uv sync --dev --all-extras --reinstall
    ```
  </Step>

  <Step title="Activate and Run">
    ```bash theme={null}
    # Run with default stdio transport
    uv run cognee-mcp
    ```
  </Step>
</Steps>

## Running in API Mode

To connect the MCP server to an existing Cognee backend instead of running standalone:

```bash theme={null}
# Start MCP in HTTP or SSE mode pointing to the backend
uv run cognee-mcp --transport http --api-url http://localhost:8080

# Optional: add an auth token if the backend requires it
uv run cognee-mcp --transport http --api-url http://localhost:8080 --api-token your_backend_token
```

When `--api-url` is provided, the MCP server acts as an interface to the centralized backend. This allows multiple MCP instances and clients to share the same knowledge graph.

You can also pass these as command-line arguments:

```bash theme={null}
uv run cognee-mcp --transport http --api-url http://localhost:8080 --api-token your_token
```

<Note>
  The source-run `uv run cognee-mcp` entrypoint reads `--api-url` and `--api-token` flags. The `API_URL` and `API_TOKEN` environment variables are used by the Docker entrypoint wrapper, not by the source runner directly.
</Note>

**Use cases:**

* Team collaboration with shared memory
* Multiple AI clients accessing consistent data
* Centralized knowledge graph management

## Further details

<AccordionGroup>
  <Accordion title="Transport Modes">
    Choose the transport mode based on your client requirements:

    <Tabs>
      <Tab title="stdio (default)">
        Default mode for most MCP clients. The client starts the server as a subprocess and communicates through standard input/output.

        ```bash theme={null}
        uv run cognee-mcp
        # or equivalently:
        uv run cognee-mcp --transport stdio
        ```

        Configure your MCP client to launch the server directly:

        ```json theme={null}
        {
          "mcpServers": {
            "cognee": {
              "command": "uv",
              "args": [
                "--directory", "/absolute/path/to/cognee-mcp",
                "run", "cognee-mcp"
              ]
            }
          }
        }
        ```

        Replace `/absolute/path/to/cognee-mcp` with the actual path to your cloned `cognee-mcp` directory.
      </Tab>

      <Tab title="HTTP">
        HTTP transport mode. The server starts on `http://127.0.0.1:8000` and exposes a Streamable HTTP endpoint at `/mcp`.

        ```bash theme={null}
        uv run cognee-mcp --transport http
        # Custom host/port:
        uv run cognee-mcp --transport http --host 0.0.0.0 --port 9000
        ```

        Configure your MCP client to connect to the HTTP endpoint:

        ```json theme={null}
        {
          "mcpServers": {
            "cognee": {
              "url": "http://localhost:8000/mcp"
            }
          }
        }
        ```

        Verify the server is running with the health check endpoint:

        ```bash theme={null}
        curl http://localhost:8000/health
        ```
      </Tab>

      <Tab title="SSE">
        Server-Sent Events transport mode. The server starts on `http://127.0.0.1:8000` and exposes an SSE endpoint at `/sse`.

        ```bash theme={null}
        uv run cognee-mcp --transport sse
        # Custom host/port:
        uv run cognee-mcp --transport sse --host 0.0.0.0 --port 9000
        ```

        Configure your MCP client to connect to the SSE endpoint:

        ```json theme={null}
        {
          "mcpServers": {
            "cognee": {
              "url": "http://localhost:8000/sse"
            }
          }
        }
        ```
      </Tab>
    </Tabs>

    <Tip>
      If you encounter errors on first run, reset your MCP configuration and restart.
    </Tip>
  </Accordion>

  <Accordion title="Server Arguments Reference">
    All available arguments for `uv run cognee-mcp`:

    | Argument          | Default     | Description                                                    |
    | ----------------- | ----------- | -------------------------------------------------------------- |
    | `--transport`     | `stdio`     | Transport protocol: `stdio`, `http`, or `sse`                  |
    | `--host`          | `127.0.0.1` | Host to bind the server to (HTTP/SSE only)                     |
    | `--port`          | `8000`      | Port to bind the server to (HTTP/SSE only)                     |
    | `--path`          | `/mcp`      | URL path for the HTTP endpoint                                 |
    | `--log-level`     | `info`      | Log verbosity: `debug`, `info`, `warning`, or `error`          |
    | `--no-migration`  | off         | Skip database migrations on startup                            |
    | `--api-url`       | —           | URL of a running Cognee backend (enables API mode)             |
    | `--api-token`     | —           | Auth token for the backend API (if required)                   |
    | `--serve-url`     | —           | Cognee Cloud or remote instance URL used with `cognee.serve()` |
    | `--serve-api-key` | —           | API key for the `--serve-url` instance                         |

    **Example with all options:**

    ```bash theme={null}
    uv run cognee-mcp \
      --transport http \
      --host 0.0.0.0 \
      --port 8000 \
      --api-url http://localhost:8080 \
      --api-token your_token
    ```
  </Accordion>
</AccordionGroup>

<Note>
  The preferred MCP workflow is to use `remember`, `recall`, `improve`, and `forget_memory`. The server also exposes legacy-compatible tools such as `cognify` and `search` when you need lower-level control.
</Note>

## Next Steps

After starting the server, configure your AI client to connect to it. See the [integrations](/cognee-mcp/integrations) section for client-specific setup instructions.

## Need Help?

<Card title="Join Our Community" icon="discord" href="https://discord.gg/m63hxKsp4p">
  Get support and connect with other developers using Cognee MCP.
</Card>
