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
Add this skill
npx mdskills install czottmann/kagi-ken-mcpWell-documented MCP server providing Kagi search and summarization with clear setup and token management
1# kagi-ken-mcp23A lightweight Node MCP server around the [`kagi-ken` package](https://github.com/czottmann/kagi-ken), providing access to Kagi.com services using Kagi session tokens:45- **Search**: Searches Kagi6- **Summarizer**: Uses Kagi's Summarizer to create summaries from URLs or text content78Unlike the official Kagi API which requires API access, this MCP server uses your existing Kagi session to access both search and summarization features.910_"Kagi-ken"_ is a portmanteau of _"Kagi"_ (the service) and _"token"_.111213## Why?1415The [Kagi API](https://help.kagi.com/kagi/api/overview.html) 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.161718## Features1920- **Search**: Fetch web results using Kagi Search with concurrent query processing21- **Summarization**: Summarize content from URLs with customizable output types and languages2223The server supports two methods for using your Kagi session token (see [Installation](#installation)), in this order:24251. `KAGI_SESSION_TOKEN` environment variable262. `~/.kagi_session_token` file containing the token string2728It includes comprehensive error handling:2930- Connection timeouts (10 seconds per search)31- Invalid input validation32- Environment variable validation33- Graceful error formatting3435<a href="https://glama.ai/mcp/servers/@czottmann/kagi-ken-mcp">36 <img width="380" height="200" src="https://glama.ai/mcp/servers/@czottmann/kagi-ken-mcp/badge" alt="kagi-kan-mcp MCP server" />37</a>383940## Installation4142Node.js 22+ is required.4344### 1. Get Kagi Session Token45461. Visit [Kagi Settings](https://kagi.com/settings/user_details) in your browser472. Copy the **Session Link**483. Extract the `token` value from the link494. Use that value as your session token: save to `~/.kagi_session_token` (recommended), alternatively pass as `KAGI_SESSION_TOKEN` env variable5051The server will automatically try the environment variable first, then fall back to the token file.5253> [!WARNING]54> **Security Note**: Keep your session token private. It provides access to your Kagi account.5556### 2.a. Add MCP server to Claude Desktop5758Add 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.5960#### Option 1: Using token file (recommended)61```json62{63 "mcpServers": {64 "kagi-ken-mcp": {65 "command": "npx",66 "args": ["-y", "github:czottmann/kagi-ken-mcp"]67 }68 }69}70```7172#### Option 2: Using environment variable73```json74{75 "mcpServers": {76 "kagi-ken-mcp": {77 "command": "npx",78 "args": ["-y", "github:czottmann/kagi-ken-mcp"],79 "env": {80 "KAGI_SESSION_TOKEN": "YOUR_SESSION_TOKEN_HERE"81 }82 }83 }84}85```8687#### Post-install8889[Disable Claude Desktop's built-in websearch](assets/claude-desktop-disable-websearch.png) so it'll use this here MCP server. And maybe add this to your "Personal preferences" (i.e., system prompt) in Settings:9091```92For web searches, use kagi-ken-mcp MCP server's `kagi_search_fetch` tool.93For summarizing a URL, use the kagi-ken-mcp MCP server's `kagi_summarizer` tool.94```9596### 2.b. Add MCP server to Claude Code9798#### Option 1: Using token file (recommended)99100```bash101claude mcp add kagi-ken-mcp --scope user -- npx -y github:czottmann/kagi-ken-mcp102```103104#### Option 2: Using environment variable105106```bash107claude mcp add kagi-ken-mcp \108 --scope user \109 --env KAGI_SESSION_TOKEN="YOUR_SESSION_TOKEN_HERE" -- \110 npx -y github:czottmann/kagi-ken-mcp111```112113#### Post-install114115Disable Claude Code's built-in web search (optional) by setting the permission in the relevant `.claude/settings*.json` file:116117```json118{119 "permissions": {120 "deny": [121 "WebSearch"122 ],123 "allow": [124 "mcp__kagi-ken-mcp__kagi_search_fetch",125 "mcp__kagi-ken-mcp__kagi_summarizer"126 ]127 }128}129```130131132## Usage: Pose query that requires use of a tool133134e.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.135136137## Tools138139### `kagi_search_fetch`140Fetch web results based on one or more queries using the Kagi Search API. Results are numbered continuously for easy reference.141142**Parameters:**143- `queries` (array of strings): One or more search queries144145### `kagi_summarizer`146Summarize content from URLs using the Kagi Summarizer API. Supports various document types including webpages, videos, and audio.147148**Parameters:**149- `url` (string): URL to summarize150- `summary_type` (enum): `"summary"` for paragraph prose or `"takeaway"` for bullet points (default: `"summary"`)151- `target_language` (string, optional): Language code (e.g., `"EN"` for English, default: `"EN"`)152153154## Development155156### Project Structure157```158kagi-ken-mcp/159├── src/160│ ├── index.js # Main server entry point161│ ├── tools/162│ │ ├── search.js # Search tool implementation163│ │ └── summarizer.js # Summarizer tool implementation164│ └── utils/165│ └── formatting.js # Utility functions166├── package.json167└── README.md168```169170### Installation1711721. **Clone the repository:**173 ```bash174 git clone <repository-url>175 cd kagi-ken-mcp176 ```1771782. **Install dependencies:**179 ```bash180 npm install181 ```182183### Running in Development Mode184```bash185npm run dev186```187188### Debugging189190Use the MCP Inspector to debug:191```bash192npx @modelcontextprotocol/inspector node ./src/index.js193```194195Then access the inspector at `http://localhost:5173`. If using environment variables, add your `KAGI_SESSION_TOKEN` in the environment variables section of the inspector.196197### Contributing1981991. Fork the repository2002. Create a feature branch2013. Make your changes2024. Test with the MCP Inspector2035. Submit a pull request204205206## Author207208Carlo Zottmann, <carlo@zottmann.dev>, https://c.zottmann.dev, https://github.com/czottmann.209210This project is neither affiliated with nor endorsed by Kagi. I'm just a very happy customer.211212> [!TIP]213> I make Shortcuts-related macOS & iOS productivity apps like [Actions For Obsidian](https://actions.work/actions-for-obsidian), [Browser Actions](https://actions.work/browser-actions) (which adds Shortcuts support for several major browsers), and [BarCuts](https://actions.work/barcuts) (a surprisingly useful contextual Shortcuts launcher). Check them out!214215216## Related Projects217218- [czottmann/kagi-ken](https://github.com/czottmann/kagi-ken) - Unofficial session token-based Kagi client, Node219- [czottmann/kagi-ken-cli](https://github.com/czottmann/kagi-ken-cli) - Unofficial Node session token-based CLI tool, Node220- [Official Kagi MCP Server](https://github.com/kagisearch/kagimcp) - Python221- [Model Context Protocol](https://modelcontextprotocol.io/)222
Full transparency — inspect the skill content before installing.