[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-140":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":14,"stars30d":16,"stars90d":15,"forks30d":15,"starsTrendScore":15,"compositeScore":17,"rankGlobal":10,"rankLanguage":10,"license":10,"archived":18,"fork":18,"defaultBranch":19,"hasWiki":20,"hasPages":18,"topics":21,"createdAt":10,"pushedAt":10,"updatedAt":34,"readmeContent":35,"aiSummary":36,"trendingCount":15,"starSnapshotCount":15,"syncStatus":37,"lastSyncTime":38,"discoverSource":39},140,"Kagi-Session2API-MCP","KSroido\u002FKagi-Session2API-MCP","KSroido","Free Kagi Search MCP server — access search and summarizer via session tokens, no API key needed. Works with Claude Desktop, Cursor, Windsurf, Hermes and any MCP client.","",null,"Python",137,12,1,0,4,3.34,false,"main",true,[22,23,24,25,26,27,28,29,30,31,32,33],"ai-agent","ai-coding","claude-desktop","cursor","kagi","llm","mcp","mcp-server","model-context-protocol","search","summarizer","web-search","2026-06-12 02:00:08","\u003Cdiv align=\"center\">\n\n# Kagi Session2API MCP Server\n\n**Free Kagi Search MCP server — session tokens, no API key needed**\n\n[![PyPI version](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fkagi-session2api-mcp.svg)](https:\u002F\u002Fpypi.org\u002Fproject\u002Fkagi-session2api-mcp\u002F)\n[![PyPI downloads](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fdm\u002Fkagi-session2api-mcp.svg)](https:\u002F\u002Fpypi.org\u002Fproject\u002Fkagi-session2api-mcp\u002F)\n[![GitHub stars](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002FKSroido\u002FKagi-Session2API-MCP?style=social)](https:\u002F\u002Fgithub.com\u002FKSroido\u002FKagi-Session2API-MCP\u002Fstargazers)\n[![GitHub license](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Flicense\u002FKSroido\u002FKagi-Session2API-MCP)](LICENSE)\n[![Python Version](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FPython-3.10%2B-3776AB?logo=python)](https:\u002F\u002Fpython.org\u002F)\n\n**[English](README.md)** | [中文文档](README_ZH.md)\n\n\u003C\u002Fdiv>\n\n---\n\n> Access Kagi search and summarizer via session tokens — completely free. Works with Claude Desktop, Cursor, Windsurf, Cline, Hermes and any MCP-compatible AI coding assistant\u002Fagent.\n\n## ⭐ Star History\n\n[![Star History Chart](https:\u002F\u002Fapi.star-history.com\u002Fsvg?repos=KSroido\u002FKagi-Session2API-MCP&type=Date)](https:\u002F\u002Fstar-history.com\u002F#KSroido\u002FKagi-Session2API-MCP&Date)\n\n> **⚠️ EndUser Warning**: This project uses Kagi session tokens to access search and summarizer features without the official paid API. This may violate [Kagi's Terms of Service](https:\u002F\u002Fkagi.com\u002Fterms). Potential consequences include account suspension or permanent ban. **Use at your own risk.** The authors assume no liability for any account actions taken by Kagi.\n>\n> **⚠️ Security Warning**: Your Kagi session token provides full account access. Treat it like a password. Never share it or commit it to version control.\n\n## 🌟 Features\n\n- **Session-based access**: Uses Kagi session tokens instead of the official API ($25\u002F1000 queries) — completely free\n- **Multi-token pool**: Configure multiple tokens for higher throughput with round-robin rotation\n- **Per-token rate limiting**: 5 req\u002Fs per token with token bucket algorithm\n- **API-compatible output**: Returns results in the same format as the official `kagimcp`\n- **Two tools**: `kagi_search_fetch` (web search) and `kagi_summarizer` (URL summarization)\n- **Firefox UA spoofing**: Mimics a real Firefox browser for session-based access\n- **Auto-disable expired tokens**: Expired tokens are automatically detected and skipped\n- **Search operators**: Supports Kagi operators (`site:`, `lang:`, `filetype:`, etc.)\n\n## Compatible Platforms\n\nWorks with any MCP-compatible client:\n\n- [Claude Desktop](https:\u002F\u002Fclaude.ai\u002Fdesktop)\n- [Cursor](https:\u002F\u002Fcursor.sh)\n- [Windsurf](https:\u002F\u002Fcodeium.com\u002Fwindsurf)\n- [Cline](https:\u002F\u002Fcline.bot)\n- [Hermes Agent](https:\u002F\u002Fgithub.com\u002Fnousresearch\u002Fhermes)\n- Any MCP client supporting `stdio` or `HTTP` transport\n\n## Quick Install (For AI Agents)\n\nJust paste this prompt to your AI agent:\n\n```\nInstall the Kagi Session2API MCP server from https:\u002F\u002Fpypi.org\u002Fproject\u002Fkagi-session2api-mcp\u002F.\nThen add it to my MCP:\n`uvx kagi-session2api-mcp`\nset env KAGI_SESSION_TOKEN to my token (ask me if you don't have it).\nIf I have multiple tokens, use KAGI_SESSION_TOKENS (comma-separated) instead,\nor create a config file at ~\u002F.config\u002Fkagi-session2api-mcp\u002Fconfig.toml with:\n[kagi]\nsession_tokens = [\"TOKEN_1\", \"TOKEN_2\"]\nsummarizer_engine = \"cecil\"\n[client]\ntimeout = 30\nmax_retries = 2\nand set env KAGI_SESSION_CONFIG to that path.\n```\n\n## Install Manually\n\n```bash\npip install kagi-session2api-mcp\n```\n\nOr with `uvx`:\n```bash\nuvx kagi-session2api-mcp\n```\n\n## Configuration\n\n### Option 1: Environment Variable (Single Token)\n\n```json\n{\n  \"mcpServers\": {\n    \"kagi-session\": {\n      \"command\": \"uvx\",\n      \"args\": [\"kagi-session2api-mcp\"],\n      \"env\": {\n        \"KAGI_SESSION_TOKEN\": \"YOUR_SESSION_TOKEN_HERE\"\n      }\n    }\n  }\n}\n```\n\n### Option 2: Environment Variable (Multiple Tokens)\n\n```json\n{\n  \"mcpServers\": {\n    \"kagi-session\": {\n      \"command\": \"uvx\",\n      \"args\": [\"kagi-session2api-mcp\"],\n      \"env\": {\n        \"KAGI_SESSION_TOKENS\": \"TOKEN_1,TOKEN_2,TOKEN_3\"\n      }\n    }\n  }\n}\n```\n\n### Option 3: Config File (Recommended for Multi-Token)\n\nCreate `~\u002F.config\u002Fkagi-session2api-mcp\u002Fconfig.toml`:\n\n```toml\n[kagi]\nsession_tokens = [\n    \"YOUR_TOKEN_1_HERE\",\n    \"YOUR_TOKEN_2_HERE\",\n]\n\nsummarizer_engine = \"cecil\"\n\n[client]\ntimeout = 30\nmax_retries = 2\n```\n\nThen configure:\n```json\n{\n  \"mcpServers\": {\n    \"kagi-session\": {\n      \"command\": \"uvx\",\n      \"args\": [\"kagi-session2api-mcp\"],\n      \"env\": {\n        \"KAGI_SESSION_CONFIG\": \"\u002Fpath\u002Fto\u002Fconfig.toml\"\n      }\n    }\n  }\n}\n```\n\n## Getting Your Session Token\n\n1. Log in to [kagi.com](https:\u002F\u002Fkagi.com)\n2. Go to **Settings → Account → Session Link**\n3. Copy the token from the session URL: `https:\u002F\u002Fkagi.com\u002Fsearch?token={THIS_PART}&q=test`\n4. Use this token in your configuration\n\n## Usage\n\n### MCP Tools\n\n#### `kagi_search_fetch`\n\nSearch the web using Kagi:\n\n```\nSearch for \"Python async tutorial\"\n```\n\nSupports Kagi search operators:\n- `site:github.com` - Restrict to domain\n- `-site:reddit.com` - Exclude domain\n- `filetype:pdf` - File type filter\n- `intitle:python` - Title filter\n- `lang:zh` - Language filter\n- `before:2024-01-01` \u002F `after:2024-01-01` - Date filters\n- `\"exact phrase\"` - Exact match\n\n#### `kagi_summarizer`\n\nSummarize any URL:\n\n```\nSummarize https:\u002F\u002Fexample.com\u002Farticle\n```\n\nOptions:\n- `summary_type`: \"summary\" (prose) or \"takeaway\" (bullet points)\n- `engine`: \"cecil\" (default), \"agnes\", \"daphne\", \"muriel\"\n- `target_language`: Language code (e.g., \"EN\")\n\n> ⚠️ The summarizer is experimental — it uses Kagi's internal endpoint which may change.\n\n### Transport Modes\n\n**Stdio** (default, for Claude Desktop):\n```bash\nkagi-session2api-mcp\n```\n\n**HTTP** (for remote access):\n```bash\nkagi-session2api-mcp --http --host 0.0.0.0 --port 8000\n```\n\n## Architecture\n\n```\nMCP Client → FastMCP Server → TokenPool (round-robin) → httpx.AsyncClient → kagi.com\n                                ↓\n                          TokenBucket (5 req\u002Fs per token)\n                                ↓\n                          Auto-disable expired tokens\n```\n\n## Token Pool Behavior\n\n| Config | Rate Limit | Effective Rate |\n|--------|-----------|----------------|\n| 1 token | 5 req\u002Fs | 5 req\u002Fs |\n| 2 tokens | 5 req\u002Fs each | 10 req\u002Fs |\n| N tokens | 5 req\u002Fs each | 5×N req\u002Fs |\n\nWhen a token expires (detected via 401\u002F403 or redirect to login), it is automatically disabled. Remaining tokens continue serving requests.\n\n## Differences from Official `kagimcp`\n\n| Aspect | Official `kagimcp` | `kagi-session2api-mcp` |\n|--------|-------------------|-------------------|\n| Authentication | API key ($25\u002F1000) | Session token (free) |\n| Search endpoint | `\u002Fapi\u002Fv0\u002Fsearch` | `\u002Fhtml\u002Fsearch` (HTML scraping) |\n| Summarizer | `\u002Fapi\u002Fv0\u002Fsummarize` | `\u002Fmother\u002Fsummary_labs` (internal) |\n| Rate limiting | Server-side | Client-side (token bucket) |\n| `api_balance` | Returns balance | Always `null` |\n| Cost | Paid | Free (uses existing session) |\n\n## Risks\n\n- Kagi may change their HTML structure, breaking the parser\n- Session-based access may violate Kagi's Terms of Service\n- Account suspension or permanent ban is possible\n- The summarizer endpoint is internal and may change without notice\n- **Use at your own risk.** The authors assume no liability for any consequences, including but not limited to account actions taken by Kagi.\n\n## License\n\nMIT\n","Kagi Session2API MCP 服务器提供了一个免费的 Kagi 搜索和摘要服务，无需 API 密钥，通过会话令牌访问。该项目的核心功能包括基于会话的访问、多令牌池配置以提高吞吐量、每令牌速率限制以及与官方 `kagimcp` 输出格式兼容的 API。此外，它还支持 Firefox 用户代理伪装、自动禁用过期令牌及搜索操作符。适用于任何兼容 MCP 的客户端，如 Claude Desktop、Cursor、Windsurf 和 Hermes 等，特别适合需要集成搜索或摘要功能但不想支付高昂 API 费用的开发者。需要注意的是，使用此项目可能违反 Kagi 的服务条款，用户需自行承担风险。",2,"2026-06-11 02:31:03","CREATED_QUERY"]