Skip to main content

Claude Code Integration

Claude Code is Anthropic’s command-line AI assistant with built-in MCP support. It runs in your terminal and can access MCP servers configured in your project or user settings.

Prerequisites

  • Node.js and npm installed
  • Cognee MCP server running (see Quickstart or Local Setup)
  • OpenAI API key (for Cognee’s LLM operations)

Setup Steps

1

Install Claude Code

npm install -g @anthropic-ai/claude-code
2

Navigate to Your Project

cd /path/to/your/project
3

Add Cognee Server

Choose the command that matches how you started the Cognee MCP server:
  • Docker (HTTP)
  • Local (stdio)
Use this if you started the server with Docker:
claude mcp add --transport http cognee http://localhost:8000/mcp -s project
This creates a configuration in your project’s .mcp.json file that connects to the HTTP endpoint.Options:
  • -s project: Stores configuration in the project (requires approval per project)
  • Omit -s project to store at user level (applies to all projects)
4

Start Claude Code and Approve

claude
On first run in this project, you will see:
Approve project MCP servers?
• cognee    /path/to/cognee-mcp
Select Enable or press Enter. Claude Code can now call Cognee tools automatically.
5

Use Cognee Tools

Claude Code will use Cognee tools when relevant to your requests. You can explicitly ask:
  • “Add this code to Cognee memory”
  • “Search Cognee for authentication patterns”
  • “Use Cognee to codify this repository”

Where to Use This Configuration

The configuration is stored in .mcp.json in your project directory (with -s project) or in your user settings (without it). Claude Code reads this file when starting a session in that directory.

Need Help?

Join Our Community

Get support and connect with other developers using Cognee MCP.