Skip to main content
Glama

kagi-kan-mcp

by czottmann

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:

  1. KAGI_SESSION_TOKEN environment variable
  2. ~/.kagi_session_token file 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

  1. Visit Kagi Settings in your browser
  2. Copy the Session Link
  3. Extract the token value from the link
  4. Use that value as your session token: save to ~/.kagi_session_token (recommended), alternatively pass as KAGI_SESSION_TOKEN env 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.

{ "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

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 summarize
  • summary_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

  1. Clone the repository:
    git clone <repository-url> cd kagi-ken-mcp
  2. 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

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test with the MCP Inspector
  5. 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!

-
security - not tested
A
license - permissive license
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

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.

  1. Why?
    1. Features
      1. Installation
        1. 1. Get Kagi Session Token
        2. 2.a. Add MCP server to Claude Desktop
        3. 2.b. Add MCP server to Claude Code
      2. Usage: Pose query that requires use of a tool
        1. Tools
          1. kagi_search_fetch
          2. kagi_summarizer
        2. Development
          1. Project Structure
          2. Installation
          3. Running in Development Mode
          4. Debugging
          5. Contributing
        3. Author
          1. Related Projects

            Related MCP Servers

            • A
              security
              A
              license
              A
              quality
              An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
              Last updated -
              1
              155
              Python
              MIT License
              • Apple
              • Linux
            • A
              security
              A
              license
              A
              quality
              🔍 A Model Context Protocol (MCP) server providing unified access to multiple search engines (Tavily, Brave, Kagi), AI tools (Perplexity, FastGPT), and content processing services (Jina AI, Kagi). Combines search, AI responses, content processing, and enhancement features through a single interface.
              Last updated -
              15
              1,174
              161
              TypeScript
              MIT License
              • Linux
            • -
              security
              A
              license
              -
              quality
              MCP server for using various search tools like Tavily API. Planning to support various search tools (i.e. wiki search, searxng, etc)
              Last updated -
              3
              Python
              MIT License
              • Apple
              • Linux
            • A
              security
              A
              license
              A
              quality
              MCP server providing token-efficient access to OpenAPI/Swagger specs via MCP Resources for client-side exploration.
              Last updated -
              108
              37
              TypeScript
              MIT License

            View all related MCP servers

            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/czottmann/kagi-ken-mcp'

            If you have feedback or need assistance with the MCP directory API, please join our Discord server