kagi-mcp
MCP server for Kagi Search that uses your session token for web and news search without a separate API subscription.
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'sr=parameter. Defaults tono_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
- Open kagi.com/settings/user_details
- Find the Session Link section and copy the link.
- Use either the full link (
https://kagi.com/search?token=...) or just the token part — both work asKAGI_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, updateparseResultsPage()insrc/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.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.