Skip to main content

MCP server wrapping kagi-cli.

Project description

caddyglow-kagi-mcp

MCP server that exposes Kagi services through the Python client shipped by kagi-cli.

Requirements

  • Python 3.12+
  • uv
  • A valid KAGI_SESSION value from your Kagi session link

You can provide KAGI_SESSION through the environment or through a project-local .env file:

KAGI_SESSION="your_session_value_from_link"

Install

uv sync

Run

export KAGI_SESSION="your_session_value_from_link"
uv run kagi-mcp

Or, with .env present:

uv run kagi-mcp

Run without a persistent project environment:

KAGI_SESSION="your_session_value_from_link" uvx caddyglow-kagi-mcp

Run from this checkout with uvx:

KAGI_SESSION="your_session_value_from_link" uvx --from /home/rick/projects-caddy/kagi-mcp kagi-mcp

Check the installed version:

uvx caddyglow-kagi-mcp --version

The server communicates over stdio for MCP clients.

Logging is written to stderr so it does not corrupt MCP stdio messages. The default log level is WARNING; set KAGI_MCP_LOG_LEVEL to INFO or DEBUG when troubleshooting:

KAGI_MCP_LOG_LEVEL=INFO uv run kagi-mcp

HTTP and SSE Transports

Stdio is the default transport. For HTTP clients, run the server with either streamable HTTP or SSE:

KAGI_SESSION="your_session_value_from_link" \
KAGI_MCP_TRANSPORT=streamable-http \
KAGI_MCP_HOST=127.0.0.1 \
KAGI_MCP_PORT=8765 \
uvx caddyglow-kagi-mcp

The streamable HTTP endpoint is:

http://127.0.0.1:8765/mcp

SSE is also supported:

KAGI_SESSION="your_session_value_from_link" \
KAGI_MCP_TRANSPORT=sse \
KAGI_MCP_HOST=127.0.0.1 \
KAGI_MCP_PORT=8765 \
uvx caddyglow-kagi-mcp

The SSE endpoint is:

http://127.0.0.1:8765/sse

Equivalent CLI flags are available:

uvx caddyglow-kagi-mcp --transport streamable-http --host 127.0.0.1 --port 8765

MCP Tools

  • kagi_search(query, fetch_all=False)
  • kagi_ask(text, model="gpt-5-mini", thread=None, internet=True)
  • kagi_summarize(url, summary_type="takeaway")
  • kagi_proofread(text, lang="auto", style="general", level="standard", formality="default", context=None, model="standard")

Each tool calls the kagi_client library directly and returns MCP-friendly dictionaries.

Codex Example

For stdio, add this to ~/.codex/config.toml:

[mcp_servers.kagi]
command = "uvx"
args = ["caddyglow-kagi-mcp"]

[mcp_servers.kagi.env]
KAGI_SESSION = "your_session_value_from_link"
KAGI_MCP_LOG_LEVEL = "WARNING"

For streamable HTTP, start the server separately:

KAGI_SESSION="your_session_value_from_link" \
KAGI_MCP_TRANSPORT=streamable-http \
KAGI_MCP_PORT=8765 \
uvx caddyglow-kagi-mcp

Then add this to ~/.codex/config.toml:

[mcp_servers.kagi]
url = "http://127.0.0.1:8765/mcp"

For SSE, use:

[mcp_servers.kagi]
url = "http://127.0.0.1:8765/sse"

Claude Desktop Example

From this checkout, add the server with the Claude CLI:

claude mcp add kagi \
  --env KAGI_SESSION="your_session_value_from_link" \
  -- uv --directory /home/rick/projects-caddy/kagi-mcp run kagi-mcp

Using uvx instead:

claude mcp add kagi \
  --env KAGI_SESSION="your_session_value_from_link" \
  -- uvx caddyglow-kagi-mcp

Or add the equivalent JSON manually:

{
  "mcpServers": {
    "kagi": {
      "command": "uv",
      "args": ["--directory", "/home/rick/projects-caddy/kagi-mcp", "run", "kagi-mcp"],
      "env": {
        "KAGI_SESSION": "your_session_value_from_link",
        "KAGI_MCP_LOG_LEVEL": "WARNING"
      }
    }
  }
}

Development

uv run pytest
uv run ruff check .

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

caddyglow_kagi_mcp-0.1.0.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

caddyglow_kagi_mcp-0.1.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file caddyglow_kagi_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: caddyglow_kagi_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for caddyglow_kagi_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ae65b72ef7271bdda45372f23cfbdc367c4f0c765269b64a307322db2b844a3b
MD5 72560fac0802d02d1112c18a8d6cf2ca
BLAKE2b-256 8a40f090d4bad405eb6412b5f04c238c92b0a373c5afce1fd132b5b15d074024

See more details on using hashes here.

File details

Details for the file caddyglow_kagi_mcp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: caddyglow_kagi_mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for caddyglow_kagi_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 97b5ce2c56ef135b062fe1ed7edc20cf09ea0ea6b8fde830aa5a6f48af67c6c2
MD5 6b1a6d4b441cfa18a9db396206b8a559
BLAKE2b-256 8df8e13b491e023edc934a5569eff2d38635a2a67d7b38fe182e913032f9283f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page