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

# Cognee Cloud

> Connect a local @cognee/cognee-ts process to Cognee Cloud with the module-level serve and disconnect functions.

`serve` and `disconnect` are module-level functions (not instance methods)
because they operate on global cloud state.

```ts theme={null}
import { serve, disconnect } from '@cognee/cognee-ts';

// Direct mode (no Auth0 flow; headless-friendly)
const { serviceUrl } = await serve({ url: "http://localhost:8000", apiKey: "key" });
console.log("Connected to", serviceUrl);

// Cloud mode (Auth0 device-code flow — requires a TTY)
await serve();

// Tear down
await disconnect();
await disconnect({ wipeCredentials: true }); // also removes the local credential cache
```

For the hosted service itself, see the [Cognee Cloud](/cognee-cloud/overview)
documentation.
