kagi-session2api-mcp
This server provides free access to Kagi's search and summarization services using session tokens instead of a paid API key, compatible with any MCP client supporting stdio or HTTP transport.
kagi_search_fetch — Perform one or more web searches simultaneously using Kagi, with results numbered continuously across queries. Supports advanced operators:
site:/-site:— include or exclude domainsfiletype:/ext:— filter by file typeintitle:/inurl:— filter by title or URL contentlang:/loc:— filter by language or locationbefore:/after:— filter by date range"exact phrase",+term,-term— precise term controlOptional
limitparameter to control results per query
kagi_summarizer — Summarize content from any URL (webpages, videos, documents, etc.) with configurable options:
Summary type:
summary(prose) ortakeaway(bullet points)Engine:
cecil(default),agnes,daphne, ormurielTarget language: Output in a specified language (e.g.,
EN)
Token Management: Configure a pool of session tokens with round-robin rotation, per-token rate limiting, and automatic detection/disabling of expired tokens for increased throughput and reliability.
Provides tools for searching the web using Kagi and summarizing URLs via session tokens.
Click on "Deploy 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-session2api-mcp search for quantum computing breakthroughs 2025"
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 Session2API MCP Server
Free Kagi Search MCP server — session tokens, no API key needed
Access Kagi search and summarizer via session tokens — completely free. Works with Claude Desktop, Cursor, Windsurf, Cline, Hermes and any MCP-compatible AI coding assistant/agent.
⭐ Star History
⚠️ EndUser Warning: This project uses Kagi session tokens to access search and summarizer features without the official paid API. This may violate Kagi's Terms of Service. Potential consequences include account suspension or permanent ban. Use at your own risk. The authors assume no liability for any account actions taken by Kagi.
⚠️ Security Warning: Your Kagi session token provides full account access. Treat it like a password. Never share it or commit it to version control.
Related MCP server: Kagi MCP Server
🌟 Features
Session-based access: Uses Kagi session tokens instead of the official API ($25/1000 queries) — completely free
Multi-token pool: Configure multiple tokens for higher throughput with round-robin rotation
Per-token rate limiting: 5 req/s per token with token bucket algorithm
API-compatible output: Returns results in the same format as the official
kagimcpTwo tools:
kagi_search_fetch(web search) andkagi_summarizer(URL summarization)Firefox UA spoofing: Mimics a real Firefox browser for session-based access
Auto-disable expired tokens: Expired tokens are automatically detected and skipped
Search operators: Supports Kagi operators (
site:,lang:,filetype:, etc.)
Compatible Platforms
Works with any MCP-compatible client:
Any MCP client supporting
stdioorHTTPtransport
Quick Install (For AI Agents)
Just paste this prompt to your AI agent:
Install the Kagi Session2API MCP server from https://pypi.org/project/kagi-session2api-mcp/.
Then add it to my MCP:
`uvx kagi-session2api-mcp`
set env KAGI_SESSION_TOKEN to my token (ask me if you don't have it).
If I have multiple tokens, use KAGI_SESSION_TOKENS (comma-separated) instead,
or create a config file at ~/.config/kagi-session2api-mcp/config.toml with:
[kagi]
session_tokens = ["TOKEN_1", "TOKEN_2"]
summarizer_engine = "cecil"
[client]
timeout = 30
max_retries = 2
and set env KAGI_SESSION_CONFIG to that path.Install Manually
pip install kagi-session2api-mcpOr with uvx:
uvx kagi-session2api-mcpConfiguration
Option 1: Environment Variable (Single Token)
{
"mcpServers": {
"kagi-session": {
"command": "uvx",
"args": ["kagi-session2api-mcp"],
"env": {
"KAGI_SESSION_TOKEN": "YOUR_SESSION_TOKEN_HERE"
}
}
}
}Option 2: Environment Variable (Multiple Tokens)
{
"mcpServers": {
"kagi-session": {
"command": "uvx",
"args": ["kagi-session2api-mcp"],
"env": {
"KAGI_SESSION_TOKENS": "TOKEN_1,TOKEN_2,TOKEN_3"
}
}
}
}Option 3: Config File (Recommended for Multi-Token)
Create ~/.config/kagi-session2api-mcp/config.toml:
[kagi]
session_tokens = [
"YOUR_TOKEN_1_HERE",
"YOUR_TOKEN_2_HERE",
]
summarizer_engine = "cecil"
[client]
timeout = 30
max_retries = 2Then configure:
{
"mcpServers": {
"kagi-session": {
"command": "uvx",
"args": ["kagi-session2api-mcp"],
"env": {
"KAGI_SESSION_CONFIG": "/path/to/config.toml"
}
}
}
}Getting Your Session Token
Log in to kagi.com
Go to Settings → Account → Session Link
Copy the token from the session URL:
https://kagi.com/search?token={THIS_PART}&q=testUse this token in your configuration
Usage
MCP Tools
kagi_search_fetch
Search the web using Kagi:
Search for "Python async tutorial"Supports Kagi search operators:
site:github.com- Restrict to domain-site:reddit.com- Exclude domainfiletype:pdf- File type filterintitle:python- Title filterlang:zh- Language filterbefore:2024-01-01/after:2024-01-01- Date filters"exact phrase"- Exact match
kagi_summarizer
Summarize any URL:
Summarize https://example.com/articleOptions:
summary_type: "summary" (prose) or "takeaway" (bullet points)engine: "cecil" (default), "agnes", "daphne", "muriel"target_language: Language code (e.g., "EN")
⚠️ The summarizer is experimental — it uses Kagi's internal endpoint which may change.
Transport Modes
Stdio (default, for Claude Desktop):
kagi-session2api-mcpHTTP (for remote access):
kagi-session2api-mcp --http --host 0.0.0.0 --port 8000Architecture
MCP Client → FastMCP Server → TokenPool (round-robin) → httpx.AsyncClient → kagi.com
↓
TokenBucket (5 req/s per token)
↓
Auto-disable expired tokensToken Pool Behavior
Config | Rate Limit | Effective Rate |
1 token | 5 req/s | 5 req/s |
2 tokens | 5 req/s each | 10 req/s |
N tokens | 5 req/s each | 5×N req/s |
When a token expires (detected via 401/403 or redirect to login), it is automatically disabled. Remaining tokens continue serving requests.
Differences from Official kagimcp
Aspect | Official |
|
Authentication | API key ($25/1000) | Session token (free) |
Search endpoint |
|
|
Summarizer |
|
|
Rate limiting | Server-side | Client-side (token bucket) |
| Returns balance | Always |
Cost | Paid | Free (uses existing session) |
Thank you!
Star this repo if you feel it useful, that would help me a lot :)
License
MIT
Available Tools
2 toolskagi_search_fetchA
Fetch web results based on one or more queries using Kagi Search.
Use for general search and when the user explicitly tells you to 'fetch' results/information. Results are from all queries given. They are numbered continuously, so that a user may be able to refer to a result by a specific number.
Inputs: queries (required), limit. Returns: result
kagi_summarizerA
Summarize content from a URL using the Kagi Summarizer.
The Summarizer can summarize any document type (text webpage, video, audio, etc.)
Note: This tool uses Kagi's internal summarizer endpoint accessed via session token. This is experimental and may break if Kagi changes their internal API.
Inputs: url (required), summary_type, target_language, engine. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The two tools have clearly distinct purposes: one fetches search results, the other summarizes content from URLs. There is no overlap or ambiguity in their functionality.
Both tools follow a consistent verb_noun pattern with the 'kagi_' prefix ('kagi_search_fetch', 'kagi_summarizer'), making the naming predictable and understandable.
With only 2 tools, the server feels minimal but still reasonable for its narrow focus on Kagi search and summarizer APIs. The experimental nature of the summarizer tool might warrant additional tools in the future.
The tool surface covers the two core operations of the Kagi API: search and summarization. While there are no additional utilities like listing or filtering, the basic workflow is supported without obvious dead ends.
Maintenance
Related MCP Connectors
Free web search for AI agents. No API key required. Hosted MCP in active development.
Web search API and MCP server for developers building AI agents.
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.
Search your AI chat history (ChatGPT, Claude, Codex) from any MCP client. Remote, private, read-only
Related MCP Servers
- AlicenseAqualityDmaintenanceUnofficial 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.242MIT
- 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.14 npm3MIT
- AlicenseNot gradedqualityDmaintenanceFree web search MCP server using SearXNG, supporting web search, news search, and search summaries.MIT
- AlicenseAqualityDmaintenanceMCP server for Kagi Search that uses your session token for web and news search without a separate API subscription.319 npmMIT