kagi-mcp

kagi-mcp

MCP server for Kagi Search that uses your session token for web and news search without a separate API subscription.

Category
访问服务器

README

kagi-mcp

English | 简体中文

MCP server for Kagi Search that authenticates with your session token — no separate API subscription needed, it uses your existing Kagi plan via Kagi's lightweight HTML interface (kagi.com/html/search).

Tools

Tool Purpose Parameters
kagi_search Web search query (required), page, from_date, to_date, region, lens, limit
kagi_news News search query (required), limit
kagi_lenses List available lenses —
  • region: 2-letter country code (us, cn, jp, ...); maps to Kagi's r= parameter. Defaults to no_region (international/location-neutral) so the AI agent decides when a country-specific view is needed.
  • lens: a Kagi lens by name or numeric id (e.g. Forums, Fediverse Forums, Academic, Programming, PDFs). Names are resolved against the lens list on your account (cached per server process — restart the server after creating new lenses).

Queries support Kagi operators: "exact phrase", site:example.com, -exclude, OR. Output is compact plain text (title, URL, date, snippet, related searches). By default a call returns the full first results page — the same set a user sees on kagi.com (typically 20-40 results); pass limit to trim it. Snippets are Kagi's own SERP snippets; fetching full page content is left to the agent's page-fetch tool.

1. Get your session token

  1. Open kagi.com/settings/user_details
  2. Find the Session Link section and copy the link.
  3. Use either the full link (https://kagi.com/search?token=...) or just the token part — both work as KAGI_SESSION_TOKEN.

Treat the session link like a password — anyone with it can use your Kagi account. If it leaks, generate a new one from the same settings page (this invalidates the old one).

2. Install

Requires Node.js 18+.

Option A — npx (quickest, no clone). Nothing to install up front; your MCP client runs the published package directly with npx -y kagi-mcp-claude-fable-5 (see the configs below).

Option B — from source:

git clone https://github.com/real-jiakai/kagi-mcp-claude-fable-5.git kagi-mcp
cd kagi-mcp
npm install

3. Smoke test

macOS / Linux:

KAGI_SESSION_TOKEN='<token or session link>' node test.js "capital of japan"   # web search
KAGI_SESSION_TOKEN='<token or session link>' node test.js "tokyo" news         # news search

Windows (PowerShell):

$env:KAGI_SESSION_TOKEN = '<token or session link>'
node test.js "capital of japan"

4. Hook it up

The examples use the npx form. Running from source instead? Replace npx -y kagi-mcp-claude-fable-5 with node /path/to/kagi-mcp/src/index.js (Windows JSON needs escaped backslashes: "C:\\path\\to\\kagi-mcp\\src\\index.js").

Claude Code

claude mcp add kagi -s user --env KAGI_SESSION_TOKEN=<token> -- npx -y kagi-mcp-claude-fable-5

(-s user makes the server available in all your projects; omit it for project-local.)

Claude Desktop / any MCP client (JSON config)

{
  "mcpServers": {
    "kagi": {
      "command": "npx",
      "args": ["-y", "kagi-mcp-claude-fable-5"],
      "env": { "KAGI_SESSION_TOKEN": "<token or session link>" }
    }
  }
}

OpenClaw

openclaw mcp add kagi \
  --command npx \
  --arg -y \
  --arg kagi-mcp-claude-fable-5 \
  --env KAGI_SESSION_TOKEN=<token>

Verify with openclaw mcp doctor kagi --probe.

Hermes Agent

Add to ~/.hermes/config.yaml under mcp_servers:

mcp_servers:
  kagi:
    command: "npx"
    args: ["-y", "kagi-mcp-claude-fable-5"]
    env:
      KAGI_SESSION_TOKEN: "<token or session link>"

Notes

  • Auth failures: if the token is invalid/expired, Kagi 302-redirects to its landing page; the server detects this and returns a clear error telling you to refresh the token.
  • Parsing: results are extracted via Kagi's own machine-readable markers (._0_SRI, a._0_URL, ._0_TITLE, ._0_DESC), which are stable across the web and news verticals (verified July 2026). If Kagi ever changes its markup, update parseResultsPage() in src/kagi.js.
  • This uses your normal Kagi account the same way a browser would — standard fair-use search volume from an agent is indistinguishable from regular usage. It is not the official Kagi Search API (which bills separately).

Acknowledgements

Designed, implemented, and tested end-to-end with Claude Fable 5 via Claude Code — including live analysis of Kagi's HTML interface, an adversarial multi-agent code review, and human-click vs. MCP parity testing in the browser.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选