npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mjakl/pi-kagi-search

v1.0.2

Published

Kagi search tool for Pi coding agent

Readme

Pi Kagi Search

Kagi search tool for Pi agent. Uses your existing Kagi subscription via session token.

Why Pi Kagi Search

Uses Existing Subscription — If you have a Kagi subscription, you can use this extension without needing a separate API key. Just provide your session token.

High-Quality Results — Kagi is designed for relevance over ads. In practice, this often means cleaner, more useful results with less SEO noise, so Pi can start from stronger sources.

Better Research Flow — When search results are high-signal, the agent spends less time filtering low-value pages and more time helping you solve the real problem.

Install

Option 1: Install from npm (recommended)

Once the package is published to npm:

pi install npm:@mjakl/pi-kagi-search

If it is not published yet, use Option 2 or 3 below.

Option 2: Install via git

pi install git:github.com/mjakl/pi-kagi-search

Option 3: Manual Installation

Clone this repository to your Pi extensions directory:

cd ~/.pi/agent/extensions
git clone https://github.com/mjakl/pi-kagi-search.git
cd pi-kagi-search
npm install

Configuration

Get Your Session Token

  1. Log in to Kagi
  2. Go to Settings → User Details
  3. Find your Session Link or visit kagi.com/settings?p=token
  4. Extract the token value from the URL

Set the Token

Option 1: Environment Variable (Recommended)

export KAGI_SESSION_TOKEN="your-token-here"

Add to your shell profile (~/.zshrc, ~/.bashrc) to persist.

Option 2: Interactive Login

pi
# Then use the command:
/kagi-login

Option 3: Config File

Create ~/.pi/kagi-search.json:

{
  "sessionToken": "your-token-here"
}

Option 4: Plain Text File

Create ~/.kagi_session_token with just the token:

echo "your-token-here" > ~/.kagi_session_token

This is checked as the last fallback if other methods are not configured.

Web Fetching

For fetching page contents, we recommend using a dedicated webfetch tool like Ben Vargas' Firecrawl extension. The agent can also fall back to curl to retrieve content when needed.

Commands

| Command | Description | |---------|-------------| | /kagi-login | Set your Kagi session token interactively |

Security Note

Your session token provides access to your Kagi account. Keep it private and treat it like a password. The token can be stored in:

  1. Environment variable (most secure for shell sessions)
  2. ~/.pi/kagi-search.json config file
  3. ~/.kagi_session_token plain text file (last fallback)

Comparison to Kagi API

| Feature | Kagi API | This Extension | |---------|----------|----------------| | Requires API access | Yes (invite-only) | No | | Uses existing subscription | No | Yes | | Search | Yes | Yes | | Rate limits | API limits | Account limits |

This extension is useful if you have a Kagi subscription but don't have API access yet.

Related Projects

Author

Inspired by kagi-ken by Carlo Zottmann.

License

MIT