Skip to main content

Connecting MCP to Cognee Cloud

The Cognee MCP server can connect to your Cognee Cloud tenant using the --api-url and --api-token flags, with the API Base URL and API key from your API Keys page. This lets any MCP-compatible client (Claude Desktop, Cursor, VS Code Copilot) work with your cloud-hosted knowledge graph.

How API mode connects to a backend

The MCP server’s --api-url / --api-token options put it in API mode: instead of running pipelines locally, the MCP tools send their requests to the Cognee backend at that URL. API mode works with both self-hosted backends and Cognee Cloud tenants:
  • Self-hosted backends authenticate with Authorization: Bearer <token>
  • Cognee Cloud tenant URLs are detected automatically and authenticate with the X-Api-Key header
The --serve-url / --serve-api-key flags are a different mechanism: they call cognee.serve() to route SDK operations, and they do not configure the API client the MCP tools use — so a Cloud connection configured only with --serve-url leaves some tools working against local storage. For Cloud connections, use --api-url / --api-token.

End-to-end walkthrough

1

Get your API credentials

Open the API Keys page in the Cognee Cloud console. Copy:
  • API Base URL — looks like https://your-tenant.aws.cognee.ai
  • API Key — a long token used to authenticate requests
2

Start the MCP server

Pass your credentials via CLI flags:
The server is ready when you see output like:
3

Add Cognee to your MCP client

Add the server to your client’s MCP configuration. The config file location varies by client — see the integrations section for your specific tool.
4

Verify the connection

Test that memory operations reach your Cloud tenant. In your MCP client, ask:
“Use Cognee to remember: cloud connection test successful”
Then retrieve it:
“Use Cognee to recall the cloud connection test”
If Cognee returns the stored value, the end-to-end connection is working. You can also confirm the data appeared in the Cognee Cloud UI.

Available tools

Once connected, your MCP client gets the Cognee API v1 memory tools:

Other connection options

Run the MCP server in standalone mode (no Cloud connection). The server manages its own local knowledge graph.
This is the simplest way to add persistent memory to Cursor, Claude Code, Cline, and other MCP-compatible tools.
Access Cognee Cloud programmatically using the cognee SDK connected through serve(), which handles authentication and communication with the hosted service.
If you prefer not to use environment variables, pass both values directly:
See the Cloud SDK guide for a complete walkthrough.
If you want multiple AI clients to share a single knowledge graph, run a self-hosted Cognee backend and point the MCP server at it using API_URL and API_TOKEN:
See the MCP Quickstart for full details on this pattern.