MCPInstall

kagi-session2api-mcp-server

Free Kagi Search MCP server using session tokens for web search and URL summarization in AI coding agents

Installs
207
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/reason-machines/mcp-skills --skill kagi-session2api-mcp-server
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads kagi-session2api-mcp-server automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

Kagi Session2API MCP Server

Skill by ara.so — MCP Skills collection.

This MCP server provides free access to Kagi search and summarizer features using session tokens instead of paid API keys. It works with Claude Desktop, Cursor, Windsurf, Cline, and any MCP-compatible client.

What It Does

  • kagi_search_fetch: Performs web searches using Kagi's search engine
  • kagi_summarizer: Summarizes any URL using Kagi's summarization engines
  • Multi-token pooling: Supports multiple session tokens with round-robin rotation for higher throughput
  • Rate limiting: Built-in 5 req/s per token with automatic expired token detection
  • Search operators: Full support for Kagi search operators (site:, lang:, filetype:, etc.)

Installation

Quick Install (Recommended)

pip install kagi-session2api-mcp

Or use uvx for isolated execution:

uvx kagi-session2api-mcp

Getting Your Session Token

  1. Log in to kagi.com
  2. Navigate to Settings → Account → Session Link
  3. Copy the token from the session URL: https://kagi.com/search?token=YOUR_TOKEN_HERE&q=test
  4. Store this token securely (treat it like a password)

Configuration

Single Token Setup (Claude Desktop)

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "kagi-session": {
      "command": "uvx",
      "args": ["kagi-session2api-mcp"],
      "env": {
        "KAGI_SESSION_TOKEN": "YOUR_SESSION_TOKEN_HERE"
      }
    }
  }
}

Multiple Tokens (Environment Variable)

For higher throughput with token rotation:

{
  "mcpServers": {
    "kagi-session": {
      "command": "uvx",
      "args": ["kagi-session2api-mcp"],
      "env": {
        "KAGI_SESSION_TOKENS": "TOKEN_1,TOKEN_2,TOKEN_3"
      }
    }
  }
}

Multiple Tokens (Config File - Recommended)

Create ~/.config/kagi-session2api-mcp/config.toml:

[kagi]
session_tokens = [
    "YOUR_TOKEN_1_HERE",
    "YOUR_TOKEN_2_HERE",
    "YOUR_TOKEN_3_HERE"
]

# Summarizer engine: cecil (default), agnes, daphne, muriel
summarizer_engine = "cecil"

[client]
timeout = 30
max_retries = 2

Reference in MCP config:

{
  "mcpServers": {
    "kagi-session": {
      "command": "uvx",
      "args": ["kagi-session2api-mcp"],
      "env": {
        "KAGI_SESSION_CONFIG": "/home/user/.config/kagi-session2api-mcp/config.toml"
      }
    }
  }
}

Cursor/Windsurf Configuration

Add to .cursor/mcp.json or Windsurf settings:

{
  "mcpServers": {
    "kagi-session": {
      "command": "uvx",
      "args": ["kagi-session2api-mcp"],
      "env": {
        "KAGI_SESSION_TOKEN": "YOUR_SESSION_TOKEN_HERE"
      }
    }
  }
}

Using the Tools

Web Search (kagi_search_fetch)

Basic search:

Search for "Python asyncio best practices"

The tool returns structured results with:

  • Title
  • URL
  • Snippet
  • Published date (if available)

Search with Operators

Kagi supports powerful search operators:

Search for: site:github.com Python MCP server
Find: "async programming" filetype:pdf lang:en
Look up: React hooks -site:reddit.com after:2024-01-01

Available operators:

  • site:domain.com - Restrict to specific domain
  • -site:domain.com - Exclude domain
  • filetype:pdf - Filter by file type (pdf, doc, ppt, etc.)
  • intitle:keyword - Search in page titles
  • lang:en - Language filter (en, zh, es, etc.)
  • before:2024-01-01 - Results before date
  • after:2024-01-01 - Results after date
  • "exact phrase" - Exact phrase match

URL Summarization (kagi_summarizer)

Basic summarization:

Summarize https://example.com/long-article

With options:

# In tool call parameters:
{
  "url": "https://example.com/article",
  "summary_type": "takeaway",  # "summary" (prose) or "takeaway" (bullets)
  "engine": "cecil",            # cecil, agnes, daphne, muriel
  "target_language": "EN"       # Language code
}

Summarizer engines:

  • cecil (default): Balanced, general-purpose
  • agnes: Fast, concise
  • daphne: Detailed, thorough
  • muriel: Technical, precise

Common Patterns

Research Assistant Pattern

Search for recent papers on: site:arxiv.org "neural networks" after:2024-01-01

Then summarize the most relevant:

Summarize https://arxiv.org/abs/2401.12345 with engine daphne

Code Documentation Search

Search for: site:docs.python.org asyncio after:2023-01-01

News Aggregation

Find latest news: "AI regulation" lang:en after:2024-05-01 -site:twitter.com

Technical Resource Discovery

Search: "Docker best practices" filetype:pdf OR site:github.com

Transport Modes

Stdio (Default for Desktop Clients)

kagi-session2api-mcp

HTTP Server (Remote Access)

kagi-session2api-mcp --http --host 0.0.0.0 --port 8000

Then connect via HTTP:

{
  "mcpServers": {
    "kagi-session": {
      "url": "http://localhost:8000"
    }
  }
}

Troubleshooting

"Token expired" or 401 errors

  • Session tokens expire after a period of inactivity
  • Get a new token from Kagi settings
  • Update your configuration with the new token
  • Expired tokens are automatically disabled in multi-token pools

"Rate limit exceeded"

  • Each token is limited to 5 requests/second
  • Add more tokens to increase throughput
  • With N tokens, effective rate = 5×N req/s

No search results returned

  • Check if your query is properly formatted
  • Try without operators first
  • Verify the token is valid (test on kagi.com)
  • Check network connectivity

Summarizer fails

  • Ensure the URL is publicly accessible
  • Some sites block automated access
  • Try a different summarizer engine
  • The summarizer uses an internal Kagi endpoint that may change

MCP client can't find the server

  • Restart your MCP client (Claude Desktop, Cursor, etc.)
  • Check the config file path is correct
  • Verify uvx or python is in PATH
  • Check logs in MCP client for error messages

Python version issues

  • Requires Python 3.10+
  • Check version: python --version
  • Use uv for automatic version management: uvx kagi-session2api-mcp

Security Considerations

⚠️ Important Security Notes:

  1. Never commit tokens to version control - Use environment variables or config files outside your repo
  2. Treat session tokens like passwords - They provide full account access
  3. Use separate tokens per machine - If compromised, only one session is affected
  4. Rotate tokens periodically - Generate new ones from Kagi settings
  5. Monitor account activity - Check Kagi account for unexpected usage

Rate Limiting Behavior

TokensPer-Token RateTotal Throughput
15 req/s5 req/s
25 req/s10 req/s
55 req/s25 req/s

The server uses a token bucket algorithm with automatic round-robin rotation. When one token is rate-limited, the next token in the pool is used immediately.

Programmatic Usage (Python)

While primarily an MCP server, you can also use it as a Python library:

import asyncio
from kagi_session2api_mcp import KagiClient

async def main():
    client = KagiClient(session_token="YOUR_TOKEN")
    
    # Search
    results = await client.search("Python asyncio")
    for result in results:
        print(f"{result['title']}: {result['url']}")
    
    # Summarize
    summary = await client.summarize(
        url="https://example.com/article",
        summary_type="takeaway",
        engine="cecil"
    )
    print(summary)

asyncio.run(main())

Comparison with Official kagimcp

Featurekagi-session2api-mcpOfficial kagimcp
CostFree (session token)$25/1000 queries
AuthenticationSession tokenAPI key
Rate limitingClient-side (5 req/s)Server-side
Multi-token✅ SupportedN/A
API balanceNot availableAvailable
StabilityDepends on HTML structureOfficial API

Legal and Risk Warnings

⚠️ Use at your own risk:

  • Using session tokens may violate Kagi's Terms of Service
  • Potential consequences: account suspension or permanent ban
  • Kagi may change HTML structure, breaking functionality
  • Authors assume no liability for account actions or data loss
  • Not affiliated with or endorsed by Kagi

This tool is for educational and personal use. Consider purchasing official API access for production use.

FAQ

What does the kagi-session2api-mcp-server skill do?

Free Kagi Search MCP server using session tokens for web search and URL summarization in AI coding agents

How do I install kagi-session2api-mcp-server?

Run npx skills add https://github.com/reason-machines/mcp-skills --skill kagi-session2api-mcp-server in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/kagi-session2api-mcp-server/ (personal) or .claude/skills/kagi-session2api-mcp-server/ (project).

Which AI agents can use kagi-session2api-mcp-server?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is kagi-session2api-mcp-server safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains kagi-session2api-mcp-server?

It is published by reason-machines in reason-machines/mcp-skills. It has 207 recorded installs.

More from reason-machines/mcp-skills

View all →

codebase-memory-mcp-intelligence

reason-machines/mcp-skills

High-performance code intelligence MCP server that indexes codebases into knowledge graphs for structural queries, call traces, and architecture analysis

AI & Agents505 installs

playwright-mcp-server

reason-machines/mcp-skills

Open the skill to read its SKILL.md instructions.

AI & Agents272 installs

tradingview-mcp-assistant

reason-machines/mcp-skills

Open the skill to read its SKILL.md instructions.

AI & Agents256 installs

lanhu-mcp-collaboration

reason-machines/mcp-skills

Open the skill to read its SKILL.md instructions.

AI & Agents245 installs

github-mcp-server

reason-machines/mcp-skills

Open the skill to read its SKILL.md instructions.

AI & Agents237 installs

google-meta-ads-ga4-mcp

reason-machines/mcp-skills

Open the skill to read its SKILL.md instructions.

AI & Agents233 installs

Popular ai & agents skills

View category →

google-agents-cli-publish

google/agents-cli

This skill should be used when the user wants to "publish an agent", "publish my ADK agent", "register an agent with Gemini", "publish to Gemini" (formerly Gemini Enterprise), or needs guidance on the agents-cli publish gemini command. Also use when the user wants to "manage agents in Agent Registry", "list/update/delete registered agents", or "register an MCP server". Covers ADK vs A2A registration modes, programmatic and interactive usage, flag reference, auto-detection from deployment metadata, Agent Registry fleet management, and troubleshooting. Part of the agents-cli skills suite. Do NOT use for deployment (use google-agents-cli-deploy).

AI & Agents513.9K installs

google-agents-cli-eval

google/agents-cli

This skill should be used when the user wants to "run an evaluation", "evaluate my agent", "evaluate my ADK agent", "write an eval dataset", "analyze eval failures", "compare eval results", "optimize agent", or needs guidance on the Gemini platform eval methodology and the Quality Flywheel. Covers eval metrics, dataset schema, LLM-as-judge scoring, and common failure causes. Applies to any agents-cli project, whatever framework the agent is written in. Do NOT use for agent API code patterns (ADK: use google-agents-cli-adk-code), deployment (use google-agents-cli-deploy), or project scaffolding (use google-agents-cli-scaffold).

AI & Agents513.5K installs

skill-creator

anthropics/skills

Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.

OfficialAI & Agents416.4K installs

codex-pet

prime-skills/runcomfy-agent-skills

Codex Pet generator on RunComfy. Build a Codex-compatible Codex Pet spritesheet.webp + pet.json from a single reference image, drop it into ${CODEXHOME:-$HOME/.codex}/pets/ / and Codex picks it up as a custom Codex Pet next to the 8 built-ins. This skill produces the exact Codex Pet atlas Codex expects (1536x1872 PNG/WebP, 8 cols x 9 rows, 192x208 cells, 9 animation states — idle, running-right, running-left, waving, jumping, failed, waiting, running, review). Calls OpenAI GPT Image 2 edit ONCE via the local RunComfy CLI as runcomfy run openai/gpt-image-2/edit to produce a canonical Codex Pet pose, then assembles all 9 animation rows programmatically with ImageMagick micro-transforms — no Codex Pro, no $imagegen, no OPENAIAPIKEY required, only RUNCOMFYTOKEN. Triggers on "codex pet", "create codex pet", "make codex pet", "hatch codex pet", "/hatch image", "desktop pet codex", "codex pets", "spritesheet.webp", or any explicit ask to build a custom pet for OpenAI Codex.

AI & Agents402.1K installs

full-output-enforcement

leonxlnx/taste-skill

Overrides default LLM truncation behavior. Enforces complete code generation, bans placeholder patterns, and handles token-limit splits cleanly. Apply to any task requiring exhaustive, unabridged output.

AI & Agents401K installs

executing-plans

obra/superpowers

Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available

AI & Agents245.7K installs