Skip to content
Back to search

kagimcp

The Official Model Context Protocol (MCP) server for Kagi Search & other tools.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/kagisearch--kagimcp/badge.svg)](/listings/kagisearch--kagimcp)

HTML

<a href="/listings/kagisearch--kagimcp"><img src="/api/listings/kagisearch--kagimcp/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

These steps run a script from the network that findsafeskills does not scan.

Codex CLI

codex mcp add kagi --env KAGI_API_KEY=<YOUR_API_KEY_HERE> -- uvx kagimcp

Codex writes MCP configuration to `~/.codex/config.toml`.

Claude Desktop

Install uv first.

MacOS/Linux:

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

Windows:

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

Then in your Claude Desktop config (found through Settings -> Developer -> Edit Config):

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

Claude Code

claude mcp add kagi -e KAGI_API_KEY="YOUR_API_KEY_HERE" -- uvx kagimcp

Smithery

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

Kiro

Add to your Kiro MCP config file (`~/.kiro/settings/mcp.json` for global, or `.kiro/settings/mcp.json` for project-scoped) using the same `mcpServers` JSON as [Claude Desktop](#claude-desktop). See the [Kiro MCP documentation](https://kiro.dev/docs/mcp/) for more details.

OpenCode

Edit the OpenCode configuration file in `~/.config/opencode/opencode.json` and add the following:

{
  "mcp": {
    "kagi": {
      "type": "local",
      "command": ["uvx", "kagimcp"],
      "enabled": true,
      "environment": {
        "KAGI_API_KEY": "<YOUR_API_KEY_HERE>"
      }
    }
  }
}

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 212 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. # Kagi MCP Server
  2. An MCP server backed by the [Kagi API](https://help.kagi.com/kagi/api/overview.html). It exposes search and extraction tools to MCP-compatible clients.
  3. ## Tools
  4. - **`kagi_search_fetch`** - web, news, videos, podcasts, and image search with optional page extracts, filters, and Kagi lenses.
  5. - **`kagi_extract`** - fetch a page's full content as markdown.
  6. > **Note:** The previous `kagi_fastgpt` and `kagi_summarizer` tools have been removed. Both are planned to return in a future release.
  7. ## Hosted Server
  8. We run a hosted MCP server at **`https://mcp.kagi.com/mcp`** — no install required. Point any HTTP-capable MCP client at it and authenticate with your Kagi API key.
  9. OAuth2 isn't supported yet (it's on our roadmap), so for now grab your [API key from the dashboard](https://kagi.com/api/keys) and pass it via `Bearer` HTTP authentication.
  10. Example with Claude Code:
  11. ```bash
  12. claude mcp add kagi https://mcp.kagi.com/mcp --transport http --header "Authorization: Bearer $(read -sp 'API key: ' k; echo $k)" --scope user
  13. ```
  14. Prefer to run it yourself? See [Client Setup](#client-setup) for the local `uvx` install, or [Self-Hosting](#self-hosting) to host the HTTP server on your own infrastructure.
  15. ## Requirements
  16. - A Kagi API key in `KAGI_API_KEY`.
  17. - [`uv`](https://docs.astral.sh/uv/) for the recommended `uvx` install path.
  18. Install `uv`:
  19. ```bash
  20. curl -LsSf https://astral.sh/uv/install.sh | sh
  21. ```
  22. Windows:
  23. ```powershell
  24. powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
  25. ```
  26. ## Client Setup
  27. ### Codex CLI
  28. ```bash
  29. codex mcp add kagi --env KAGI_API_KEY=<YOUR_API_KEY_HERE> -- uvx kagimcp
  30. ```
  31. Codex writes MCP configuration to `~/.codex/config.toml`.
  32. ### Claude Desktop
  33. Install uv first.
  34. MacOS/Linux:
  35. ```bash
  36. curl -LsSf https://astral.sh/uv/install.sh | sh
  37. ```
  38. Windows:
  39. ```
  40. powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
  41. ```
  42. Then in your Claude Desktop config (found through Settings -> Developer -> Edit Config):
  43. ```json
  44. {
  45. "mcpServers": {
  46. "kagi": {
  47. "command": "uvx",
  48. "args": ["kagimcp"],
  49. "env": {
  50. "KAGI_API_KEY": "YOUR_API_KEY_HERE"
  51. }
  52. }
  53. }
  54. }
  55. ```
  56. ### Claude Code
  57. ```bash
  58. claude mcp add kagi -e KAGI_API_KEY="YOUR_API_KEY_HERE" -- uvx kagimcp
  59. ```
  60. ### Smithery
  61. ```bash
  62. npx -y @smithery/cli install kagimcp --client claude
  63. ```
  64. ### Kiro
  65. Add to your Kiro MCP config file (`~/.kiro/settings/mcp.json` for global, or `.kiro/settings/mcp.json` for project-scoped) using the same `mcpServers` JSON as [Claude Desktop](#claude-desktop). See the [Kiro MCP documentation](https://kiro.dev/docs/mcp/) for more details.
  66. ### OpenCode
  67. Edit the OpenCode configuration file in `~/.config/opencode/opencode.json` and add the following:
  68. ```json
  69. {
  70. "mcp": {
  71. "kagi": {
  72. "type": "local",
  73. "command": ["uvx", "kagimcp"],
  74. "enabled": true,
  75. "environment": {
  76. "KAGI_API_KEY": "<YOUR_API_KEY_HERE>"
  77. }
  78. }
  79. }
  80. }
  81. ```
  82. ## Usage Examples
  83. - Search: `Who was Time's 2024 person of the year?`
  84. - Extract: `extract the full content of https://en.wikipedia.org/wiki/Model_Context_Protocol`
  85. ## Configuration
  86. Environment variable | Description
  87. --- | ---
  88. `KAGI_API_KEY` | Required Kagi API key.
  89. `FASTMCP_LOG_LEVEL` | Logging level, for example `ERROR`.
  90. `KAGI_SEARCH_TIMEOUT` | Search timeout in seconds. Defaults to `10`.
  91. `KAGI_EXTRACT_TIMEOUT` | Extract timeout in seconds. Defaults to `30`.
  92. `KAGI_MAX_RETRIES` | Max retry attempts after the first request. Defaults to `2`; set `0` to disable retries.
  93. `KAGI_HIDDEN_PARAMS` | Comma-separated search params to hide from the LLM-facing schema.
  94. `KAGI_SEARCH_FORMAT` | Search result format: `json` (default) or `markdown` (the Search API's own markdown, passed through as-is).
  95. Hideable search params:
  96. ```text
  97. workflow, extract_count, limit, include_domains, exclude_domains, time_relative, after, before, file_type, lens_id
  98. ```
  99. Example:
  100. ```bash
  101. KAGI_HIDDEN_PARAMS="extract_count,after,before,time_relative,include_domains,exclude_domains"
  102. ```
  103. ## Local Development
  104. ```bash
  105. git clone https://github.com/kagisearch/kagimcp.git
  106. cd kagimcp
  107. uv sync
  108. ```
  109. Run locally over stdio:
  110. ```bash
  111. KAGI_API_KEY=<YOUR_API_KEY_HERE> uv run kagimcp
  112. ```
  113. Run with streamable HTTP transport:
  114. ```bash
  115. KAGI_API_KEY=<YOUR_API_KEY_HERE> uv run kagimcp --http --host 0.0.0.0 --port 8000
  116. ```
  117. ## Self-Hosting
  118. HTTP mode is multi-tenant: each request supplies its API key via the
  119. `Authorization: Bearer <key>` header instead of a server-wide env var, so one
  120. instance can serve multiple users. The repo ships a `Dockerfile` that installs a pinned `kagimcp` from PyPI and
  121. runs it in HTTP mode. The container respects `$PORT` so it works on any
  122. platform that injects one (Railway, Render, Cloud Run, Fly.io, etc.).
  123. Build and run locally:
  124. ```sh
  125. docker build -t kagimcp-hosted .
  126. docker run --rm -p 8000:8000 kagimcp-hosted
  127. ```
  128. Smoke test:
  129. ```sh
  130. curl -sL http://127.0.0.1:8000/mcp -X POST \
  131. -H "authorization: Bearer $KAGI_API_KEY" \
  132. -H "content-type: application/json" \
  133. -H "accept: application/json, text/event-stream" \
  134. -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
  135. ```
  136. To bump the version in production, edit the pin in the `Dockerfile` and redeploy.
  137. ## Debugging
  138. Inspect the published package:
  139. ```bash
  140. npx @modelcontextprotocol/inspector uvx kagimcp
  141. ```
  142. Inspect a local checkout:
  143. ```bash
  144. npx @modelcontextprotocol/inspector uv --directory /ABSOLUTE/PATH/TO/kagimcp run kagimcp
  145. ```
  146. The inspector is usually available at `http://localhost:5173`.
  147. ## Prerelease Instructions
  148. If using a prerelease build, the same installation instructions apply, but use `uvx --prerelease allow --from kagimcp==1.0.0rc2 kagimcp` instead of `uvx kagimcp` (replace `1.0.0rc2` with whatever version you're wanting to install).

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.