Skip to main content
Glama
KSroido

kagi-session2api-mcp

by KSroido

Kagi Session2API MCP 서버

무료 Kagi 검색 MCP(Model Context Protocol) 서버 — 공식 유료 API 없이 세션 토큰을 통해 Kagi 검색 및 요약 기능을 사용하세요. Claude Desktop, Cursor, Windsurf, Cline, Hermes 및 모든 MCP 호환 AI 코딩 어시스턴트/에이전트와 함께 작동합니다.

English | 中文文档

⚠️ 사용자 주의사항: 이 프로젝트는 공식 유료 API 없이 Kagi 세션 토큰을 사용하여 검색 및 요약 기능에 액세스합니다. 이는 Kagi 서비스 약관을 위반할 수 있습니다. 계정 정지 또는 영구 차단과 같은 결과가 발생할 수 있습니다. 사용 시 위험은 본인이 감수해야 합니다. 작성자는 Kagi에 의해 취해진 어떠한 계정 조치에 대해서도 책임을 지지 않습니다.

⚠️ 보안 주의사항: Kagi 세션 토큰은 전체 계정 액세스 권한을 제공합니다. 비밀번호처럼 취급하십시오. 절대 공유하거나 버전 관리 시스템에 커밋하지 마십시오.

기능

  • 세션 기반 액세스: 공식 API($25/1000 쿼리) 대신 Kagi 세션 토큰을 사용하여 완전히 무료로 이용 가능

  • 멀티 토큰 풀: 라운드 로빈 방식으로 여러 토큰을 구성하여 더 높은 처리량 확보

  • 토큰별 속도 제한: 토큰 버킷 알고리즘을 사용하여 토큰당 초당 5회 요청 제한

  • API 호환 출력: 공식 kagimcp와 동일한 형식으로 결과 반환

  • 두 가지 도구: kagi_search_fetch(웹 검색) 및 kagi_summarizer(URL 요약)

  • Firefox UA 스푸핑: 세션 기반 액세스를 위해 실제 Firefox 브라우저를 모방

  • 만료된 토큰 자동 비활성화: 만료된 토큰을 자동으로 감지하고 건너뜀

  • 검색 연산자: Kagi 연산자(site:, lang:, filetype: 등) 지원

Related MCP server: Kagi MCP Server

호환 플랫폼

MCP 호환 클라이언트라면 무엇이든 작동합니다:

빠른 설치 (AI 에이전트용)

AI 에이전트에 다음 프롬프트를 붙여넣기만 하면 됩니다:

Install the Kagi Session2API MCP server from https://pypi.org/project/kagi-session2api-mcp/.
Then add it to my MCP:
`uvx kagi-session2api-mcp`
set env KAGI_SESSION_TOKEN to my token (ask me if you don't have it).
If I have multiple tokens, use KAGI_SESSION_TOKENS (comma-separated) instead,
or create a config file at ~/.config/kagi-session2api-mcp/config.toml with:
[kagi]
session_tokens = ["TOKEN_1", "TOKEN_2"]
summarizer_engine = "cecil"
[client]
timeout = 30
max_retries = 2
and set env KAGI_SESSION_CONFIG to that path.

수동 설치

pip install kagi-session2api-mcp

또는 uvx 사용:

uvx kagi-session2api-mcp

구성

옵션 1: 환경 변수 (단일 토큰)

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

옵션 2: 환경 변수 (다중 토큰)

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

옵션 3: 구성 파일 (다중 토큰 권장)

~/.config/kagi-session2api-mcp/config.toml 파일을 생성합니다:

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

summarizer_engine = "cecil"

[client]
timeout = 30
max_retries = 2

그런 다음 구성합니다:

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

세션 토큰 가져오기

  1. kagi.com에 로그인합니다.

  2. **설정(Settings) → 계정(Account) → 세션 링크(Session Link)**로 이동합니다.

  3. 세션 URL에서 토큰을 복사합니다: https://kagi.com/search?token={이 부분}&q=test

  4. 이 토큰을 구성에 사용합니다.

사용법

MCP 도구

kagi_search_fetch

Kagi를 사용하여 웹 검색:

Search for "Python async tutorial"

Kagi 검색 연산자 지원:

  • site:github.com - 도메인 제한

  • -site:reddit.com - 도메인 제외

  • filetype:pdf - 파일 형식 필터

  • intitle:python - 제목 필터

  • lang:zh - 언어 필터

  • before:2024-01-01 / after:2024-01-01 - 날짜 필터

  • "exact phrase" - 정확히 일치하는 구문

kagi_summarizer

URL 요약:

Summarize https://example.com/article

옵션:

  • summary_type: "summary"(산문) 또는 "takeaway"(글머리 기호)

  • engine: "cecil"(기본값), "agnes", "daphne", "muriel"

  • target_language: 언어 코드 (예: "EN")

⚠️ 요약기는 실험적 기능이며, 변경될 수 있는 Kagi의 내부 엔드포인트를 사용합니다.

전송 모드

Stdio (기본값, Claude Desktop용):

kagi-session2api-mcp

HTTP (원격 액세스용):

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

아키텍처

MCP Client → FastMCP Server → TokenPool (round-robin) → httpx.AsyncClient → kagi.com
                                ↓
                          TokenBucket (5 req/s per token)
                                ↓
                          Auto-disable expired tokens

토큰 풀 동작

구성

속도 제한

유효 속도

1개 토큰

초당 5회 요청

초당 5회 요청

2개 토큰

각각 초당 5회 요청

초당 10회 요청

N개 토큰

각각 초당 5회 요청

초당 5×N회 요청

토큰이 만료되면(401/403 또는 로그인 페이지로 리디렉션되어 감지됨) 자동으로 비활성화됩니다. 나머지 토큰은 계속해서 요청을 처리합니다.

공식 kagimcp와의 차이점

측면

공식 kagimcp

kagi-session2api-mcp

인증

API 키 ($25/1000)

세션 토큰 (무료)

검색 엔드포인트

/api/v0/search

/html/search (HTML 스크래핑)

요약기

/api/v0/summarize

/mother/summary_labs (내부)

속도 제한

서버 측

클라이언트 측 (토큰 버킷)

api_balance

잔액 반환

항상 null

비용

유료

무료 (기존 세션 사용)

위험 요소

  • Kagi가 HTML 구조를 변경하면 파서가 작동하지 않을 수 있습니다.

  • 세션 기반 액세스는 Kagi 서비스 약관을 위반할 수 있습니다.

  • 계정 정지 또는 영구 차단이 발생할 수 있습니다.

  • 요약기 엔드포인트는 내부용이며 예고 없이 변경될 수 있습니다.

  • 사용 시 위험은 본인이 감수해야 합니다. 작성자는 Kagi에 의해 취해진 계정 조치를 포함한 어떠한 결과에 대해서도 책임을 지지 않습니다.

라이선스

MIT

Available Tools

2 tools
kagi_search_fetchA

Fetch web results based on one or more queries using Kagi Search.

Use for general search and when the user explicitly tells you to 'fetch' results/information. Results are from all queries given. They are numbered continuously, so that a user may be able to refer to a result by a specific number.

ParametersJSON Schema
NameRequiredDescriptionDefault
queriesYesOne or more concise, keyword-focused search queries. Include essential context within each query for standalone use. Supports Kagi operators: site:, -site:, filetype:/ext:, intitle:, inurl:, lang:, loc:, before:, after:, "exact phrase", +term, -term
limitNoMaximum number of results per query. Default: all available.

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It mentions numbering and that results are from all queries, but fails to disclose other behavioral traits such as pagination, caching, or auth requirements.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise, with three sentences that are front-loaded with purpose. Every sentence adds value without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the presence of an output schema, return values need not be explained. The description is adequate for basic usage, though it could mention rate limits or error handling for completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, and the description adds meaning by specifying that queries should be concise and keyword-focused, with essential context. The limit parameter's default behavior is explained.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it fetches web results using Kagi Search, for general search and when the user explicitly asks to 'fetch'. It distinguishes from the sibling tool kagi_summarizer by focusing on search results rather than summaries.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explains when to use (general search, explicit fetch) and notes that results from all queries are numbered continuously. While it doesn't explicitly state when not to use, the sibling context implies summarization is separate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

kagi_summarizerA

Summarize content from a URL using the Kagi Summarizer.

The Summarizer can summarize any document type (text webpage, video, audio, etc.)

Note: This tool uses Kagi's internal summarizer endpoint accessed via session token. This is experimental and may break if Kagi changes their internal API.

ParametersJSON Schema
NameRequiredDescriptionDefault
urlYesA URL to a document to summarize.
summary_typeNoType of summary to produce. Options are 'summary' for paragraph prose and 'takeaway' for a bulleted list of key points.summary
target_languageNoDesired output language using language codes (e.g., 'EN' for English). If not specified, the document's original language influences the output.
engineNoSummarizer engine to use. 'cecil' is the default. Note: This is an experimental feature — the summarizer endpoint may change without notice.cecil

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.6/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full responsibility for behavioral disclosure. It clearly states the experimental nature, potential breakage, and support for various content types. It does not detail error handling or rate limits, but the explicit warning about instability adds significant transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and structured: a clear purpose statement, a brief capability note, and a critical caution. Each sentence serves a purpose, though the capability note could be integrated into the first sentence.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's 4 parameters and existing output schema (not shown), the description provides enough context to understand the tool's function and risks. However, it lacks guidance on error handling, prerequisites (e.g., need for a valid session token), and typical usage scenarios, which would enhance completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, so the baseline is 3. The description adds limited value, only restating the summary_type and engine options in a mildly explanatory way. It does not introduce new meaning beyond the schema's own descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool summarizes content from a URL using Kagi Summarizer, including support for various document types. It distinguishes from the sibling tool (kagi_search_fetch) by focusing on summarization rather than search, though no explicit comparison is made.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description warns that the tool is experimental and may break due to internal API changes, which provides important context. However, it does not specify when to use this tool over alternatives or when not to use it, leaving the agent to infer from the sibling tool's purpose.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 2 tool updatesv0.2.1
    • First observedkagi_search_fetch
    • First observedkagi_summarizer

TDQS

A3.9/5.0

Scored across 2 tools

Disambiguation5/5

The two tools have clearly distinct purposes: one fetches search results, the other summarizes content from URLs. There is no overlap or ambiguity in their functionality.

Naming Consistency5/5

Both tools follow a consistent verb_noun pattern with the 'kagi_' prefix ('kagi_search_fetch', 'kagi_summarizer'), making the naming predictable and understandable.

Tool Count3/5

With only 2 tools, the server feels minimal but still reasonable for its narrow focus on Kagi search and summarizer APIs. The experimental nature of the summarizer tool might warrant additional tools in the future.

Completeness4/5

The tool surface covers the two core operations of the Kagi API: search and summarization. While there are no additional utilities like listing or filtering, the basic workflow is supported without obvious dead ends.

Maintenance

ActivityInactive
ResponsivenessSlow

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    C
    maintenance
    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.
    2
    42
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables integration with Kagi search engine services including web search, content summarization from URLs, and AI assistant conversations. Uses session tokens to access Kagi's search API, summarizer, and AI models directly within MCP-compatible applications.
    8 npm
    3
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Free web search MCP server using SearXNG, supporting web search, news search, and search summaries.
    MIT
  • A
    license
    A
    quality
    B
    maintenance
    MCP server for Kagi Search that uses your session token for web and news search without a separate API subscription.
    3
    27 npm
    MIT