MCP HubMCP Hub
kagisearch

kagimcp

by: kagisearch

A Model Context Protocol (MCP) server for Kagi search.

59created 13/12/2024
Visit
Kagi
Protocol

📌Overview

Purpose: The Kagi MCP server framework provides a means for integrating Kagi's search capabilities efficiently within applications via the Model Context Protocol.

Overview: This server setup is intended for developers looking to leverage the Kagi search API. It facilitates easy integration with the Claude Desktop client, enabling users to ask questions and receive search results through an intuitive interface.

Key Features:

  • Server Setup: Simple installation process using command-line instructions that include downloading dependencies and configuring the environment for Kagi's API access.

  • Integration with Claude: Allows users to query the Kagi search engine directly from the Claude Desktop, streamlining the process of obtaining search results without additional steps.

  • Debugging Tools: Includes commands for troubleshooting and inspecting server performance, ensuring users can efficiently resolve potential issues during setup and execution.


Kagi MCP Server

Setup Instructions

Before anything, ensure you have access to the search API. It is currently in closed beta and available upon request. Please reach out to support@kagi.com for an invite.

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

Create a configuration file named claude_desktop_config.json:

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

Installing via Smithery

You can install Kagi for Claude Desktop automatically via Smithery:

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

Ask Claude a Question

Example question: "Who was Time's 2024 person of the year?"

Debugging

Run:

npx @modelcontextprotocol/inspector uvx kagimcp

Local/Dev Setup Instructions

Clone Repository

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

Install Dependencies

Follow the previous UV installation instructions for your OS. Then install MCP server dependencies:

cd kagimcp

# Create virtual environment and activate it
uv venv

source .venv/bin/activate # MacOS/Linux
# OR
.venv/Scripts/activate # Windows

# Install dependencies
uv sync

Setup with Claude Desktop

Using MCP CLI SDK

# pip install mcp[cli] if you haven't
mcp install /ABSOLUTE/PATH/TO/PARENT/FOLDER/kagimcp/src/kagimcp/server.py -v "KAGI_API_KEY=API_KEY_HERE"

Manually

Create a configuration file named claude_desktop_config.json:

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

Ask Claude a Question

Example question: "Who was Time's 2024 person of the year?"

Debugging

Run:

# If mcp cli installed (pip install mcp[cli])
mcp dev /ABSOLUTE/PATH/TO/PARENT/FOLDER/kagimcp/src/kagimcp/server.py

# If not
npx @modelcontextprotocol/inspector \
      uv \
      --directory /ABSOLUTE/PATH/TO/PARENT/FOLDER/kagimcp \
      run \
      kagimcp

Access MCP Inspector at http://localhost:5173 and add your Kagi API key in the environment variables under KAGI_API_KEY.

Notes

  • Level of logging is adjustable through the FASTMCP_LOG_LEVEL environment variable (e.g. FASTMCP_LOG_LEVEL="ERROR").
  • Relevant issue: GitHub Issue