kagi-session2api-mcp
MCP-сервер Kagi Session2API
Бесплатный MCP-сервер (Model Context Protocol) для Kagi — доступ к поиску и суммаризатору Kagi через токены сессии, API-ключ не требуется. Работает с Claude Desktop, Cursor, Windsurf, Cline, Hermes и любым ИИ-ассистентом или агентом для программирования, поддерживающим MCP.
⚠️ Предупреждение для конечного пользователя: Этот проект использует токены сессии Kagi для доступа к функциям поиска и суммаризации без официального платного API. Это может нарушать Условия использования Kagi. Возможные последствия включают приостановку или пожизненную блокировку аккаунта. Используйте на свой страх и риск. Авторы не несут ответственности за любые действия, предпринятые Kagi в отношении вашего аккаунта.
⚠️ Предупреждение о безопасности: Ваш токен сессии Kagi предоставляет полный доступ к аккаунту. Относитесь к нему как к паролю. Никогда не передавайте его и не добавляйте в системы контроля версий.
Возможности
Доступ на основе сессии: Использует токены сессии Kagi вместо официального API ($25/1000 запросов) — полностью бесплатно
Пул из нескольких токенов: Настройка нескольких токенов для повышения пропускной способности с использованием алгоритма циклического перебора (round-robin)
Ограничение частоты запросов (rate limiting) для каждого токена: 5 запросов в секунду на токен с использованием алгоритма «маркерной корзины» (token bucket)
API-совместимый вывод: Возвращает результаты в том же формате, что и официальный
kagimcpДва инструмента:
kagi_search_fetch(веб-поиск) иkagi_summarizer(суммаризация URL)Подмена UA Firefox: Имитирует реальный браузер Firefox для доступа на основе сессии
Автоматическое отключение просроченных токенов: Просроченные токены автоматически обнаруживаются и пропускаются
Операторы поиска: Поддерживает операторы Kagi (
site:,lang:,filetype:и т. д.)
Related MCP server: Kagi MCP Server
Совместимые платформы
Работает с любым MCP-совместимым клиентом:
Любой MCP-клиент, поддерживающий транспорт
stdioилиHTTP
Быстрая установка (для ИИ-агентов)
Просто вставьте этот промпт своему ИИ-агенту:
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.Установка вручную
pip install kagi-session2api-mcpИли с помощью uvx:
uvx kagi-session2api-mcpКонфигурация
Вариант 1: Переменная окружения (один токен)
{
"mcpServers": {
"kagi-session": {
"command": "uvx",
"args": ["kagi-session2api-mcp"],
"env": {
"KAGI_SESSION_TOKEN": "YOUR_SESSION_TOKEN_HERE"
}
}
}
}Вариант 2: Переменная окружения (несколько токенов)
{
"mcpServers": {
"kagi-session": {
"command": "uvx",
"args": ["kagi-session2api-mcp"],
"env": {
"KAGI_SESSION_TOKENS": "TOKEN_1,TOKEN_2,TOKEN_3"
}
}
}
}Вариант 3: Файл конфигурации (рекомендуется для нескольких токенов)
Создайте ~/.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 = 2Затем настройте:
{
"mcpServers": {
"kagi-session": {
"command": "uvx",
"args": ["kagi-session2api-mcp"],
"env": {
"KAGI_SESSION_CONFIG": "/path/to/config.toml"
}
}
}
}Получение токена сессии
Войдите на kagi.com
Перейдите в Settings → Account → Session Link
Скопируйте токен из URL сессии:
https://kagi.com/search?token={ЭТА_ЧАСТЬ}&q=testИспользуйте этот токен в своей конфигурации
Использование
Инструменты MCP
kagi_search_fetch
Поиск в интернете с помощью Kagi:
Search for "Python async tutorial"Поддерживает операторы поиска Kagi:
site:github.com— ограничение по домену-site:reddit.com— исключение доменаfiletype:pdf— фильтр по типу файлаintitle:python— фильтр по заголовкуlang:zh— фильтр по языкуbefore:2024-01-01/after:2024-01-01— фильтры по дате"exact phrase"— точное совпадение
kagi_summarizer
Суммаризация любого URL:
Summarize https://example.com/articleОпции:
summary_type: "summary" (текст) или "takeaway" (маркированный список)engine: "cecil" (по умолчанию), "agnes", "daphne", "muriel"target_language: Код языка (например, "EN")
⚠️ Суммаризатор является экспериментальным — он использует внутреннюю конечную точку Kagi, которая может измениться.
Режимы транспорта
Stdio (по умолчанию, для Claude Desktop):
kagi-session2api-mcpHTTP (для удаленного доступа):
kagi-session2api-mcp --http --host 0.0.0.0 --port 8000Архитектура
MCP Client → FastMCP Server → TokenPool (round-robin) → httpx.AsyncClient → kagi.com
↓
TokenBucket (5 req/s per token)
↓
Auto-disable expired tokensРабота пула токенов
Конфигурация | Ограничение частоты | Эффективная частота |
1 токен | 5 зап/с | 5 зап/с |
2 токена | 5 зап/с каждый | 10 зап/с |
N токенов | 5 зап/с каждый | 5×N зап/с |
Когда токен истекает (обнаруживается через 401/403 или перенаправление на страницу входа), он автоматически отключается. Оставшиеся токены продолжают обрабатывать запросы.
Отличия от официального kagimcp
Аспект | Официальный |
|
Аутентификация | API-ключ ($25/1000) | Токен сессии (бесплатно) |
Конечная точка поиска |
|
|
Суммаризатор |
|
|
Ограничение частоты | На стороне сервера | На стороне клиента (маркерная корзина) |
| Возвращает баланс | Всегда |
Стоимость | Платно | Бесплатно (использует существующую сессию) |
Риски
Kagi может изменить структуру HTML, что приведет к поломке парсера
Доступ на основе сессии может нарушать Условия использования Kagi
Возможна приостановка или пожизненная блокировка аккаунта
Конечная точка суммаризатора является внутренней и может измениться без предупреждения
Используйте на свой страх и риск. Авторы не несут ответственности за любые последствия, включая, помимо прочего, действия, предпринятые Kagi в отношении вашего аккаунта.
Лицензия
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.
| Name | Required | Description | Default |
|---|---|---|---|
| queries | Yes | One or more concise, keyword-focused search queries. Include essential context within each query for standalone use. Supports Kagi operators: site:, -site:, filetype:/ext:, intitle:, inurl:, lang:, loc:, before:, after:, "exact phrase", +term, -term | |
| limit | No | Maximum number of results per query. Default: all available. |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It mentions numbering and that results are from all queries, but fails to disclose other behavioral traits such as pagination, caching, or auth requirements.
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, with three sentences that are front-loaded with purpose. Every sentence adds value without redundancy.
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 presence of an output schema, return values need not be explained. The description is adequate for basic usage, though it could mention rate limits or error handling for completeness.
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 the description adds meaning by specifying that queries should be concise and keyword-focused, with essential context. The limit parameter's default behavior is explained.
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 it fetches web results using Kagi Search, for general search and when the user explicitly asks to 'fetch'. It distinguishes from the sibling tool kagi_summarizer by focusing on search results rather than summaries.
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 explains when to use (general search, explicit fetch) and notes that results from all queries are numbered continuously. While it doesn't explicitly state when not to use, the sibling context implies summarization is separate.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
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.
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | A URL to a document to summarize. | |
| summary_type | No | Type of summary to produce. Options are 'summary' for paragraph prose and 'takeaway' for a bulleted list of key points. | summary |
| target_language | No | Desired output language using language codes (e.g., 'EN' for English). If not specified, the document's original language influences the output. | |
| engine | No | Summarizer engine to use. 'cecil' is the default. Note: This is an experimental feature — the summarizer endpoint may change without notice. | cecil |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full responsibility for behavioral disclosure. It clearly states the experimental nature, potential breakage, and support for various content types. It does not detail error handling or rate limits, but the explicit warning about instability adds significant transparency.
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 and structured: a clear purpose statement, a brief capability note, and a critical caution. Each sentence serves a purpose, though the capability note could be integrated into the first sentence.
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's 4 parameters and existing output schema (not shown), the description provides enough context to understand the tool's function and risks. However, it lacks guidance on error handling, prerequisites (e.g., need for a valid session token), and typical usage scenarios, which would enhance completeness.
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?
The input schema has 100% description coverage, so the baseline is 3. The description adds limited value, only restating the summary_type and engine options in a mildly explanatory way. It does not introduce new meaning beyond the schema's own 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 summarizes content from a URL using Kagi Summarizer, including support for various document types. It distinguishes from the sibling tool (kagi_search_fetch) by focusing on summarization rather than search, though no explicit comparison is made.
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 warns that the tool is experimental and may break due to internal API changes, which provides important context. However, it does not specify when to use this tool over alternatives or when not to use it, leaving the agent to infer from the sibling tool's purpose.
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.
2 tool updates
v0.2.1- First observed
kagi_search_fetch - First observed
kagi_summarizer
TDQS
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
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
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
Serper MCP — wraps the Serper Google Search API (serper.dev)
Agentic search over your Dewey document collections from any MCP-compatible client.
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
- AlicenseNot gradedqualityDmaintenanceFree web search MCP server using SearXNG, supporting web search, news search, and search summaries.MIT
- AlicenseNot gradedqualityDmaintenanceMCP server integrating the Kagi Search API to perform web searches using the kagi_search tool.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/KSroido/Kagi-Session2API-MCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server