Skip to main content

kagi mcp

Run a stdio JSON-RPC server that exposes Kagi tools for agents.

Synopsis

Install into an AI agent

kagi mcp install, kagi mcp setup, and kagi mcp auth are aliases for the same setup flow. On a TTY, the command asks which agents to configure. In scripts, pass one or more --target values:
Supported targets: Use --server-name <NAME> to choose a different MCP server key, or --kagi-path <PATH> if the client needs a specific executable path. By default, setup uses the currently running kagi executable. Setup merges into existing config and preserves other MCP servers. It updates only the selected server key, which defaults to kagi-mcp.

Use with Codex

kagi mcp is a stdio server. You normally do not run it in a separate terminal; your MCP client launches it when it needs Kagi tools. Start by making sure kagi works from your shell:
Then add it to Codex:
Check the saved entry:
You should see command pointing at the kagi binary and args set to mcp. If Codex will not run from the directory that contains your ./.kagi.toml, pass credentials through the MCP entry instead:
Use only the environment values you need. KAGI_SESSION_TOKEN unlocks subscriber-backed search, Quick Answer, and news search. Add --env KAGI_API_KEY="$KAGI_API_KEY" when you want current /api/v1 Search or Extract. Add --env KAGI_API_TOKEN="$KAGI_API_TOKEN" when you want the legacy public summarizer. If you previously used the separate kagi-mcp wrapper, replace it with the native CLI server:
Restart Codex after changing MCP entries so the tool list is rediscovered. To use a named profile from ./.kagi.toml, put --profile after mcp:
Use TOON by default for token-efficient agent context:
Expose account and local-state mutation tools only when you want an agent to manage settings:

Tools

Default read/query tools:
  • kagi_search and kagi_batch_search - web search, News-tab search, filters, lenses, snaps, dates, ordering, templates, follow summaries, cache options, and output formats.
  • kagi_summarize - public API or subscriber summarizer with engine, summary type, target language, length, cache, and local cache options.
  • kagi_extract - Extract API markdown, JSON, compact JSON, or TOON output.
  • kagi_quick - Quick Answer with lens, cache, and output options.
  • kagi_news, kagi_news_categories, kagi_news_chaos, and kagi_news_filter_presets - public Kagi News feed and metadata.
  • kagi_news_search - subscriber News-tab search clusters.
  • kagi_assistant, kagi_assistant_models, kagi_assistant_thread_list, kagi_assistant_thread_get, and kagi_assistant_thread_export - Assistant prompt and thread reads.
  • kagi_assistant_custom_list and kagi_assistant_custom_get - read saved assistant definitions.
  • kagi_ask_page - page-focused Assistant question.
  • kagi_translate - Kagi Translate text mode.
  • kagi_fastgpt - FastGPT API answers.
  • kagi_enrich_web and kagi_enrich_news - enrichment indexes.
  • kagi_smallweb - Small Web feed.
  • kagi_lens_list, kagi_lens_get, kagi_custom_bang_list, kagi_custom_bang_get, kagi_redirect_list, and kagi_redirect_get - read account search settings.
  • kagi_auth_status and kagi_auth_check - inspect and validate selected credentials.
  • kagi_history_list, kagi_history_stats, and kagi_site_pref_list - inspect local CLI state.
Tools exposed only with --enable-mutating-tools:
  • kagi_assistant_thread_delete
  • kagi_assistant_custom_create, kagi_assistant_custom_update, kagi_assistant_custom_delete
  • kagi_lens_create, kagi_lens_update, kagi_lens_delete, kagi_lens_enable, kagi_lens_disable
  • kagi_custom_bang_create, kagi_custom_bang_update, kagi_custom_bang_delete
  • kagi_redirect_create, kagi_redirect_update, kagi_redirect_delete, kagi_redirect_enable, kagi_redirect_disable
  • kagi_site_pref_set, kagi_site_pref_remove
  • kagi_cli - run any non-mcp kagi command by passing an args array and optional stdin. Use this for exact CLI parity when a workflow is not modeled as a structured MCP tool.
The server reads one JSON-RPC request per stdin line and writes one JSON-RPC response per stdout line. This keeps the implementation dependency-light and easy to supervise from agent runners.

Authentication

The server uses the same credentials as the CLI. Use --profile <NAME> to select a profile before mcp.