kagi-mcp
The kagi-mcp server integrates Kagi's search capabilities into MCP-compatible agents using your Kagi account session token. It offers:
Web Search (
kagi_search): Perform high-quality, ad-free web searches with advanced query operators (exact phrases" ", site-specificsite:, exclusions-,OR), date filtering (from_date,to_date), region locking (2-letter country codes), and lens scoping. Supports pagination (page) and result limiting (1-50). Returns titles, URLs, dates, and snippets.News Search (
kagi_news): Search for recent news articles, returning headlines, sources, publication times, and snippets. Ideal for current events, with optional result limit (1-50).List Lenses (
kagi_lenses): Retrieve a list of all curated search scopes (lenses) available on your account, such as Forums, Academic, Programming, PDFs, etc., including their names and IDs for use withkagi_search.
Additionally, the server automatically handles session token authentication, error detection (e.g., expired tokens), and provides robust error reporting.
Provides web search and news search tools using Kagi Search with your existing Kagi account via session token authentication. Supports search operators, region filtering, lenses, and returns compact plain text results.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@kagi-mcpsearch the web for best practices in prompt engineering"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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 |
| Web search |
|
| News search |
|
| 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.
Related MCP server: Kagi MCP Server
1. Get your session token
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. Add it to your AI agent
All examples run the published npm package via npx — nothing to install up front
(requires Node.js 18+; latest LTS recommended).
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.)
Codex CLI
codex mcp add kagi --env KAGI_SESSION_TOKEN=<token> -- npx -y kagi-mcp-claude-fable-5Or add a table to ~/.codex/config.toml directly:
[mcp_servers.kagi]
command = "npx"
args = ["-y", "kagi-mcp-claude-fable-5"]
env = { "KAGI_SESSION_TOKEN" = "<token or session link>" }(On Windows, if the server fails to spawn, set command to the full path of
npx.cmd, e.g. 'C:\Program Files\nodejs\npx.cmd'.)
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>"Any MCP client (Claude Desktop, ...) — JSON config
{
"mcpServers": {
"kagi": {
"command": "npx",
"args": ["-y", "kagi-mcp-claude-fable-5"],
"env": { "KAGI_SESSION_TOKEN": "<token or session link>" }
}
}
}Development
git clone https://github.com/real-jiakai/kagi-mcp-claude-fable-5.git kagi-mcp
cd kagi-mcp
npm install # TypeScript build to dist/ runs automatically
# smoke test against your real Kagi account (append `news` for the news vertical)
KAGI_SESSION_TOKEN='<token or session link>' node test.js "capital of japan"To point a client at your checkout instead of npm, use
node /path/to/kagi-mcp/dist/index.js as the command; re-run npm run build
after editing src/.
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.ts.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.
Available Tools
3 toolskagi_lensesList Kagi lensesA
List the Kagi lenses (curated search scopes such as Forums, Academic, Programming) available on this account, with their ids. Pass a lens name or id to kagi_search's lens parameter.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, so the description carries full burden. It adds context that lenses are 'available on this account', implying account-specific data. However, it does not disclose details like whether the list is exhaustive or if any side effects occur, though for a list tool this is acceptable.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences with zero wasted words. First sentence states the action, second sentence provides cross-tool usage guidance. Highly efficient and front-loaded.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a zero-parameter, no-output-schema tool, the description is complete enough. It explains what the tool does and how to use its result. Could mention return format (e.g., list of lens objects) but not essential given simplicity.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
No parameters in schema, so baseline is 4 per rubric. The description adds no parameter-level detail, which is appropriate since there are none.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb 'List' and clearly identifies the resource 'Kagi lenses' with examples (Forums, Academic, Programming). It also mentions the output includes ids, distinguishing it from siblings like kagi_search and kagi_news.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Explicitly tells the agent to pass a lens name or id to kagi_search's lens parameter, creating a clear usage context. Lacks an explicit 'when not to use' but provides sufficient guidance for correct tool invocation.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
kagi_newsKagi news searchA
Search recent news with Kagi. Returns headlines with source, publication time and snippets. Best for current events; use kagi_search for general web results.
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Max results to return (default: the full news page, typically 25-45) | |
| query | Yes | News search query |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, and the description only mentions it returns headlines, source, time, and snippets. It does not disclose any behavioral traits like time range recency, default sorting, or any limitations. For a simple read-only tool this is minimal, but the description carries the full burden without annotations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences, highly concise, front-loaded with purpose and return format. Every sentence adds value with no wasted words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a tool with 2 parameters, no output schema, and no annotations, the description covers purpose, return format, and usage context adequately. However, it lacks details about time range recency or default sort order, which would make it more complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% and already documents both parameters well. The description does not add any extra parameter semantics beyond what the schema provides, earning the baseline score.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description clearly states it searches recent news and returns headlines with source, publication time, and snippets. It also distinguishes from sibling kagi_search by specifying it is best for current events.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Explicitly says 'Best for current events; use kagi_search for general web results,' providing clear context for when to use this tool versus the sibling.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
kagi_searchKagi web searchA
Search the web with Kagi (high-quality, ad-free results). Returns titles, URLs, dates and snippets. The query supports operators: "exact phrase", site:example.com, -excludeterm, OR. Use from_date/to_date to restrict by publication date, page for more results, region for country-specific results, and lens to restrict to a curated scope (forums, academic, ...).
| Name | Required | Description | Default |
|---|---|---|---|
| lens | No | Restrict results to a Kagi lens, by name or numeric id — e.g. "Forums" (Reddit-style discussions), "Fediverse Forums" (decentralized forums like Lemmy), "Academic", "Programming", "PDFs", "Usenet/Archive", "News 360". Call kagi_lenses for the full list on this account. | |
| page | No | Result page, default 1 | |
| limit | No | Max results to return (default: the full results page, typically 20-40) | |
| query | Yes | Search query (supports quotes, site:, -exclusion, OR) | |
| region | No | Result region: 2-letter country code ("us", "cn", "jp", "de", ...). Default: "no_region" (international, location-neutral) — set a country code when the question is region-specific. | |
| to_date | No | Only results published on/before this date (YYYY-MM-DD) | |
| from_date | No | Only results published on/after this date (YYYY-MM-DD) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description must fully convey behavioral traits. It mentions the return format (titles, URLs, dates, snippets) and operator support, but does not disclose potential side effects, rate limits, authentication requirements, or error behavior. This is adequate but not exhaustive.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise (two sentences) and well-structured, with the main purpose front-loaded. Every sentence adds necessary information without redundancy or filler.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool has 7 parameters and no output schema, the description adequately covers the return format and parameter usage. It mentions all key features, though it could include more details on edge cases or advanced usage.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so baseline is 3. The description adds value by explaining the purpose of parameters (e.g., 'Use from_date/to_date to restrict by publication date') and the capabilities of the query (supports operators), which goes beyond the schema descriptions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'Search the web with Kagi (high-quality, ad-free results).' It specifies the return fields (titles, URLs, dates, snippets) and distinguishes itself from siblings like kagi_lenses and kagi_news by being a general web search tool.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides guidance on using parameters like from_date/to_date, page, region, and lens, and mentions query operators. However, it does not explicitly contrast with alternatives (e.g., when to use kagi_news instead) or state when not to use this tool, missing some explicit context.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
3 tool updates
v1.0.0- First observed
kagi_lenses - First observed
kagi_news - First observed
kagi_search
TDQS
Each tool has a clearly distinct purpose: kagi_lenses lists curated search scopes, kagi_news searches recent news, and kagi_search performs general web searches. Descriptions explicitly differentiate use cases.
All tools follow a consistent kagi_<service> pattern, using clear nouns/verbs that reflect the tool's function. No deviations or mixed conventions.
Three tools is appropriate for a focused search server, covering lens listing, news search, and general search without unnecessary bloat or gaps.
The surface covers the core functionality of the Kagi search API: discovering lenses, searching news, and general web search. No obvious missing operations for the stated purpose.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
MCP server for Google search results via SERP API
Docs: https://docs.keenable.ai/mcp-server Keenable is a free, remote MCP server that gives agents access to the web index. Search the web with ranked results and date/site filters, then fetch any indexed page as clean markdown. Works out of the box with no account or API key.
SERP + haber + içerik çıkarımı MCP sunucusu — web araması (Brave/SerpApi BYOK), anahtarsız haber…
Related MCP Servers
- AlicenseAqualityCmaintenanceUnofficial MCP server for working with Kagi without API access (you'll need to be a customer, tho). Searches and summarizes. Uses Kagi session token for easy authentication.241MIT
- AlicenseNot gradedqualityDmaintenanceEnables integration with Kagi search engine services including web search, content summarization from URLs, and AI assistant conversations. Uses session tokens to access Kagi's search API, summarizer, and AI models directly within MCP-compatible applications.143MIT
- AlicenseAqualityDmaintenanceProvides free web search and URL summarization using Kagi session tokens, compatible with any MCP client.283MIT
- AlicenseNot gradedqualityDmaintenanceFree web search MCP server using SearXNG, supporting web search, news search, and search summaries.MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/real-jiakai/kagi-mcp-claude-fable-5'
If you have feedback or need assistance with the MCP directory API, please join our Discord server