Kagi MCP Setup Guide

Prerequisites
  1. Access to Search API: Ensure you have access to the search API. Contact [email protected] for an invite if needed.

Installation

Install uv

MacOS/Linux

curl -LsSf https://astral.sh/uv/install.sh | sh
 

Windows

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
 

Setup with Claude Desktop

Configuration

  1. Locate the claude_desktop_config.json file:

    • Navigate through: Hamburger Menu -> File -> Settings -> Developer -> Edit Config
  2. Add the following configuration:

    {
      "mcpServers": {
      "kagi": {
      "command": "uvx",
      "args": ["kagimcp"],
      "env": {
      "KAGI_API_KEY": "YOUR_API_KEY_HERE"
      }
      }
      }
     }
     

Automatic Installation via Smithery

npx -y @smithery/cli install kagimcp --client claude
 

Ask Claude a Question

Example:

Who was time's 2024 person of the year?
 

Debugging

npx @modelcontextprotocol/inspector uvx kagimcp
 

Local/Dev Setup Instructions

Clone Repository

git clone https://github.com/kagisearch/kagimcp.git
 

Install Dependencies

  1. Install uv (if not already installed):

    • Follow the same steps as in the Installation section above.
  2. Install MCP Server Dependencies:

    cd kagimcp
     
  3. Create and Activate Virtual Environment:

    uv venv
     
    • MacOS/Linux:
      source .venv/bin/activate
       
    • Windows:
      .venv/Scripts/activate
       
  4. Sync Dependencies:

    uv sync
     

Setup with MCP CLI SDK

  1. Install MCP CLI (if not already installed):

    pip install mcp[cli]
     
  2. Install MCP:

    mcp install /ABSOLUTE/PATH/TO/PARENT/FOLDER/kagimcp/src/kagimcp/server.py -v "KAGI_API_KEY=API_KEY_HERE"
     

Manual Setup

  1. Locate the claude_desktop_config.json file:

    • Navigate through: Hamburger Menu -> File -> Settings -> Developer -> Edit Config
  2. Add the following configuration:

    {
      "mcpServers": {
      "kagi": {
      "command": "uv",
      "args": [
      "--directory",
      "/ABSOLUTE/PATH/TO/PARENT/FOLDER/kagimcp",
      "run",
      "kagimcp"
      ],
      "env": {
      "KAGI_API_KEY": "YOUR_API_KEY_HERE"
      }
      }
      }
     }
     

Debugging

If MCP CLI is Installed

mcp dev /ABSOLUTE/PATH/TO/PARENT/FOLDER/kagimcp/src/kagimcp/server.py
 

If MCP CLI is Not Installed

npx @modelcontextprotocol/inspector 
  uv 
  --directory /ABSOLUTE/PATH/TO/PARENT/FOLDER/kagimcp 
  run 
  kagimcp
 
  • Access MCP Inspector at http://localhost:5173.
  • Add your Kagi API key in the environment variables under KAGI_API_KEY.

Notes

  • Adjust logging level using the FASTMCP_LOG_LEVEL environment variable (e.g. FASTMCP_LOG_LEVEL="ERROR").
Share this post: