Kagi MCP server
Setup Intructions
Before anything, ensure you have access to the search API. It is currently in closed beta and available upon request. Please reach out to [email protected] for an invite.
Install uv first.
MacOS/Linux:
1curl -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
1# claude_desktop_config.json 2# Can find location through: 3# Hamburger Menu -> File -> Settings -> Developer -> Edit Config 4{ 5 "mcpServers": { 6 "kagi": { 7 "command": "uvx", 8 "args": ["kagimcp"], 9 "env": { 10 "KAGI_API_KEY": "YOUR_API_KEY_HERE" 11 } 12 } 13 } 14}
Installing via Smithery
Alternatively, you can install Kagi for Claude Desktop automatically via Smithery:
1npx -y @smithery/cli install kagimcp --client claude
Ask Claude a question requiring search
e.g. "Who was time's 2024 person of the year?"
Debugging
Run:
1npx @modelcontextprotocol/inspector uvx kagimcp
Local/Dev Setup Instructions
Clone repo
git clone https://github.com/kagisearch/kagimcp.git
Install dependencies
Install uv first.
MacOS/Linux:
1curl -LsSf https://astral.sh/uv/install.sh | sh
Windows:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
Then install MCP server dependencies:
1cd kagimcp 2 3# Create virtual environment and activate it 4uv venv 5 6source .venv/bin/activate # MacOS/Linux 7# OR 8.venv/Scripts/activate # Windows 9 10# Install dependencies 11uv sync
Setup with Claude Desktop
Using MCP CLI SDK
1# `pip install mcp[cli]` if you haven't 2mcp install /ABSOLUTE/PATH/TO/PARENT/FOLDER/kagimcp/src/kagimcp/server.py -v "KAGI_API_KEY=API_KEY_HERE"
Manually
1# claude_desktop_config.json 2# Can find location through: 3# Hamburger Menu -> File -> Settings -> Developer -> Edit Config 4{ 5 "mcpServers": { 6 "kagi": { 7 "command": "uv", 8 "args": [ 9 "--directory", 10 "/ABSOLUTE/PATH/TO/PARENT/FOLDER/kagimcp", 11 "run", 12 "kagimcp" 13 ], 14 "env": { 15 "KAGI_API_KEY": "YOUR_API_KEY_HERE" 16 } 17 } 18 } 19}
Ask Claude a question requiring search
e.g. "Who was time's 2024 person of the year?"
Debugging
Run:
1# If mcp cli installed (`pip install mcp[cli]`) 2mcp dev /ABSOLUTE/PATH/TO/PARENT/FOLDER/kagimcp/src/kagimcp/server.py 3 4# If not 5npx @modelcontextprotocol/inspector \ 6 uv \ 7 --directory /ABSOLUTE/PATH/TO/PARENT/FOLDER/kagimcp \ 8 run \ 9 kagimcp
Then access MCP Inspector at http://localhost:5173
. You may need to add your Kagi API key in the environment variables in the inspector 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: https://github.com/kagisearch/kagimcp/issues/4