kagi-kan-mcp
Unofficial 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.
README
kagi-ken-mcp
A lightweight Node MCP server around the kagi-ken package, providing access to Kagi.com services using Kagi session tokens:
- Search: Searches Kagi
- Summarizer: Uses Kagi's Summarizer to create summaries from URLs or text content
Unlike the official Kagi API which requires API access, this MCP server uses your existing Kagi session to access both search and summarization features.
"Kagi-ken" is a portmanteau of "Kagi" (the service) and "token".
Why?
The Kagi API requires a separate API key, which are invite-only at the moment. If you already have a Kagi subscription but no API access, yet want to programmatically access Kagi's services from LLMs or agents like Claude, this MCP server provides an alternative.
Features
- Search: Fetch web results using Kagi Search with concurrent query processing
- Summarization: Summarize content from URLs with customizable output types and languages
The server supports two methods for using your Kagi session token (see Installation), in this order:
KAGI_SESSION_TOKENenvironment variable~/.kagi_session_tokenfile containing the token string
It includes comprehensive error handling:
- Connection timeouts (10 seconds per search)
- Invalid input validation
- Environment variable validation
- Graceful error formatting
Installation
Node.js 22+ is required.
1. Get Kagi Session Token
- Visit Kagi Settings in your browser
- Copy the Session Link
- Extract the
tokenvalue from the link - Use that value as your session token: save to
~/.kagi_session_token(recommended), alternatively pass asKAGI_SESSION_TOKENenv variable
The server will automatically try the environment variable first, then fall back to the token file.
[!WARNING] Security Note: Keep your session token private. It provides access to your Kagi account.
2.a. Add MCP server to Claude Desktop
Add kagi-ken-mcp to your claude_desktop_config.json which you can open from the Claude Desktop app via Settings → Developer → Local MCP Servers → Edit Config.
Afterwards, disable Claude Desktop's built-in websearch so it'll use this here MCP server.
Method 1: Using token file (recommended)
{
"mcpServers": {
"kagi-ken-mcp": {
"command": "npx",
"args": ["-y", "github:czottmann/kagi-ken-mcp"]
}
}
}
Method 2: Using environment variable
{
"mcpServers": {
"kagi-ken-mcp": {
"command": "npx",
"args": ["-y", "github:czottmann/kagi-ken-mcp"],
"env": {
"KAGI_SESSION_TOKEN": "YOUR_SESSION_TOKEN_HERE"
}
}
}
}
2.b. Add MCP server to Claude Code
Method 1: Using token file (recommended)
claude mcp add kagi-ken-mcp --scope user -- npx -y github:czottmann/kagi-ken-mcp
Method 2: Using environment variable
claude mcp add kagi-ken-mcp \
--scope user \
--env KAGI_SESSION_TOKEN="YOUR_SESSION_TOKEN_HERE" -- \
npx -y github:czottmann/kagi-ken-mcp
To disable Claude Code's built-in web search (optional), set the permission in the relevant .claude/settings*.json file:
{
"permissions": {
"deny": [
"WebSearch"
],
"allow": [
"mcp__kagi-ken-mcp__kagi_search_fetch",
"mcp__kagi-ken-mcp__kagi_summarizer"
]
}
}
Usage: Pose query that requires use of a tool
e.g. "Who was time's 2024 person of the year?" for search, or "summarize this video: https://www.youtube.com/watch?v=sczwaYyaevY" for summarizer.
Tools
kagi_search_fetch
Fetch web results based on one or more queries using the Kagi Search API. Results are numbered continuously for easy reference.
Parameters:
queries(array of strings): One or more search queries
kagi_summarizer
Summarize content from URLs using the Kagi Summarizer API. Supports various document types including webpages, videos, and audio.
Parameters:
url(string): URL to summarizesummary_type(enum):"summary"for paragraph prose or"takeaway"for bullet points (default:"summary")target_language(string, optional): Language code (e.g.,"EN"for English, default:"EN")
Development
Project Structure
kagi-ken-mcp/
├── src/
│ ├── index.js # Main server entry point
│ ├── tools/
│ │ ├── search.js # Search tool implementation
│ │ └── summarizer.js # Summarizer tool implementation
│ └── utils/
│ └── formatting.js # Utility functions
├── package.json
└── README.md
Installation
-
Clone the repository:
git clone <repository-url> cd kagi-ken-mcp -
Install dependencies:
npm install
Running in Development Mode
npm run dev
Debugging
Use the MCP Inspector to debug:
npx @modelcontextprotocol/inspector node ./src/index.js
Then access the inspector at http://localhost:5173. If using environment variables, add your KAGI_SESSION_TOKEN in the environment variables section of the inspector.
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Test with the MCP Inspector
- Submit a pull request
Author
Carlo Zottmann, carlo@zottmann.dev, https://c.zottmann.dev, https://github.com/czottmann.
This project is neither affiliated with nor endorsed by Kagi. I'm just a very happy customer.
[!TIP] I make Shortcuts-related macOS & iOS productivity apps like Actions For Obsidian, Browser Actions (which adds Shortcuts support for several major browsers), and BarCuts (a surprisingly useful contextual Shortcuts launcher). Check them out!
Related Projects
- czottmann/kagi-ken - Unofficial session token-based Kagi client, Node
- czottmann/kagi-ken-cli - Unofficial Node session token-based CLI tool, Node
- Official Kagi MCP Server - Python
- Model Context Protocol
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。